V
- The type of propertyprotected static class BeanMetaData.Property<T,V> extends AbstractPropertyMetaData<T,V>
PropertyMetaData
implementation for
java beans.Modifier and Type | Field and Description |
---|---|
protected org.foxlabs.util.reflect.PropertyGetter |
getter
Property value getter.
|
protected org.foxlabs.util.reflect.PropertySetter |
setter
Property value setter.
|
protected Class<V> |
wtype
Property wrapped type.
|
constraint, converter, defaultValue, name
Modifier | Constructor and Description |
---|---|
protected |
Property(String name,
Converter<V> converter,
Constraint<? super V> constraint,
org.foxlabs.util.reflect.PropertyGetter getter,
org.foxlabs.util.reflect.PropertySetter setter,
V defaultValue)
Constructs a new
BeanPropertyMetaData with the specified
name, converter, constraint, property getter and setter. |
Modifier and Type | Method and Description |
---|---|
V |
cast(Object value)
Casts the specified value to this property type.
|
V |
getValue(T bean)
Returns value of this property for the specified bean.
|
boolean |
isReadable()
Determines if this property has getter.
|
boolean |
isWriteable()
Determines if this property has setter.
|
void |
setValue(T bean,
Object value)
Assigns value of this property for the specified bean.
|
equals, getConstraint, getConverter, getDefaultValue, getName, getType, hashCode, isRequired, toString
protected final org.foxlabs.util.reflect.PropertyGetter getter
protected final org.foxlabs.util.reflect.PropertySetter setter
protected Property(String name, Converter<V> converter, Constraint<? super V> constraint, org.foxlabs.util.reflect.PropertyGetter getter, org.foxlabs.util.reflect.PropertySetter setter, V defaultValue)
BeanPropertyMetaData
with the specified
name, converter, constraint, property getter and setter.name
- Property name.converter
- Converter to be used for property value conversion
into and from string representation.constraint
- Constraint to be used for property value validation.getter
- Property value getter.setter
- Property value setter.defaultValue
- Property default value.IllegalArgumentException
- if the specified name or converter
is null
or name is empty.public final boolean isReadable()
isReadable
in interface PropertyMetaData<T,V>
isReadable
in class AbstractPropertyMetaData<T,V>
true
if this property has getter;
false
otherwise.public final boolean isWriteable()
isWriteable
in interface PropertyMetaData<T,V>
isWriteable
in class AbstractPropertyMetaData<T,V>
true
if this property has setter;
false
otherwise.public V cast(Object value)
cast
in interface MetaData<V>
cast
in class AbstractPropertyMetaData<T,V>
value
- Value to be cast.ClassCastException
- if the specified value is not assignable
to this property type.public final V getValue(T bean)
getValue
in interface PropertyMetaData<T,V>
getValue
in class AbstractPropertyMetaData<T,V>
bean
- Bean whose property value should be returned.IllegalArgumentException
- if this specified bean is
null
.UnsupportedOperationException
- if this property is not
readable.public final void setValue(T bean, Object value)
setValue
in interface PropertyMetaData<T,V>
setValue
in class AbstractPropertyMetaData<T,V>
bean
- Bean whose property value should be assigned.value
- New property value.IllegalArgumentException
- if this specified bean is
null
.UnsupportedOperationException
- if this property is not
writeable.Copyright © 2011–2020 FoxLabs. All rights reserved.