public abstract class DirectBean extends Object implements Bean
This implementation uses direct access via propertyGet(String, boolean)
and
propertySet(String, Object, boolean)
to avoid reflection.
For code generation, the bean must directly extend this class and have a no-arguments constructor.
Constructor and Description |
---|
DirectBean() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
int |
hashCode() |
<R> Property<R> |
property(String propertyName)
Gets a property by name.
|
protected Object |
propertyGet(String propertyName,
boolean quiet)
Gets the value of the property.
|
Set<String> |
propertyNames()
Gets the set of property names.
|
protected void |
propertySet(String propertyName,
Object value,
boolean quiet)
Sets the value of the property.
|
String |
toString() |
protected void |
validate()
Validates the values of the properties.
|
public DirectBean()
public <R> Property<R> property(String propertyName)
Bean
public Set<String> propertyNames()
Bean
propertyNames
in interface Bean
protected Object propertyGet(String propertyName, boolean quiet)
propertyName
- the property name, not nullquiet
- true to return null if unable to readNoSuchElementException
- if the property name is invalidprotected void propertySet(String propertyName, Object value, boolean quiet)
propertyName
- the property name, not nullvalue
- the value of the property, may be nullquiet
- true to take no action if unable to writeNoSuchElementException
- if the property name is invalidprotected void validate()
RuntimeException
- if a property is invalidCopyright © 2007–2013 Joda.org. All rights reserved.