Documentation
¶
Index ¶
- func FormatProperties(tab Properties) string
- func FormatPropertiesWithSegment(tab Properties) string
- func ResolvePropertiesVar(props Properties) error
- func ResolvePropertiesVarWithTokens(token1, token2 string, props Properties) error
- type ArgumentFlag
- type ArgumentReader
- type Arguments
- type Attributes
- type Atts
- type Environment
- type Parameters
- type Properties
- type PropertyGetter
- type PropertySetter
- type Res
- type Resource
- type Resources
- type SimpleAttributes
- func (inst *SimpleAttributes) Export(dst map[string]lang.Object) map[string]lang.Object
- func (inst *SimpleAttributes) GetAttribute(name string) lang.Object
- func (inst *SimpleAttributes) GetAttributeRequired(name string) (lang.Object, error)
- func (inst *SimpleAttributes) Import(src map[string]lang.Object)
- func (inst *SimpleAttributes) SetAttribute(name string, value lang.Object)
- type SimpleEnvironment
- type SimpleParameters
- type SimpleProperties
- func (inst *SimpleProperties) Clear()
- func (inst *SimpleProperties) Export(dst map[string]string) map[string]string
- func (inst *SimpleProperties) GetProperty(name string, defaultValue string) string
- func (inst *SimpleProperties) GetPropertyRequired(name string) (string, error)
- func (inst *SimpleProperties) Getter() PropertyGetter
- func (inst *SimpleProperties) Import(src map[string]string)
- func (inst *SimpleProperties) SetProperty(name string, value string)
- func (inst *SimpleProperties) Setter() PropertySetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatPropertiesWithSegment ¶
func FormatPropertiesWithSegment(tab Properties) string
FormatPropertiesWithSegment 将属性表格式化为文本形式(支持分段)
func ResolvePropertiesVar ¶ added in v0.0.68
func ResolvePropertiesVar(props Properties) error
ResolvePropertiesVar 解析 Properties 中的变量
func ResolvePropertiesVarWithTokens ¶ added in v0.0.68
func ResolvePropertiesVarWithTokens(token1, token2 string, props Properties) error
ResolvePropertiesVarWithTokens 解析 Properties 中的变量,token1:变量开始;token2:变量结束
Types ¶
type ArgumentFlag ¶ added in v0.0.73
ArgumentFlag 代表参数表中的一个标志
type ArgumentReader ¶ added in v0.0.14
type ArgumentReader interface {
Flags() []string
GetFlag(name string) ArgumentFlag
PickNext() (string, bool)
}
ArgumentReader 代表一个参数表的读者
type Arguments ¶
type Arguments interface {
NewReader() ArgumentReader
Length() int
Get(index int) string
Import([]string)
Export() []string
}
Arguments 代表参数表对象
func InitArguments ¶ added in v0.0.73
InitArguments 用给定的数据初始化一个新的参数表
type Attributes ¶
type Attributes interface {
Atts
GetAttributeRequired(name string) (lang.Object, error)
Import(map[string]lang.Object)
Export(map[string]lang.Object) map[string]lang.Object
}
func CreateAttributes ¶
func CreateAttributes() Attributes
type Environment ¶
type Environment interface {
GetEnv(name string) (string, error)
SetEnv(name string, value string)
Import(map[string]string)
Export(map[string]string) map[string]string
}
func CreateEnvironment ¶
func CreateEnvironment() Environment
type Parameters ¶
type Parameters interface {
GetParam(name string) (string, error)
Import(map[string]string)
Export(map[string]string) map[string]string
}
func CreateParameters ¶
func CreateParameters() Parameters
type Properties ¶
type Properties interface {
GetPropertyRequired(name string) (string, error)
GetProperty(name string, defaultValue string) string
SetProperty(name string, defaultValue string)
Clear()
Getter() PropertyGetter
Setter() PropertySetter
Export(map[string]string) map[string]string
Import(map[string]string)
}
Properties 接口表示对属性列表的引用。
func ParseProperties ¶
func ParseProperties(text string, container Properties) (Properties, error)
ParseProperties 函数把参数 text 解析为属性表,存入dest中。
type PropertyGetter ¶ added in v0.0.65
type PropertyGetter interface {
Error() error
SetError(err error)
CleanError()
GetString(name string, defaultValue string) string
GetBool(name string, defaultValue bool) bool
GetInt(name string, defaultValue int) int
GetInt8(name string, defaultValue int8) int8
GetInt16(name string, defaultValue int16) int16
GetInt32(name string, defaultValue int32) int32
GetInt64(name string, defaultValue int64) int64
GetUint(name string, defaultValue uint) uint
GetUint8(name string, defaultValue uint8) uint8
GetUint16(name string, defaultValue uint16) uint16
GetUint32(name string, defaultValue uint32) uint32
GetUint64(name string, defaultValue uint64) uint64
GetFloat32(name string, defaultValue float32) float32
GetFloat64(name string, defaultValue float64) float64
}
PropertyGetter 接口用来获取 Properties 中的属性
func CreatePropertyGetter ¶ added in v0.0.69
func CreatePropertyGetter(p Properties) PropertyGetter
CreatePropertyGetter 创建一个简单的属性表 Getter
type PropertySetter ¶ added in v0.0.65
type PropertySetter interface {
SetString(name string, defaultValue string)
SetBool(name string, defaultValue bool)
SetInt(name string, defaultValue int)
SetInt8(name string, defaultValue int8)
SetInt16(name string, defaultValue int16)
SetInt32(name string, defaultValue int32)
SetInt64(name string, defaultValue int64)
SetUint(name string, defaultValue uint)
SetUint8(name string, defaultValue uint8)
SetUint16(name string, defaultValue uint16)
SetUint32(name string, defaultValue uint32)
SetUint64(name string, defaultValue uint64)
SetFloat32(name string, defaultValue float32)
SetFloat64(name string, defaultValue float64)
}
PropertySetter 接口用来设置 Properties 中的属性
func CreatePropertySetter ¶ added in v0.0.69
func CreatePropertySetter(p Properties) PropertySetter
CreatePropertySetter 创建一个简单的属性表 Setter
type Res ¶ added in v0.0.33
type Res interface {
// 加载文本
ReadText() (string, error)
// 加载二进制数据
ReadBinary() ([]byte, error)
// 读数据流
Reader() (io.ReadCloser, error)
// 取长度
Length() int64
IsFile() bool
IsDir() bool
Exists() bool
}
Res 接口代表一个资源实体
type Resource ¶ added in v0.0.33
type Resource struct {
Name string
AbsolutePath string
RelativePath string
BasePath string
IsDir bool
}
Resource 结构包含某个资源的信息
type Resources ¶
type Resources interface {
// 加载文本数据
GetText(path string) (string, error)
// 加载二进制数据
GetBinary(path string) ([]byte, error)
// 读数据流
GetReader(path string) (io.ReadCloser, error)
// 列出所有资源的路径, 相当于{{ List("/",true) }}
All() []*Resource
// 列出所有资源的路径
List(path string, recursive bool) []*Resource
Get(path string) (Res, error)
Clear()
Import(src map[string]Res, override bool)
Export(dst map[string]Res) map[string]Res
}
Resources 接口提供一组获取资源的方法
type SimpleAttributes ¶
type SimpleAttributes struct {
// contains filtered or unexported fields
}
func (*SimpleAttributes) GetAttribute ¶
func (inst *SimpleAttributes) GetAttribute(name string) lang.Object
func (*SimpleAttributes) GetAttributeRequired ¶ added in v0.0.3
func (inst *SimpleAttributes) GetAttributeRequired(name string) (lang.Object, error)
func (*SimpleAttributes) SetAttribute ¶ added in v0.0.3
func (inst *SimpleAttributes) SetAttribute(name string, value lang.Object)
type SimpleEnvironment ¶
type SimpleEnvironment struct {
// contains filtered or unexported fields
}
func (*SimpleEnvironment) Export ¶
func (inst *SimpleEnvironment) Export(dst map[string]string) map[string]string
func (*SimpleEnvironment) GetEnv ¶
func (inst *SimpleEnvironment) GetEnv(name string) (string, error)
func (*SimpleEnvironment) Import ¶
func (inst *SimpleEnvironment) Import(src map[string]string)
func (*SimpleEnvironment) SetEnv ¶
func (inst *SimpleEnvironment) SetEnv(name string, value string)
type SimpleParameters ¶
type SimpleParameters struct {
}
func (*SimpleParameters) Export ¶
func (inst *SimpleParameters) Export(table map[string]string) map[string]string
func (*SimpleParameters) GetParam ¶
func (inst *SimpleParameters) GetParam(name string) (string, error)
func (*SimpleParameters) Import ¶
func (inst *SimpleParameters) Import(src map[string]string)
type SimpleProperties ¶
type SimpleProperties struct {
// contains filtered or unexported fields
}
SimpleProperties 实现一个简单的 Properties 集合
func (*SimpleProperties) Export ¶
func (inst *SimpleProperties) Export(dst map[string]string) map[string]string
Export 把本集合中的所有键值对导出
func (*SimpleProperties) GetProperty ¶
func (inst *SimpleProperties) GetProperty(name string, defaultValue string) string
GetProperty 在集合中取指定的值,如果没有则返回默认值
func (*SimpleProperties) GetPropertyRequired ¶
func (inst *SimpleProperties) GetPropertyRequired(name string) (string, error)
GetPropertyRequired 在集合中取指定的值,如果没有则返回error
func (*SimpleProperties) Getter ¶ added in v0.0.65
func (inst *SimpleProperties) Getter() PropertyGetter
Getter 取 Getter
func (*SimpleProperties) Import ¶
func (inst *SimpleProperties) Import(src map[string]string)
Import 把参数 src 中的所有键值对导入本集合,保留原有内容(如果没有被覆盖)
func (*SimpleProperties) SetProperty ¶
func (inst *SimpleProperties) SetProperty(name string, value string)
SetProperty 给集合中指定的键值对赋值
func (*SimpleProperties) Setter ¶ added in v0.0.65
func (inst *SimpleProperties) Setter() PropertySetter
Setter 取 Setter
Source Files
¶
- arguments.go
- attributes.go
- embed_resources.go
- environment.go
- parameters.go
- properties.go
- releasepool.go
- resources.go
- simple_arguments.go
- simple_attributes.go
- simple_environment.go
- simple_parameters.go
- simple_properties.go
- simple_properties_formatter.go
- simple_properties_getter.go
- simple_properties_parser.go
- simple_properties_resolver.go
- simple_properties_setter.go
- simple_resources.go