Modifier and Type | Field and Description |
---|---|
protected ClassIntrospector |
introspector |
protected boolean |
isDeclared |
protected boolean |
isForced |
protected boolean |
isSilent |
protected TypeConverterManager |
typeConverterManager |
declared, declaredForced, declaredForcedSilent, declaredSilent, forced, forcedSilent, pojo, silent
Constructor and Description |
---|
BeanUtilBean() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.Object |
arrayForcedGet(jodd.bean.BeanProperty bp,
java.lang.Object array,
int index)
Returns the element of an array forced.
|
protected void |
arrayForcedSet(jodd.bean.BeanProperty bp,
java.lang.Object array,
int index,
java.lang.Object value)
Sets the array element forced.
|
protected java.lang.Object |
convertIndexToMapKey(Getter getter,
java.lang.Object index)
Converts Map index to key type.
|
protected java.lang.Object |
convertToCollection(java.lang.Object value,
java.lang.Class destinationType,
java.lang.Class componentType)
Converter to collection.
|
protected java.lang.Object |
convertType(java.lang.Object value,
java.lang.Class type)
Converts object to destination type.
|
protected java.lang.Object |
createBeanProperty(jodd.bean.BeanProperty bp)
Creates new instance for current property name through its setter.
|
BeanUtilBean |
declared(boolean declared)
Sets the declared flag.
|
protected java.lang.Object |
ensureArraySize(jodd.bean.BeanProperty bp,
java.lang.Object array,
java.lang.Class componentType,
int index) |
protected void |
ensureListSize(java.util.List list,
int size) |
protected java.lang.Class |
extractGenericComponentType(Getter getter)
Extracts generic component type of a property.
|
protected java.lang.String |
extractIndex(jodd.bean.BeanProperty bp)
Extract index string from non-nested property name.
|
java.lang.String |
extractThisReference(java.lang.String propertyName)
Extract the first name of this reference.
|
protected java.lang.Class |
extractType(jodd.bean.BeanProperty bp)
Extracts type of current property.
|
BeanUtilBean |
forced(boolean forced)
Sets the forced flag.
|
protected java.lang.Object |
getIndexProperty(jodd.bean.BeanProperty bp)
Get non-nested property value: either simple or indexed property.
|
<T> T |
getIndexProperty(java.lang.Object bean,
java.lang.String property,
int index)
Returns value of indexed property.
|
<T> T |
getProperty(java.lang.Object bean,
java.lang.String name)
Returns value of bean's property.
|
java.lang.Class<?> |
getPropertyType(java.lang.Object bean,
java.lang.String name)
Returns property type.
|
protected java.lang.Object |
getSimpleProperty(jodd.bean.BeanProperty bp) |
<T> T |
getSimpleProperty(java.lang.Object bean,
java.lang.String property)
Reads simple property.
|
protected boolean |
hasIndexProperty(jodd.bean.BeanProperty bp) |
boolean |
hasProperty(java.lang.Object bean,
java.lang.String name)
Returns
true if bean has a property. |
boolean |
hasRootProperty(java.lang.Object bean,
java.lang.String name)
Returns
true if bean has only a root property. |
protected boolean |
hasSimpleProperty(jodd.bean.BeanProperty bp) |
boolean |
hasSimpleProperty(java.lang.Object bean,
java.lang.String property)
Returns
true if simple property exist. |
protected int |
indexOfDot(java.lang.String name)
Finds the very first next dot.
|
protected java.lang.Object |
invokeSetter(Setter setter,
jodd.bean.BeanProperty bp,
java.lang.Object value)
Invokes setter, but first converts type to match the setter type.
|
protected int |
parseInt(java.lang.String indexString,
jodd.bean.BeanProperty bp) |
protected boolean |
resolveExistingNestedProperties(jodd.bean.BeanProperty bp) |
protected void |
resolveNestedProperties(jodd.bean.BeanProperty bp)
Resolves nested property name to the very last indexed property.
|
protected void |
setIndexProperty(jodd.bean.BeanProperty bp,
java.lang.Object value)
Sets indexed or regular properties (no nested!).
|
void |
setIndexProperty(java.lang.Object bean,
java.lang.String property,
int index,
java.lang.Object value)
Sets indexed property.
|
void |
setIntrospector(ClassIntrospector introspector)
Sets
introspector implementation. |
void |
setProperty(java.lang.Object bean,
java.lang.String name,
java.lang.Object value)
Sets Java Bean property.
|
protected void |
setSimpleProperty(jodd.bean.BeanProperty bp,
java.lang.Object value)
Sets a value of simple property.
|
void |
setSimpleProperty(java.lang.Object bean,
java.lang.String property,
java.lang.Object value)
Sets simple property.
|
void |
setTypeConverterManager(TypeConverterManager typeConverterManager)
Sets
type converter manager implementation. |
BeanUtilBean |
silent(boolean silent)
Sets the silent flag.
|
protected boolean isDeclared
protected boolean isForced
protected boolean isSilent
protected ClassIntrospector introspector
protected TypeConverterManager typeConverterManager
public BeanUtilBean declared(boolean declared)
public BeanUtilBean forced(boolean forced)
public BeanUtilBean silent(boolean silent)
protected void resolveNestedProperties(jodd.bean.BeanProperty bp)
null
or non-existing properties will be created.protected boolean resolveExistingNestedProperties(jodd.bean.BeanProperty bp)
public boolean hasSimpleProperty(java.lang.Object bean, java.lang.String property)
BeanUtil
true
if simple property exist.hasSimpleProperty
in interface BeanUtil
protected boolean hasSimpleProperty(jodd.bean.BeanProperty bp)
public <T> T getSimpleProperty(java.lang.Object bean, java.lang.String property)
BeanUtil
getSimpleProperty
in interface BeanUtil
protected java.lang.Object getSimpleProperty(jodd.bean.BeanProperty bp)
public void setSimpleProperty(java.lang.Object bean, java.lang.String property, java.lang.Object value)
BeanUtil
setSimpleProperty
in interface BeanUtil
protected void setSimpleProperty(jodd.bean.BeanProperty bp, java.lang.Object value)
protected boolean hasIndexProperty(jodd.bean.BeanProperty bp)
public <T> T getIndexProperty(java.lang.Object bean, java.lang.String property, int index)
BeanUtil
getIndexProperty
in interface BeanUtil
protected java.lang.Object getIndexProperty(jodd.bean.BeanProperty bp)
public void setIndexProperty(java.lang.Object bean, java.lang.String property, int index, java.lang.Object value)
BeanUtil
setIndexProperty
in interface BeanUtil
protected void setIndexProperty(jodd.bean.BeanProperty bp, java.lang.Object value)
public void setProperty(java.lang.Object bean, java.lang.String name, java.lang.Object value)
BeanUtil
setProperty
in interface BeanUtil
bean
- Java POJO bean or a Mapname
- property namevalue
- property valuepublic <T> T getProperty(java.lang.Object bean, java.lang.String name)
getProperty
in interface BeanUtil
public boolean hasProperty(java.lang.Object bean, java.lang.String name)
BeanUtil
true
if bean has a property.hasProperty
in interface BeanUtil
public boolean hasRootProperty(java.lang.Object bean, java.lang.String name)
BeanUtil
true
if bean has only a root property.
If yes, this means that property may be injected into the bean.
If not, bean does not contain the property.hasRootProperty
in interface BeanUtil
public java.lang.Class<?> getPropertyType(java.lang.Object bean, java.lang.String name)
BeanUtil
getPropertyType
in interface BeanUtil
public java.lang.String extractThisReference(java.lang.String propertyName)
extractThisReference
in interface BeanUtil
public void setIntrospector(ClassIntrospector introspector)
introspector
implementation.public void setTypeConverterManager(TypeConverterManager typeConverterManager)
type converter manager
implementation.protected java.lang.Object convertType(java.lang.Object value, java.lang.Class type)
TypeConversionException
if conversion fails.protected java.lang.Object convertToCollection(java.lang.Object value, java.lang.Class destinationType, java.lang.Class componentType)
protected java.lang.Object invokeSetter(Setter setter, jodd.bean.BeanProperty bp, java.lang.Object value)
protected java.lang.Object arrayForcedGet(jodd.bean.BeanProperty bp, java.lang.Object array, int index)
null
, it will be instantiated.
If not the last part of indexed bean property, array will be expanded to the index if necessary.protected void arrayForcedSet(jodd.bean.BeanProperty bp, java.lang.Object array, int index, java.lang.Object value)
protected java.lang.Object ensureArraySize(jodd.bean.BeanProperty bp, java.lang.Object array, java.lang.Class componentType, int index)
protected void ensureListSize(java.util.List list, int size)
protected int indexOfDot(java.lang.String name)
-1
when dot is not found.protected java.lang.String extractIndex(jodd.bean.BeanProperty bp)
null
.protected int parseInt(java.lang.String indexString, jodd.bean.BeanProperty bp)
protected java.lang.Object createBeanProperty(jodd.bean.BeanProperty bp)
protected java.lang.Class extractGenericComponentType(Getter getter)
Object.class
when property does not have component.protected java.lang.Object convertIndexToMapKey(Getter getter, java.lang.Object index)
protected java.lang.Class extractType(jodd.bean.BeanProperty bp)
Copyright © 2003-present Jodd Team