BeanIO 1.2.3

org.beanio.parser
Class BeanPropertyDefinition

java.lang.Object
  extended by org.beanio.parser.PropertyDefinition
      extended by org.beanio.parser.BeanPropertyDefinition

public class BeanPropertyDefinition
extends PropertyDefinition

This property definition is used to define a constant bean property value that does not directly map to any field in an input or output stream. This allows a bean property to be populated based on record identification during unmarshalling. Or likewise during marshalling, for a bean property value that is not mapped to a stream field to identify the mapping definition.

Since:
1.2
Author:
Kevin Seim

Field Summary
 
Fields inherited from class org.beanio.parser.PropertyDefinition
INVALID, MISSING
 
Constructor Summary
BeanPropertyDefinition()
          Constructs a new BeanPropertyDefinition.
 
Method Summary
 boolean defines(Object propertyValue)
          Tests whether this definition is used to map the given bean or property value.
 Object getValue()
          Returns the property value.
 boolean isConstant()
          Returns whether this property describes a constant value and does not map to field found in the stream.
 boolean matches(Record record)
          Tests if the field text in the record matches this field definition.
protected  Object parsePropertyValue(Record record)
          Parses and validates a field property value from the record.
 void setValue(Object value)
          Sets the property value.
 
Methods inherited from class org.beanio.parser.PropertyDefinition
getCollectionType, getLength, getMaxOccurs, getMinOccurs, getName, getParent, getPropertyDescriptor, getPropertyType, isArray, isBean, isCollection, isField, isLazy, isProperty, isRecordIdentifier, parseValue, setCollectionType, setLazy, setLength, setMaxOccurs, setMinOccurs, setName, setParent, setProperty, setPropertyDescriptor, setPropertyType, setRecordIdentifier
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanPropertyDefinition

public BeanPropertyDefinition()
Constructs a new BeanPropertyDefinition.

Method Detail

isConstant

public boolean isConstant()
Description copied from class: PropertyDefinition
Returns whether this property describes a constant value and does not map to field found in the stream.

Overrides:
isConstant in class PropertyDefinition
Returns:
true if this property describes a constant value

matches

public boolean matches(Record record)
Description copied from class: PropertyDefinition
Tests if the field text in the record matches this field definition.

Specified by:
matches in class PropertyDefinition
Parameters:
record - the record containing the field to test
Returns:
true if the text is a match

defines

public boolean defines(Object propertyValue)
Description copied from class: PropertyDefinition
Tests whether this definition is used to map the given bean or property value. If this property is not used to identify records, the return value of this method is undefined.

Specified by:
defines in class PropertyDefinition
Parameters:
propertyValue - the bean or property value to test
Returns:
true if this definition is used to map the given value

parsePropertyValue

protected Object parsePropertyValue(Record record)
Description copied from class: PropertyDefinition
Parses and validates a field property value from the record.

Specified by:
parsePropertyValue in class PropertyDefinition
Parameters:
record - the record to parse
Returns:
the parsed field value, or PropertyDefinition.INVALID if the field was invalid, or PropertyDefinition.MISSING if the field was not present in the record

getValue

public Object getValue()
Returns the property value.

Returns:
the property value

setValue

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

Parameters:
value - the property value

BeanIO 1.2.3

Copyright © 2010-2012 Kevin Seim