BeanIO 2.0.4

org.beanio.internal.parser
Class Constant

java.lang.Object
  extended by org.beanio.internal.util.TreeNode<Component>
      extended by org.beanio.internal.parser.Component
          extended by org.beanio.internal.parser.Constant
All Implemented Interfaces:
Cloneable, Iterable<Component>, Property, Replicateable

public class Constant
extends Component
implements Property

A simple property implementation that stores a constant value.

Since:
2.0
Author:
Kevin Seim

Field Summary
 
Fields inherited from interface org.beanio.internal.parser.Property
AGGREGATION_ARRAY, AGGREGATION_COLLECTION, AGGREGATION_MAP, COLLECTION, COMPLEX, MAP, SIMPLE
 
Constructor Summary
Constant()
          Constructs a new Constant.
 
Method Summary
 void clearValue(ParsingContext context)
          Clears the property value.
 Object createValue(ParsingContext context)
          Creates the property value and returns it.
 boolean defines(Object value)
           
 PropertyAccessor getAccessor()
           
 Class<?> getType()
           
 Object getValue(ParsingContext context)
          Returns the value of this property.
 boolean isIdentifier()
          Returns whether this property or any of its descendants are used to identify a bean object.
 void setAccessor(PropertyAccessor accessor)
           
 void setIdentifier(boolean identifier)
           
 void setType(Class<?> type)
           
 void setValue(Object value)
          Sets the constant value.
 void setValue(ParsingContext context, Object value)
          Sets the property value (before marshalling).
 int type()
          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, isSupportedChild, iterator, print, setName, size, sort, toParamString, toString, updateReferences
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.beanio.internal.parser.Property
getName
 

Constructor Detail

Constant

public Constant()
Constructs a new Constant.

Method Detail

type

public int type()
Description copied from interface: Property
Returns the property type.

Specified by:
type in interface Property
Returns:
Property.SIMPLE, Property.COMPLEX, Property.AGGREGATION_ARRAY, Property.COLLECTION, Property.AGGREGATION_COLLECTION, or Property.MAP

defines

public boolean defines(Object value)
Specified by:
defines in interface Property

clearValue

public void clearValue(ParsingContext context)
Description copied from interface: Property
Clears the property value. A subsequent call to Property.getValue(ParsingContext) should return null, or Value.MISSING for lazy property values.

Specified by:
clearValue in interface Property
Parameters:
context - the ParsingContext

createValue

public Object createValue(ParsingContext context)
Description copied from interface: Property
Creates the property value and returns it.

Specified by:
createValue in interface Property
Parameters:
context - the ParsingContext
Returns:
the property value

getValue

public Object getValue(ParsingContext context)
Description copied from interface: Property
Returns the value of this property.

When unmarshalling, this method should return Value.MISSING if 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.MISSING for any optional segment bound to a bean object, or null if required. Null field properties should always return Value.MISSING.

Specified by:
getValue in interface Property
Parameters:
context - the ParsingContext
Returns:
the property value, or Value.MISSING if not present in the stream, or Value.INVALID if the field was invalid

setValue

public void setValue(Object value)
Sets the constant value.

Parameters:
value - the value

setValue

public void setValue(ParsingContext context,
                     Object value)
Description copied from interface: Property
Sets the property value (before marshalling).

Specified by:
setValue in interface Property
Parameters:
context - the ParsingContext
value - the property value

getType

public Class<?> getType()
Specified by:
getType in interface Property

setType

public void setType(Class<?> type)
Specified by:
setType in interface Property

isIdentifier

public boolean isIdentifier()
Description copied from interface: Property
Returns whether this property or any of its descendants are used to identify a bean object.

Specified by:
isIdentifier in interface Property
Returns:
true if this property identifies a bean

setIdentifier

public void setIdentifier(boolean identifier)
Specified by:
setIdentifier in interface Property

getAccessor

public PropertyAccessor getAccessor()
Specified by:
getAccessor in interface Property

setAccessor

public void setAccessor(PropertyAccessor accessor)
Specified by:
setAccessor in interface Property

BeanIO 2.0.4

Copyright © 2010-2013 Kevin Seim