Package org.beanio.internal.parser
Class Constant
- java.lang.Object
-
- org.beanio.internal.util.TreeNode<Component>
-
- org.beanio.internal.parser.Component
-
- org.beanio.internal.parser.Constant
-
- All Implemented Interfaces:
java.lang.Cloneable,java.lang.Iterable<Component>,Property,Replicateable
public class Constant extends Component implements Property
A simple property implementation that stores a constant value.- Since:
- 2.0
-
-
Field Summary
-
Fields inherited from interface org.beanio.internal.parser.Property
AGGREGATION_ARRAY, AGGREGATION_COLLECTION, AGGREGATION_MAP, COLLECTION, COMPLEX, MAP, SIMPLE
-
-
Constructor Summary
Constructors Constructor Description Constant()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearValue(ParsingContext context)Clears the property value.java.lang.ObjectcreateValue(ParsingContext context)Creates the property value and returns it.booleandefines(java.lang.Object value)PropertyAccessorgetAccessor()java.lang.Class<?>getType()java.lang.ObjectgetValue(ParsingContext context)Returns the value of this property.booleanisIdentifier()Returns whether this property or any of its descendants are used to identify a bean object.voidsetAccessor(PropertyAccessor accessor)voidsetIdentifier(boolean identifier)voidsetType(java.lang.Class<?> type)voidsetValue(java.lang.Object value)Sets the constant value.voidsetValue(ParsingContext context, java.lang.Object value)Sets the property value (before marshalling).inttype()Returns the property type.-
Methods inherited from class org.beanio.internal.parser.Component
registerLocals
-
Methods inherited from class org.beanio.internal.util.TreeNode
add, clone, find, getChildren, getFirst, getName, isDescendant, isSupportedChild, iterator, print, print, setName, size, sort, toParamString, toString, updateReferences
-
-
-
-
Method Detail
-
type
public int type()
Description copied from interface:PropertyReturns the property type.- Specified by:
typein interfaceProperty- Returns:
Property.SIMPLE,Property.COMPLEX,Property.AGGREGATION_ARRAY,Property.COLLECTION,Property.AGGREGATION_COLLECTION, orProperty.MAP
-
clearValue
public void clearValue(ParsingContext context)
Description copied from interface:PropertyClears the property value. A subsequent call toProperty.getValue(ParsingContext)should return null, orValue.MISSINGfor lazy property values.- Specified by:
clearValuein interfaceProperty- Parameters:
context- theParsingContext
-
createValue
public java.lang.Object createValue(ParsingContext context)
Description copied from interface:PropertyCreates the property value and returns it.- Specified by:
createValuein interfaceProperty- Parameters:
context- theParsingContext- Returns:
- the property value
-
getValue
public java.lang.Object getValue(ParsingContext context)
Description copied from interface:PropertyReturns the value of this property.When unmarshalling, this method should return
Value.MISSINGif the field was not present in the stream. Or if present, but has no value, null should be returned.When marshalling, this method should return
Value.MISSINGfor any optional segment bound to a bean object, or null if required. Null field properties should always returnValue.MISSING.- Specified by:
getValuein interfaceProperty- Parameters:
context- theParsingContext- Returns:
- the property value,
or
Value.MISSINGif not present in the stream, orValue.INVALIDif the field was invalid
-
setValue
public void setValue(java.lang.Object value)
Sets the constant value.- Parameters:
value- the value
-
setValue
public void setValue(ParsingContext context, java.lang.Object value)
Description copied from interface:PropertySets the property value (before marshalling).- Specified by:
setValuein interfaceProperty- Parameters:
context- theParsingContextvalue- the property value
-
isIdentifier
public boolean isIdentifier()
Description copied from interface:PropertyReturns whether this property or any of its descendants are used to identify a bean object.- Specified by:
isIdentifierin interfaceProperty- Returns:
trueif this property identifies a bean
-
setIdentifier
public void setIdentifier(boolean identifier)
- Specified by:
setIdentifierin interfaceProperty
-
getAccessor
public PropertyAccessor getAccessor()
- Specified by:
getAccessorin interfaceProperty
-
setAccessor
public void setAccessor(PropertyAccessor accessor)
- Specified by:
setAccessorin interfaceProperty
-
-