Package com.aspectran.core.context.rule
Class ItemRule
- java.lang.Object
-
- com.aspectran.core.context.rule.ItemRule
-
public class ItemRule extends java.lang.ObjectThe 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 voidaddValue(Token[] tokens)Adds the specified value to this List type item.voidaddValue(java.lang.String text)Adds the specified value to this List type item.booleancontainsToken(Token token)Token[]getAllTokens()java.lang.StringgetDefaultValue()Gets the default value of this item.java.lang.BooleangetMandatory()Returns whether this item is mandatory.java.lang.StringgetName()Returns the name of the item.static java.lang.Class<?>getPrototypeClass(ItemRule ir, java.lang.Object value)Gets the class of value.java.lang.BooleangetSecret()Returns whether this item requires secure input.java.lang.BooleangetTokenize()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.ItemTypegetType()Gets the item type.java.lang.StringgetValue()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.ItemValueTypegetValueType()Gets the value type of this item.booleanisAutoNamed()Returns whether the item name was auto generated.booleanisListableType()Return whether this item is listable type.booleanisMandatory()Returns whether this item is mandatory.booleanisMappableType()Return whether this item is mappable type.booleanisSecret()Returns whether this item requires secure input.booleanisTokenize()Returns whether tokenize.static TokenmakeReferenceToken(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 ItemRulenewInstance(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 secret)Returns a new derived instance of ItemRule.voidputValue(java.lang.String name, Token[] tokens)Puts the specified value with the specified key to this Map type item.voidputValue(java.lang.String name, java.lang.String text)Puts the specified value with the specified key to this Map type item.voidsetAutoNamed(boolean autoNamed)Sets whether the item is an auto generated name.voidsetDefaultValue(java.lang.String defaultValue)Sets the default value of this item.voidsetMandatory(java.lang.Boolean mandatory)Sets whether this item is mandatory.voidsetName(java.lang.String name)Sets the name of the item.voidsetSecret(java.lang.Boolean secret)Sets whether this item requires secure input.voidsetTokenize(java.lang.Boolean tokenize)Sets whether tokenize.voidsetType(ItemType type)Sets the item type.voidsetValue(Token[] tokens)Sets the specified value to this Single type item.voidsetValue(java.lang.String text)Sets the specified value to this Single type item.voidsetValue(java.util.List<Token[]> tokensList)Sets a value to this List type item.voidsetValue(java.util.Map<java.lang.String,Token[]> tokensMap)Sets a value to this Map type item.voidsetValue(java.util.Properties properties)Sets a value to this Properties type item.voidsetValue(java.util.Set<Token[]> tokensSet)Sets a value to this Set type item.voidsetValueType(ItemValueType valueType)Sets the value type of this item.static ItemRuletoItemRule(Attribute attribute)static ItemRuletoItemRule(Parameter parameter)static ItemRuletoItemRule(ItemParameters itemParameters)Convert the given item parameters into anItemRule.static ItemRuleListtoItemRuleList(java.util.List<ItemParameters> itemParametersList)Convert the given item parameters list into anItemRuleList.static ItemRuleMaptoItemRuleMap(Attribute[] attributes)static ItemRuleMaptoItemRuleMap(Parameter[] parameters)static ItemRuleMaptoItemRuleMap(java.util.List<ItemParameters> itemParametersList)Convert the given item parameters list into anItemRuleMap.static java.util.Iterator<Token[]>tokenIterator(ItemRule itemRule)Returns aTokeniterator.java.lang.StringtoString()
-
-
-
Method Detail
-
getType
public ItemType getType()
Gets the item type.- Returns:
- the item 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 the 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
-
getSecret
public java.lang.Boolean getSecret()
Returns whether this item requires secure input.- Returns:
- whether or not this item requires secure input
-
isSecret
public boolean isSecret()
Returns whether this item requires secure input.- Returns:
- whether or not this item requires secure input
-
setSecret
public void setSecret(java.lang.Boolean secret)
Sets whether this item requires secure input.- Parameters:
secret- whether or not this item requires secure input
-
getAllTokens
public Token[] getAllTokens()
-
containsToken
public boolean containsToken(Token token)
-
toString
public java.lang.String toString()
- Overrides:
toStringin 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 secret) throws IllegalRuleException
Returns a new derived instance of ItemRule.- Parameters:
type- the item typename- the name of the itemvalueType- the type of value an item can havedefaultValue- the default value used if the item has not been assigned a value or is nulltokenize- whether to tokenizemandatory- whether or not this item is mandatorysecret- whether or not this item requires secure 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 aTokeniterator.- 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
-
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
-
-