com.planetalia.dynject.preprocess
Annotation Type Normalized
@Target(value={FIELD,METHOD,TYPE})
@Retention(value=RUNTIME)
public @interface Normalized
Marks a property as "normalized", performing different value normalization operations before making
an assignment.
- Author:
- Alexander Hristov
|
Optional Element Summary |
boolean |
convertNull
If set to true, allows nulls to be converted into a base value before assignment or before
feeding the result to the next step. |
java.lang.String |
defaultValue
If set to something different than the default (the empty string), specifies a default value that
is used whenever a null value is received. |
PadType |
pad
Specifies how to pad the value. |
char |
padChar
Specifies which character to use when padding the value. |
int |
padLength
Specifies the length of the field into which to apply the padding. |
TransformType |
transform
Specifies the type of transformation to use before assigning the value. |
TrimType |
trim
Specifies how to process leading and trailing spaces of the value. |
WhitespaceProcessing |
whitespace
Specifies how to process whitespaces present in the value. |
transform
public abstract TransformType transform
- Specifies the type of transformation to use before assigning the value. Default is
TransformType.NONE
- Returns:
- Type of transformation.
- Default:
- com.planetalia.dynject.preprocess.TransformType.NONE
trim
public abstract TrimType trim
- Specifies how to process leading and trailing spaces of the value. Default is no processing (
TrimType.NONE)
- Returns:
- Trim operation
- Default:
- com.planetalia.dynject.preprocess.TrimType.NONE
whitespace
public abstract WhitespaceProcessing whitespace
- Specifies how to process whitespaces present in the value. Default is no processing (
WhitespaceProcessing.PRESERVE)
- Returns:
- Whitespace processing
- Default:
- com.planetalia.dynject.preprocess.WhitespaceProcessing.PRESERVE
pad
public abstract PadType pad
- Specifies how to pad the value. Default is no padding (
PadType.NONE)
- Returns:
- Padding type
- Default:
- com.planetalia.dynject.preprocess.PadType.NONE
padChar
public abstract char padChar
- Specifies which character to use when padding the value. Default is '0'
- Returns:
- Padding character
- Default:
- 48
padLength
public abstract int padLength
- Specifies the length of the field into which to apply the padding. Default is 0
- Returns:
- Padding length
- Default:
- 0
convertNull
public abstract boolean convertNull
- If set to true, allows nulls to be converted into a base value before assignment or before
feeding the result to the next step. The resulting value depends on what type expects the
next step:
- If the next step requires a
CharSequence (i.e. Strings, StringBuffers, StringBuilders,etc) nulls are converted to ""
- IF the next step requires a numeric data type (either primitive or not), nulls are converted to 0
- If the next step requires a boolean data type, nulls are converted to false
- If the next step requires a character data type, nulls are converted to ' '
-
- Otherwise, the null value is left untransformed
- Returns:
- true if null conversion is allowed
- Default:
- false
defaultValue
public abstract java.lang.String defaultValue
- If set to something different than the default (the empty string), specifies a default value that
is used whenever a null value is received. The resulting value depends on what type expects
the next step:
- If the next step requires a
CharSequence (i.e. Strings, StringBuffers, StringBuilders,etc) the default value is returned as a String
- IF the next step requires an numeric data type (either primitive or not), the default value is returned as a primitive value
of that type (i.e. - if the next step requires an Integer, an int is returned).
- If the next step requires a boolean data type, the default value is returned as a boolean
- If the next step requires a character data type, the first character of the default value is returned
-
- Otherwise, the default value is returned as a string
In all of the above cases, if a parsing error occurs, an exception is raised (since this situation is a programming error)
- Returns:
- Default value
- Default:
- ""