T
- the type of property valuepublic abstract class PropertySetter<T> extends Object
A property setter is an object which is able to set to a particular NutDao
builder a property.
This property is associated to a key specifically supported by the type of setter.
The property setter is generic to allow subclasses to define the real type of value associated to its supported property key.
Fields can be initialized with init(ObjectBuilder, String, Object)
.
Modifier and Type | Class and Description |
---|---|
static class |
PropertySetter.PropertySetterOfBoolean
Abstract builder for
Boolean values. |
static class |
PropertySetter.PropertySetterOfInteger
Abstract builder for
Integer values. |
static class |
PropertySetter.PropertySetterOfObject
Abstract builder for
Object values instantiated with the default constructor of a class loaded with its
name. |
static class |
PropertySetter.PropertySetterOfString
Abstract builder for
String values. |
Constructor and Description |
---|
PropertySetter() |
Modifier and Type | Method and Description |
---|---|
T |
get()
Gets the value from the builder associated to the supported key.
|
String |
getPropertyKey()
Gets the property key supported by this setter.
|
void |
init(ObjectBuilder<?> b,
String propertyKey,
Object defaultValue)
Initializes this instance.
|
protected void |
put(String key,
Object value)
Puts internally the given value into the builder's properties.
|
protected abstract void |
set(Object value)
Sets the given value by associating it to the supported key and by trying to convert it into the 'T' type.
|
Boolean |
setProperty(String key,
Object value)
Sets the given property value only if its key is supported by this setter.
|
public void init(ObjectBuilder<?> b, String propertyKey, Object defaultValue)
Initializes this instance.
b
- the AbstractObjectBuilder
which needs to be configureddefaultValue
- the default valueprotected final void put(String key, Object value)
Puts internally the given value into the builder's properties.
key
- the property keyvalue
- the property valuepublic Boolean setProperty(String key, Object value)
Sets the given property value only if its key is supported by this setter.
key
- the keyvalue
- the property valuetrue
if the setter supports the key and has put the value, false
otherwisepublic T get()
Gets the value from the builder associated to the supported key.
null
if the property value has not been set to the builderprotected abstract void set(Object value)
Sets the given value by associating it to the supported key and by trying to convert it into the 'T' type.
value
- the valuepublic String getPropertyKey()
Gets the property key supported by this setter.
Copyright © 2012-2015. All Rights Reserved.