Package org.joda.beans.impl.direct
Class DirectMetaBean
- java.lang.Object
-
- org.joda.beans.impl.direct.DirectMetaBean
-
-
Field Summary
Fields Modifier and Type Field Description static String
TEST_COVERAGE_STRING
This constant can be used to pass intosetString()
to increase test coverage.
-
Constructor Summary
Constructors Constructor Description DirectMetaBean()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isBuildable()
Checks whether this bean is buildable or not.<R> MetaProperty<R>
metaProperty(String propertyName)
Gets a meta-property by name.protected MetaProperty<?>
metaPropertyGet(String propertyName)
Gets the meta-property by name.protected Object
propertyGet(Bean bean, String propertyName, boolean quiet)
Gets the value of the property.protected void
propertySet(Bean bean, String propertyName, Object value, boolean quiet)
Sets the value of the property.String
toString()
Returns a string that summarises the meta-bean.protected void
validate(Bean bean)
Validates the values of the properties.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.joda.beans.MetaBean
annotation, annotationOpt, annotations, beanName, beanType, builder, metaPropertyCount, metaPropertyExists, metaPropertyIterable, metaPropertyMap
-
-
-
-
Field Detail
-
TEST_COVERAGE_STRING
public static final String TEST_COVERAGE_STRING
This constant can be used to pass intosetString()
to increase test coverage.- See Also:
- Constant Field Values
-
-
Method Detail
-
isBuildable
public boolean isBuildable()
Description copied from interface:MetaBean
Checks whether this bean is buildable or not.A buildable bean can be constructed using
MetaBean.builder()
. If this method returns true thenbuilder()
must return a valid builder. If this method returns false thenbuilder()
must throwUnsupportedOperationException
.- Specified by:
isBuildable
in interfaceMetaBean
- Returns:
- true if this bean is buildable
-
metaProperty
public <R> MetaProperty<R> metaProperty(String propertyName)
Description copied from interface:MetaBean
Gets a meta-property by name.Each meta-bean manages a single bean with a known set of properties. This method returns the property with the specified name.
The base interface throws an exception if the name is not recognised. By contrast, the
DynamicMetaBean
subinterface creates the property on demand.- Specified by:
metaProperty
in interfaceMetaBean
- Type Parameters:
R
- the property type, optional, enabling auto-casting- Parameters:
propertyName
- the property name to retrieve, not null- Returns:
- the meta property, not null
-
metaPropertyGet
protected MetaProperty<?> metaPropertyGet(String propertyName)
Gets the meta-property by name.This implementation returns null, and must be overridden in subclasses.
- Parameters:
propertyName
- the property name, not null- Returns:
- the meta-property, null if not found
-
propertyGet
protected Object propertyGet(Bean bean, String propertyName, boolean quiet)
Gets the value of the property.- Parameters:
bean
- the bean to query, not nullpropertyName
- the property name, not nullquiet
- true to return null if unable to read- Returns:
- the value of the property, may be null
- Throws:
NoSuchElementException
- if the property name is invalid
-
propertySet
protected void propertySet(Bean bean, String propertyName, Object value, boolean quiet)
Sets the value of the property.- Parameters:
bean
- the bean to update, not nullpropertyName
- the property name, not nullvalue
- the value of the property, may be nullquiet
- true to take no action if unable to write- Throws:
NoSuchElementException
- if the property name is invalid
-
validate
protected void validate(Bean bean)
Validates the values of the properties.- Parameters:
bean
- the bean to validate, not null- Throws:
RuntimeException
- if a property is invalid
-
-