Package org.beanio.internal.parser
Interface Property
-
- All Known Implementing Classes:
Aggregation
,ArrayParser
,Bean
,CollectionBean
,CollectionParser
,Constant
,Field
,MapParser
,PropertyComponent
,RecordAggregation
,RecordArray
,RecordCollection
,RecordMap
public interface Property
TheProperty
interface is implemented by parser components capable of storing a property value.- Since:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description static int
AGGREGATION_ARRAY
The array property typestatic int
AGGREGATION_COLLECTION
The collection property type used to aggregate multiple occurrences of a single propertystatic int
AGGREGATION_MAP
The map property type used to aggregate multiple occurrences of key/value pairsstatic int
COLLECTION
The collection property type used to create a collection of other propertiesstatic int
COMPLEX
The bean object property type with simple properties and other bean objects for attributesstatic int
MAP
The map property typestatic int
SIMPLE
The simple property type that cannot hold other properties
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clearValue(ParsingContext context)
Clears the property value.java.lang.Object
createValue(ParsingContext context)
Creates the property value and returns it.boolean
defines(java.lang.Object value)
PropertyAccessor
getAccessor()
java.lang.String
getName()
Returns the property name as configured in the mapping file.java.lang.Class<?>
getType()
java.lang.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(java.lang.Class<?> type)
void
setValue(ParsingContext context, java.lang.Object value)
Sets the property value (before marshalling).int
type()
Returns the property type.
-
-
-
Field Detail
-
SIMPLE
static final int SIMPLE
The simple property type that cannot hold other properties- See Also:
- Constant Field Values
-
COMPLEX
static final int COMPLEX
The bean object property type with simple properties and other bean objects for attributes- See Also:
- Constant Field Values
-
COLLECTION
static final int COLLECTION
The collection property type used to create a collection of other properties- See Also:
- Constant Field Values
-
MAP
static final int MAP
The map property type- See Also:
- Constant Field Values
-
AGGREGATION_ARRAY
static final int AGGREGATION_ARRAY
The array property type- See Also:
- Constant Field Values
-
AGGREGATION_COLLECTION
static final int AGGREGATION_COLLECTION
The collection property type used to aggregate multiple occurrences of a single property- See Also:
- Constant Field Values
-
AGGREGATION_MAP
static final int AGGREGATION_MAP
The map property type used to aggregate multiple occurrences of key/value pairs- See Also:
- Constant Field Values
-
-
Method Detail
-
type
int type()
Returns the property type.- Returns:
SIMPLE
,COMPLEX
,AGGREGATION_ARRAY
,COLLECTION
,AGGREGATION_COLLECTION
, orMAP
-
getName
java.lang.String getName()
Returns the property name as configured in the mapping file. The returned property name is used only for error messages and does not necessarily match the attribute name of a parent bean.- Returns:
- the property name
-
clearValue
void clearValue(ParsingContext context)
Clears the property value. A subsequent call togetValue(ParsingContext)
should return null, orValue.MISSING
for lazy property values.- Parameters:
context
- theParsingContext
-
createValue
java.lang.Object createValue(ParsingContext context)
Creates the property value and returns it.- Parameters:
context
- theParsingContext
- Returns:
- the property value
-
getValue
java.lang.Object getValue(ParsingContext context)
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 returnValue.MISSING
.- Parameters:
context
- theParsingContext
- Returns:
- the property value,
or
Value.MISSING
if not present in the stream, orValue.INVALID
if the field was invalid
-
setValue
void setValue(ParsingContext context, java.lang.Object value)
Sets the property value (before marshalling).- Parameters:
context
- theParsingContext
value
- the property value
-
defines
boolean defines(java.lang.Object value)
-
isIdentifier
boolean isIdentifier()
Returns whether this property or any of its descendants are used to identify a bean object.- Returns:
true
if this property identifies a bean
-
setIdentifier
void setIdentifier(boolean identifier)
-
getAccessor
PropertyAccessor getAccessor()
-
setAccessor
void setAccessor(PropertyAccessor accessor)
-
getType
java.lang.Class<?> getType()
-
setType
void setType(java.lang.Class<?> type)
-
-