Package com.aspectran.core.context.rule
Class ItemRule
- java.lang.Object
-
- com.aspectran.core.context.rule.ItemRule
-
public class ItemRule extends java.lang.Object
The Class ItemRule.Created: 2008. 03. 27 PM 3:57:48
-
-
Constructor Summary
Constructors Constructor Description ItemRule()
Instantiates a new ItemRule.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addValue(Token[] tokens)
Adds the specified value to this List type item.void
addValue(java.lang.String text)
Adds the specified value to this List type item.boolean
containsToken(Token token)
Token[]
getAllTokens()
java.lang.String
getDefaultValue()
Gets the default value of this item.java.lang.Boolean
getMandatory()
Returns whether this item is mandatory.java.lang.String
getName()
Returns the name of the item.static java.lang.Class<?>
getPrototypeClass(ItemRule ir, java.lang.Object value)
Gets the class of value.java.lang.Boolean
getSecurity()
Returns whether this item requires security input.java.lang.Boolean
getTokenize()
Returns whether to tokenize.Token[]
getTokens()
Gets the tokens.java.util.List<Token[]>
getTokensList()
Gets the list of tokens.java.util.Map<java.lang.String,Token[]>
getTokensMap()
Gets the tokens map.ItemType
getType()
Gets the type.java.lang.String
getValue()
Returns the value of the item.java.util.List<java.lang.String>
getValueList()
Returns a list of string values of this item.java.util.Map<java.lang.String,java.lang.String>
getValueMap()
Returns a map of string values of this item.ItemValueType
getValueType()
Gets the value type of this item.boolean
isAutoNamed()
Returns whether the item name was auto generated.boolean
isListableType()
Return whether this item is listable type.boolean
isMandatory()
Returns whether this item is mandatory.boolean
isMappableType()
Return whether this item is mappable type.boolean
isSecurity()
Returns whether this item requires security input.boolean
isTokenize()
Returns whether tokenize.static Token
makeReferenceToken(java.lang.String bean, java.lang.String template, java.lang.String parameter, java.lang.String attribute, java.lang.String property)
Returns a made reference token.static ItemRule
newInstance(java.lang.String type, java.lang.String name, java.lang.String valueType, java.lang.String defaultValue, java.lang.Boolean tokenize, java.lang.Boolean mandatory, java.lang.Boolean security)
Returns a new derived instance of ItemRule.void
putValue(java.lang.String name, Token[] tokens)
Puts the specified value with the specified key to this Map type item.void
putValue(java.lang.String name, java.lang.String text)
Puts the specified value with the specified key to this Map type item.void
setAutoNamed(boolean autoNamed)
Sets whether the item is an auto generated name.void
setDefaultValue(java.lang.String defaultValue)
Sets the default value of this item.void
setMandatory(java.lang.Boolean mandatory)
Sets whether this item is mandatory.void
setName(java.lang.String name)
Sets the name of a item.void
setSecurity(java.lang.Boolean security)
Sets whether this item requires security input.void
setTokenize(java.lang.Boolean tokenize)
Sets whether tokenize.void
setType(ItemType type)
Sets the item type.void
setValue(Token[] tokens)
Sets the specified value to this Single type item.void
setValue(java.lang.String text)
Sets the specified value to this Single type item.void
setValue(java.util.List<Token[]> tokensList)
Sets a value to this List type item.void
setValue(java.util.Map<java.lang.String,Token[]> tokensMap)
Sets a value to this Map type item.void
setValue(java.util.Properties properties)
Sets a value to this Properties type item.void
setValue(java.util.Set<Token[]> tokensSet)
Sets a value to this Set type item.void
setValueType(ItemValueType valueType)
Sets the value type of this item.static java.util.List<ItemParameters>
toItemParametersList(java.lang.String text)
Convert the givenString
into an ItemParameters
.static ItemRule
toItemRule(Attribute attribute)
static ItemRule
toItemRule(Parameter parameter)
static ItemRule
toItemRule(ItemParameters itemParameters)
Convert the given item parameters into anItemRule
.static ItemRuleList
toItemRuleList(java.util.List<ItemParameters> itemParametersList)
Convert the given item parameters list into anItemRuleList
.static ItemRuleMap
toItemRuleMap(Attribute[] attributes)
static ItemRuleMap
toItemRuleMap(Parameter[] parameters)
static ItemRuleMap
toItemRuleMap(java.lang.String text)
Convert the givenString
into anItemRuleMap
.static ItemRuleMap
toItemRuleMap(java.util.List<ItemParameters> itemParametersList)
Convert the given item parameters list into anItemRuleMap
.static java.util.Iterator<Token[]>
tokenIterator(ItemRule itemRule)
Returns aToken
iterator.java.lang.String
toString()
-
-
-
Method Detail
-
getType
public ItemType getType()
Gets the type.- Returns:
- the type
-
setType
public void setType(ItemType type)
Sets the item type.- Parameters:
type
- the new item type
-
getName
public java.lang.String getName()
Returns the name of the item.- Returns:
- the name of the item
-
setName
public void setName(java.lang.String name)
Sets the name of a item.- Parameters:
name
- the name to set
-
getValue
public java.lang.String getValue()
Returns the value of the item.- Returns:
- the value of the item
-
getTokens
public Token[] getTokens()
Gets the tokens.- Returns:
- the tokens
-
getTokensList
public java.util.List<Token[]> getTokensList()
Gets the list of tokens.- Returns:
- the tokens list
-
getValueList
public java.util.List<java.lang.String> getValueList()
Returns a list of string values of this item.- Returns:
- a list of string values
-
getTokensMap
public java.util.Map<java.lang.String,Token[]> getTokensMap()
Gets the tokens map.- Returns:
- the tokens map
-
getValueMap
public java.util.Map<java.lang.String,java.lang.String> getValueMap()
Returns a map of string values of this item.- Returns:
- a map of string values
-
setValue
public void setValue(java.lang.String text)
Sets the specified value to this Single type item.- Parameters:
text
- the value to be analyzed for use as the value of this item- See Also:
setValue(Token[])
-
setValue
public void setValue(Token[] tokens)
Sets the specified value to this Single type item.- Parameters:
tokens
- an array of tokens
-
putValue
public void putValue(java.lang.String name, java.lang.String text)
Puts the specified value with the specified key to this Map type item.- Parameters:
name
- the value name; may be nulltext
- the value to be analyzed for use as the value of this item- See Also:
putValue(String, Token[])
-
putValue
public void putValue(java.lang.String name, Token[] tokens)
Puts the specified value with the specified key to this Map type item.- Parameters:
name
- the value name; may be nulltokens
- an array of tokens
-
setValue
public void setValue(java.util.Map<java.lang.String,Token[]> tokensMap)
Sets a value to this Map type item.- Parameters:
tokensMap
- the tokens map
-
setValue
public void setValue(java.util.Properties properties)
Sets a value to this Properties type item.- Parameters:
properties
- the properties
-
addValue
public void addValue(java.lang.String text)
Adds the specified value to this List type item.- Parameters:
text
- the value to be analyzed for use as the value of this item- See Also:
addValue(Token[])
-
addValue
public void addValue(Token[] tokens)
Adds the specified value to this List type item.- Parameters:
tokens
- an array of tokens
-
setValue
public void setValue(java.util.List<Token[]> tokensList)
Sets a value to this List type item.- Parameters:
tokensList
- the tokens list
-
setValue
public void setValue(java.util.Set<Token[]> tokensSet)
Sets a value to this Set type item.- Parameters:
tokensSet
- the tokens set
-
getValueType
public ItemValueType getValueType()
Gets the value type of this item.- Returns:
- the value type of this item
-
setValueType
public void setValueType(ItemValueType valueType)
Sets the value type of this item.- Parameters:
valueType
- the new value type
-
getDefaultValue
public java.lang.String getDefaultValue()
Gets the default value of this item.- Returns:
- the default value
-
setDefaultValue
public void setDefaultValue(java.lang.String defaultValue)
Sets the default value of this item.- Parameters:
defaultValue
- the new default value
-
getTokenize
public java.lang.Boolean getTokenize()
Returns whether to tokenize.- Returns:
- whether to tokenize
-
isTokenize
public boolean isTokenize()
Returns whether tokenize.- Returns:
- whether tokenize
-
setTokenize
public void setTokenize(java.lang.Boolean tokenize)
Sets whether tokenize.- Parameters:
tokenize
- whether tokenize
-
isAutoNamed
public boolean isAutoNamed()
Returns whether the item name was auto generated.- Returns:
- true, if the item name was auto generated
-
setAutoNamed
public void setAutoNamed(boolean autoNamed)
Sets whether the item is an auto generated name.- Parameters:
autoNamed
- true, if the item name is auto generated
-
isListableType
public boolean isListableType()
Return whether this item is listable type.- Returns:
- true, if this item is listable type
-
isMappableType
public boolean isMappableType()
Return whether this item is mappable type.- Returns:
- true, if this item is mappable type
-
getMandatory
public java.lang.Boolean getMandatory()
Returns whether this item is mandatory.- Returns:
- whether or not this item is mandatory
-
isMandatory
public boolean isMandatory()
Returns whether this item is mandatory.- Returns:
- whether or not this item is mandatory
-
setMandatory
public void setMandatory(java.lang.Boolean mandatory)
Sets whether this item is mandatory.- Parameters:
mandatory
- whether or not this item is mandatory
-
getSecurity
public java.lang.Boolean getSecurity()
Returns whether this item requires security input.- Returns:
- whether or not this item requires security input
-
isSecurity
public boolean isSecurity()
Returns whether this item requires security input.- Returns:
- whether or not this item requires security input
-
setSecurity
public void setSecurity(java.lang.Boolean security)
Sets whether this item requires security input.- Parameters:
security
- whether or not this item requires security input
-
getAllTokens
public Token[] getAllTokens()
-
containsToken
public boolean containsToken(Token token)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getPrototypeClass
public static java.lang.Class<?> getPrototypeClass(ItemRule ir, java.lang.Object value)
Gets the class of value.- Parameters:
ir
- the item rulevalue
- the value- Returns:
- the class of value
-
newInstance
public static ItemRule newInstance(java.lang.String type, java.lang.String name, java.lang.String valueType, java.lang.String defaultValue, java.lang.Boolean tokenize, java.lang.Boolean mandatory, java.lang.Boolean security) throws IllegalRuleException
Returns a new derived instance of ItemRule.- Parameters:
type
- the typename
- the namevalueType
- the value typedefaultValue
- the default valuetokenize
- whether to tokenizemandatory
- whether or not this item is mandatorysecurity
- whether or not this item requires security input- Returns:
- the item rule
- Throws:
IllegalRuleException
- if an illegal rule is found
-
makeReferenceToken
public static Token makeReferenceToken(java.lang.String bean, java.lang.String template, java.lang.String parameter, java.lang.String attribute, java.lang.String property)
Returns a made reference token.- Parameters:
bean
- the bean idtemplate
- the template idparameter
- the parameter nameattribute
- the attribute nameproperty
- the property name- Returns:
- the token
-
tokenIterator
public static java.util.Iterator<Token[]> tokenIterator(ItemRule itemRule)
Returns aToken
iterator.- Parameters:
itemRule
- the item rule- Returns:
- the iterator for tokens
-
toItemRuleMap
public static ItemRuleMap toItemRuleMap(java.util.List<ItemParameters> itemParametersList) throws IllegalRuleException
Convert the given item parameters list into anItemRuleMap
.- Parameters:
itemParametersList
- the item parameters list to convert- Returns:
- the item rule map
- Throws:
IllegalRuleException
- if an illegal rule is found
-
toItemRuleList
public static ItemRuleList toItemRuleList(java.util.List<ItemParameters> itemParametersList) throws IllegalRuleException
Convert the given item parameters list into anItemRuleList
.- Parameters:
itemParametersList
- the item parameters list to convert- Returns:
- the item rule list
- Throws:
IllegalRuleException
- if an illegal rule is found
-
toItemRule
public static ItemRule toItemRule(ItemParameters itemParameters) throws IllegalRuleException
Convert the given item parameters into anItemRule
.[ { type: "map" name: "property1" value: { code1: "value1" code2: "value2" } valueType: "java.lang.String" defaultValue: "default value" tokenize: true } { name: "property2" value(int): 123 } { name: "property2" reference: { bean: "a.bean" } } ]
- Parameters:
itemParameters
- the item parameters- Returns:
- an instance of
ItemRule
- Throws:
IllegalRuleException
- if an illegal rule is found
-
toItemParametersList
public static java.util.List<ItemParameters> toItemParametersList(java.lang.String text)
Convert the givenString
into an ItemParameters
.- Parameters:
text
- theString
to convert- Returns:
- the item parameters list
-
toItemRuleMap
public static ItemRuleMap toItemRuleMap(java.lang.String text) throws IllegalRuleException
Convert the givenString
into anItemRuleMap
.- Parameters:
text
- theString
to convert- Returns:
- an
ItemRuleMap
- Throws:
IllegalRuleException
- if an illegal rule is found
-
toItemRuleMap
public static ItemRuleMap toItemRuleMap(Parameter[] parameters) throws IllegalRuleException
- Throws:
IllegalRuleException
-
toItemRule
public static ItemRule toItemRule(Parameter parameter) throws IllegalRuleException
- Throws:
IllegalRuleException
-
toItemRuleMap
public static ItemRuleMap toItemRuleMap(Attribute[] attributes) throws IllegalRuleException
- Throws:
IllegalRuleException
-
toItemRule
public static ItemRule toItemRule(Attribute attribute) throws IllegalRuleException
- Throws:
IllegalRuleException
-
-