Package jodd.bean
Class BeanUtilUtil
- java.lang.Object
-
- jodd.bean.BeanUtilUtil
-
- All Implemented Interfaces:
BeanUtil
- Direct Known Subclasses:
BeanUtilBean
abstract class BeanUtilUtil extends java.lang.Object implements BeanUtil
Various bean property utilities that makes writings ofBeanUtilclasses easy.
-
-
Field Summary
Fields Modifier and Type Field Description protected ClassIntrospectorintrospectorprotected booleanisDeclaredprotected booleanisForcedprotected booleanisSilentprotected TypeConverterManagertypeConverterManager-
Fields inherited from interface jodd.bean.BeanUtil
declared, declaredForced, declaredForcedSilent, declaredSilent, forced, forcedSilent, pojo, silent
-
-
Constructor Summary
Constructors Constructor Description BeanUtilUtil()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.ObjectarrayForcedGet(BeanProperty bp, java.lang.Object array, int index)Returns the element of an array forced.protected voidarrayForcedSet(BeanProperty bp, java.lang.Object array, int index, java.lang.Object value)Sets the array element forced.protected java.lang.ObjectconvertIndexToMapKey(Getter getter, java.lang.Object index)Converts Map index to key type.protected java.lang.ObjectconvertToCollection(java.lang.Object value, java.lang.Class destinationType, java.lang.Class componentType)Converter to collection.protected java.lang.ObjectconvertType(java.lang.Object value, java.lang.Class type)Converts object to destination type.protected java.lang.ObjectcreateBeanProperty(BeanProperty bp)Creates new instance for current property name through its setter.protected java.lang.ObjectensureArraySize(BeanProperty bp, java.lang.Object array, java.lang.Class componentType, int index)protected voidensureListSize(java.util.List list, int size)protected java.lang.ClassextractGenericComponentType(Getter getter)Extracts generic component type of a property.protected java.lang.StringextractIndex(BeanProperty bp)Extract index string from non-nested property name.protected java.lang.ClassextractType(BeanProperty bp)Extracts type of current property.protected intindexOfDot(java.lang.String name)Finds the very first next dot.protected java.lang.ObjectinvokeSetter(Setter setter, BeanProperty bp, java.lang.Object value)Invokes setter, but first converts type to match the setter type.protected intparseInt(java.lang.String indexString, BeanProperty bp)voidsetIntrospector(ClassIntrospector introspector)Setsintrospectorimplementation.voidsetTypeConverterManager(TypeConverterManager typeConverterManager)Setstype converter managerimplementation.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jodd.bean.BeanUtil
extractThisReference, getIndexProperty, getProperty, getPropertyType, getSimpleProperty, hasProperty, hasRootProperty, hasSimpleProperty, setIndexProperty, setProperty, setSimpleProperty
-
-
-
-
Field Detail
-
isDeclared
protected boolean isDeclared
-
isForced
protected boolean isForced
-
isSilent
protected boolean isSilent
-
introspector
protected ClassIntrospector introspector
-
typeConverterManager
protected TypeConverterManager typeConverterManager
-
-
Method Detail
-
setIntrospector
public void setIntrospector(ClassIntrospector introspector)
Setsintrospectorimplementation.
-
setTypeConverterManager
public void setTypeConverterManager(TypeConverterManager typeConverterManager)
Setstype converter managerimplementation.
-
convertType
protected java.lang.Object convertType(java.lang.Object value, java.lang.Class type)Converts object to destination type. Invoked before the value is set into destination. ThrowsTypeConversionExceptionif conversion fails.
-
convertToCollection
protected java.lang.Object convertToCollection(java.lang.Object value, java.lang.Class destinationType, java.lang.Class componentType)Converter to collection.
-
invokeSetter
protected java.lang.Object invokeSetter(Setter setter, BeanProperty bp, java.lang.Object value)
Invokes setter, but first converts type to match the setter type.
-
arrayForcedGet
protected java.lang.Object arrayForcedGet(BeanProperty bp, java.lang.Object array, int index)
Returns the element of an array forced. If value isnull, it will be instantiated. If not the last part of indexed bean property, array will be expanded to the index if necessary.
-
arrayForcedSet
protected void arrayForcedSet(BeanProperty bp, java.lang.Object array, int index, java.lang.Object value)
Sets the array element forced. If index is greater then arrays length, array will be expanded to the index. If speed is critical, it is better to allocate an array with proper size before using this method.
-
ensureArraySize
protected java.lang.Object ensureArraySize(BeanProperty bp, java.lang.Object array, java.lang.Class componentType, int index)
-
ensureListSize
protected void ensureListSize(java.util.List list, int size)
-
indexOfDot
protected int indexOfDot(java.lang.String name)
Finds the very first next dot. Ignores dots between index brackets. Returns-1when dot is not found.
-
extractIndex
protected java.lang.String extractIndex(BeanProperty bp)
Extract index string from non-nested property name. If index is found, it is stripped from bean property name. If no index is found, it returnsnull.
-
parseInt
protected int parseInt(java.lang.String indexString, BeanProperty bp)
-
createBeanProperty
protected java.lang.Object createBeanProperty(BeanProperty bp)
Creates new instance for current property name through its setter. It uses default constructor!
-
extractGenericComponentType
protected java.lang.Class extractGenericComponentType(Getter getter)
Extracts generic component type of a property. ReturnsObject.classwhen property does not have component.
-
convertIndexToMapKey
protected java.lang.Object convertIndexToMapKey(Getter getter, java.lang.Object index)
Converts Map index to key type. If conversion fails, original value will be returned.
-
extractType
protected java.lang.Class extractType(BeanProperty bp)
Extracts type of current property.
-
-