Package jodd.bean
Class BeanVisitor
- java.lang.Object
-
- jodd.bean.BeanVisitor
-
public class BeanVisitor extends java.lang.ObjectVisitor for bean properties. It extracts properties names from the source bean and then visits one by one.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleandeclaredFlag for enabling declared properties, or just public ones.protected booleanignoreEmptyStringDefines if empty string should be ignored.protected booleanignoreNullValuesDefines if null values should be ignored.protected booleanincludeFieldsDefines if fields should be included.protected booleanisSourceMapIndicates the the source is a Map.protected java.lang.ObjectsourceSource bean.
-
Constructor Summary
Constructors Constructor Description BeanVisitor(java.lang.Object source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BeanVisitordeclared(boolean declared)Defines if all properties should be copied (when set totrue) or only public (when set tofalse, default).protected java.lang.String[]getAllBeanPropertyNames(java.lang.Class type, boolean declared)Returns all bean property names.BeanVisitorignoreEmptyString(boolean ignoreEmptyString)Defines ifempty stringshould be ignored.BeanVisitorignoreNulls(boolean ignoreNulls)Defines ifnullvalues should be ignored.BeanVisitorincludeFields(boolean includeFields)Defines if fields without getters should be copied too.protected java.lang.String[]resolveProperties(java.lang.Object bean, boolean declared)Returns an array of bean properties.voidvisit(java.util.function.BiConsumer<java.lang.String,java.lang.Object> propertyConsumer)Starts visiting properties.
-
-
-
Field Detail
-
source
protected final java.lang.Object source
Source bean.
-
declared
protected boolean declared
Flag for enabling declared properties, or just public ones.
-
ignoreNullValues
protected boolean ignoreNullValues
Defines if null values should be ignored.
-
ignoreEmptyString
protected boolean ignoreEmptyString
Defines if empty string should be ignored.
-
includeFields
protected boolean includeFields
Defines if fields should be included.
-
isSourceMap
protected final boolean isSourceMap
Indicates the the source is a Map.
-
-
Method Detail
-
ignoreNulls
public BeanVisitor ignoreNulls(boolean ignoreNulls)
Defines ifnullvalues should be ignored.
-
ignoreEmptyString
public BeanVisitor ignoreEmptyString(boolean ignoreEmptyString)
Defines ifempty stringshould be ignored.
-
declared
public BeanVisitor declared(boolean declared)
Defines if all properties should be copied (when set totrue) or only public (when set tofalse, default).
-
includeFields
public BeanVisitor includeFields(boolean includeFields)
Defines if fields without getters should be copied too.
-
getAllBeanPropertyNames
protected java.lang.String[] getAllBeanPropertyNames(java.lang.Class type, boolean declared)Returns all bean property names.
-
resolveProperties
protected java.lang.String[] resolveProperties(java.lang.Object bean, boolean declared)Returns an array of bean properties. If bean is aMap, all its keys will be returned.
-
visit
public void visit(java.util.function.BiConsumer<java.lang.String,java.lang.Object> propertyConsumer)
Starts visiting properties.
-
-