Class Token
java.lang.Object
com.aspectran.core.context.asel.token.Token
- All Implemented Interfaces:
BeanReferenceable
,Replicable<Token>
A token has a string value of its own or contains information
for fetching a specific value from another provider.
The following symbols are used to distinguish the providers of values:
- #
Refers to a bean specified by the Bean Registry.
ex)- #{beanId}
- #{beanId^getterName}
- #{beanId^getterName:defaultString}
- #{class:className}
- #{class:className^getterName}
- #{class:className^getterName:defaultString}
- ~
Refers to a string formatted from the Template Rule Registry.
ex)- ~{templateId}
- ~{templateId:defaultString}
- $
Refers to a parameter value.
ex)- ${parameterName}
- ${parameterName:defaultString}
- @
Refers to an attribute value.
ex)- @{attributeName}
- @{attributeName:defaultString}
- @{attributeName^getterName:defaultString}
- %
Refers to a property from the specified Properties file or environment variables.
ex)- %{environmentPropertyName}
- %{classpath:propertiesPath^getterName}
- %{classpath:propertiesPath^getterName:defaultString}
Created: 2008. 03. 27 PM 10:20:06
-
Field Summary
Modifier and TypeFieldDescriptionstatic final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
static final char
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
static String
Gets the alternative value.Returns the Bean Referrer Type.Gets the default value.Gets the token directive type.Gets the name of the property whose value is to be retrieved.getName()
Gets the token name.getType()
Gets the token type.getValue()
Returns the class name of the bean or the classpath of the Properties file, depending on the type of token.int
hashCode()
static boolean
static boolean
isTokenSymbol
(char c) Returns whether a specified character is the token symbol.Creates and returns a new instance after replicating a rule or Object.Token[]
static void
resolveAlternativeValue
(Token token, ClassLoader classLoader) static TokenType
resolveTypeAsSymbol
(char symbol) Returns the token type for the specified character.void
setAlternativeValue
(Object value) Sets the alternative value.void
setDefaultValue
(String defaultValue) Sets the default value.void
setGetterName
(String getterName) Sets the name of the property whose value is to be retrieved.void
Sets the class name of the bean or the classpath of the Properties file, depending on the type of the token.Convert a Token object into a string.toString()
-
Field Details
-
BEAN_SYMBOL
public static final char BEAN_SYMBOL- See Also:
-
PARAMETER_SYMBOL
public static final char PARAMETER_SYMBOL- See Also:
-
ATTRIBUTE_SYMBOL
public static final char ATTRIBUTE_SYMBOL- See Also:
-
PROPERTY_SYMBOL
public static final char PROPERTY_SYMBOL- See Also:
-
TEMPLATE_SYMBOL
public static final char TEMPLATE_SYMBOL- See Also:
-
BRACKET_OPEN
public static final char BRACKET_OPEN- See Also:
-
BRACKET_CLOSE
public static final char BRACKET_CLOSE- See Also:
-
VALUE_DELIMITER
public static final char VALUE_DELIMITER- See Also:
-
GETTER_DELIMITER
public static final char GETTER_DELIMITER- See Also:
-
-
Constructor Details
-
Token
Instantiates a new Token.- Parameters:
defaultValue
- the default value
-
Token
Instantiates a new Token.- Parameters:
type
- the token typename
- the token name
-
Token
Instantiates a new Token.- Parameters:
type
- the token typedirectiveType
- the token directive typevalue
- the token value
-
-
Method Details
-
getType
Gets the token type.- Returns:
- the token type
-
getDirectiveType
Gets the token directive type.- Returns:
- the token directive type
- See Also:
-
getName
Gets the token name.- Returns:
- the token name
-
getValue
Returns the class name of the bean or the classpath of the Properties file, depending on the type of token. For example, if the token type is "bean" and the token name is "class", the value of the token is the class name of the bean. Also, if the token type is "property" and the token name is "classpath", the value of the token is the path to reference in the Properties file.- Returns:
- the default value or bean's class name
-
setValue
Sets the class name of the bean or the classpath of the Properties file, depending on the type of the token.- Parameters:
value
- the class name of the bean or the classpath of the Properties file
-
getGetterName
Gets the name of the property whose value is to be retrieved.- Returns:
- the name of the property whose value is to be retrieved
-
getAlternativeValue
Gets the alternative value. It is a value corresponding to class name or class path according to token directive.- Returns:
- the alternative value
-
setAlternativeValue
Sets the alternative value. It is a value corresponding to class name or class path according to token directive.- Parameters:
value
- the new alternative value
-
setGetterName
Sets the name of the property whose value is to be retrieved.- Parameters:
getterName
- the name of the property whose value is to be retrieved
-
getDefaultValue
Gets the default value.- Returns:
- the default value
-
setDefaultValue
Sets the default value.- Parameters:
defaultValue
- the new default value
-
getBeanRefererType
Description copied from interface:BeanReferenceable
Returns the Bean Referrer Type.- Specified by:
getBeanRefererType
in interfaceBeanReferenceable
- Returns:
- the Bean Referrer Type
-
stringify
Convert a Token object into a string.- Returns:
- a string representation of the token
-
equals
-
hashCode
public int hashCode() -
replicate
Description copied from interface:Replicable
Creates and returns a new instance after replicating a rule or Object.- Specified by:
replicate
in interfaceReplicable<Token>
- Returns:
- replicated rule or new instance of Object
-
replicate
-
toString
-
isTokenSymbol
public static boolean isTokenSymbol(char c) Returns whether a specified character is the token symbol.- Parameters:
c
- a character- Returns:
- true, if a specified character is one of the token symbols
-
hasToken
-
resolveTypeAsSymbol
Returns the token type for the specified character.- Parameters:
symbol
- the token symbol character- Returns:
- the token type
-
resolveAlternativeValue
-
format
-