public abstract class BeanPropertySupport
extends java.lang.Object
| 限定符和类型 | 类和说明 |
|---|---|
static class |
BeanPropertySupport.DiffNode |
protected class |
BeanPropertySupport.ReadVisitor
读访问接口实现
|
protected class |
BeanPropertySupport.WriteVisitor
写访问接口实现
|
| 限定符和类型 | 字段和说明 |
|---|---|
static BeanPropertySupport |
BEAN_SUPPORT |
protected static java.lang.Object[] |
EMPTY_OBJECT_ARRAY
An empty object array
|
protected static boolean |
traceEnabled |
| 限定符 | 构造器和说明 |
|---|---|
protected |
BeanPropertySupport() |
| 限定符和类型 | 方法和说明 |
|---|---|
static boolean |
allEmpty(java.lang.Iterable<java.lang.Object> values)
判断输入参数是否都为空
|
static boolean |
allEmpty(java.lang.Object... values)
判断输入参数是否都为空
|
void |
checkCycleReference(java.lang.Object bean)
检查是否有循环引用,有则抛出异常
|
abstract void |
clearDescriptors()
Clear any cached property descriptors information for all classes
loaded by any class loaders.
|
abstract void |
copyProperties(java.lang.Object dest,
java.lang.Object orig)
Copy property values from the "origin" bean to the "destination" bean
for all cases where the property names are the same (even though the
actual getter and setter methods might have been customized via
BeanInfo classes). |
<T> BeanDifference |
createBeanDifference(com.google.common.base.Function<T,java.lang.Object> rightGetter) |
java.util.Map<java.lang.String,java.lang.Object> |
describe(java.lang.Object bean)
以嵌套节点方式输出指定对象所有字段内容
|
java.util.Map<java.lang.String,java.lang.Object> |
describe(java.lang.Object bean,
boolean throwOnCycleReference)
以嵌套节点方式输出指定对象所有字段内容
|
java.util.Map<java.lang.String,BeanPropertySupport.DiffNode> |
different(java.lang.Object left,
java.lang.Object right)
返回两个对象之间差异的字段
|
java.util.Map<java.lang.String,BeanPropertySupport.DiffNode> |
different(java.lang.Object left,
java.lang.Object right,
java.lang.Iterable<java.lang.String> focusNames)
返回两个对象之间差异的字段
|
java.util.Map<java.lang.String,BeanPropertySupport.DiffNode> |
different(java.lang.Object left,
java.lang.Object right,
com.google.common.base.Predicate<java.lang.String> originNameFilter,
java.lang.Iterable<java.lang.String> focusNames)
返回两个对象之间差异的字段
|
java.util.Map<java.lang.String,BeanPropertySupport.DiffNode> |
different(java.lang.Object left,
java.lang.Object right,
com.google.common.base.Predicate<java.lang.String> originNameFilter,
java.lang.Iterable<java.lang.String> forceExcludeNames,
java.lang.Iterable<java.lang.String> focusNames,
boolean includeRequired)
返回两个对象之间差异的字段,返回不同的字段差异信息
|
java.util.Map<java.lang.String,BeanPropertySupport.DiffNode> |
different(java.lang.Object left,
java.lang.Object right,
com.google.common.base.Predicate<java.lang.String> originNameFilter,
java.lang.String... focusNames)
返回两个对象之间差异的字段
|
java.util.Map<java.lang.String,BeanPropertySupport.DiffNode> |
different(java.lang.Object left,
java.lang.Object right,
com.google.common.base.Predicate<java.lang.String> originNameFilter,
java.lang.String[] forceExcludeNames,
boolean includeRequired,
java.lang.String... focusNames)
返回两个对象之间差异的字段,返回不同的字段差异信息
|
java.util.Map<java.lang.String,BeanPropertySupport.DiffNode> |
different(java.lang.Object left,
java.lang.Object right,
java.lang.String... focusNames)
返回两个对象之间差异的字段
|
java.util.Map<java.lang.String,BeanPropertySupport.DiffNode> |
different(java.lang.Object left,
java.lang.Object right,
java.lang.String focusNames)
返回两个对象之间差异的字段
|
protected java.lang.Object |
getIndexedProperty(java.lang.Object bean,
java.lang.String name)
Return the value of the specified indexed property of the specified
bean, with no type conversions.
|
protected abstract java.lang.Object |
getIndexedProperty(java.lang.Object bean,
java.lang.String name,
int index)
Return the value of the specified indexed property of the specified
bean, with no type conversions.
|
protected java.lang.Object |
getIndexValue(java.lang.String name,
java.lang.Object bean,
int index)
返回
List对象索引指定位置的值index为-1时返回列表第一个元素,等同于0, index为-2时返回列表最后一个元素, |
protected java.lang.Object |
getMappedProperty(java.lang.Object bean,
java.lang.String name)
Return the value of the specified mapped property of the
specified bean, with no type conversions.
|
protected abstract java.lang.Object |
getMappedProperty(java.lang.Object bean,
java.lang.String name,
java.lang.String key)
Return the value of the specified mapped property of the specified
bean, with no type conversions.
|
java.lang.Object |
getProperty(java.lang.Object bean,
java.lang.String name)
Return the value of the (possibly nested) property of the specified
name, for the specified bean, with no type conversions.
|
java.lang.Object |
getProperty(java.lang.Object bean,
java.lang.String name,
java.lang.Object defaultValue)
Return the value of the (possibly nested) property of the specified
name, for the specified bean, with no type conversions.
|
protected java.lang.Object |
getProperty0(java.lang.Object bean,
java.lang.String name) |
java.lang.Object |
getPropertyChecked(java.lang.Object bean,
java.lang.String name)
Return the value of the (possibly nested) property of the specified
name, for the specified bean, with no type conversions.
|
<T> T |
getPropertyCheckType(java.lang.Object bean,
java.lang.String name,
java.lang.Class<T> targetType)
Return the value of the (possibly nested) property of the specified
name, for the specified bean, cast to target type.if value is String,try to parse json to target type.
|
abstract java.util.Set<java.lang.String> |
getPropertyNames(java.lang.Class<?> beanClass,
int rw,
boolean lenient)
获取beanClass中所有具有指定读写类型(rw)的属性名集合
|
java.util.Set<java.lang.String> |
getPropertyNames(java.lang.Object bean,
int rw,
boolean lenient) |
protected java.lang.Object |
getSearchedProperty(java.lang.Object bean,
java.lang.String name)
Return the value of the specified indexed property of the specified
bean, with no type conversions.
|
protected abstract java.lang.Object |
getSearchedProperty(java.lang.Object bean,
java.lang.String name,
java.lang.String field,
java.lang.Object conditionValue)
Return the value of the specified indexed property of the specified
bean, with no type conversions.
|
protected abstract java.lang.Object |
getSimpleProperty(java.lang.Object bean,
java.lang.String name)
Return the value of the specified simple property of the specified
bean, with no type conversions.
|
boolean |
hasCycleReference(java.lang.Object bean)
检查是否有循环引用,如果有循环引用返回
true否则返回false |
static boolean |
hasEmpty(java.lang.Iterable<java.lang.Object> values)
判断输入参数是否有为空的元素
|
static boolean |
hasEmpty(java.lang.Object... values)
判断输入参数是否有为空的元素
|
static boolean |
isEmpty(boolean all,
java.lang.Iterable<java.lang.Object> values)
判断输入参数是否都为空或有元素为空
如果 all为true判断都为空,即values中的所有元素都为空时返回true
否则判断有空,即 values中的任一元素为空时就返回true,
values为空则返回true |
static boolean |
isEmpty(boolean all,
java.lang.Object... values)
判断输入参数是否都为空或有元素为空
如果 all为true判断都为空,即values中的所有元素都为空时返回true
否则判断有空,即 values中的任一元素为空时就返回true,
values为空则返回true |
static boolean |
isEmpty(java.lang.Object value)
判断输入参数是否为
null或空如果输入参数为@ String,Collection,Iterable,Iterator,Map,数组类型则返回其是否为空,
否则返回false |
abstract boolean |
isReadable(java.lang.Object bean,
java.lang.String name)
Return
true if the specified property name identifies
a readable property on the specified bean; otherwise, return
false. |
abstract boolean |
isWriteable(java.lang.Object bean,
java.lang.String name)
Return
true if the specified property name identifies
a writeable property on the specified bean; otherwise, return
false. |
protected static int |
maybeJsonString(java.lang.Object object)
判断对象是否有可能是JSON 字符串,
如果是String类型且前后以{}返回1
如果是String类型且前后以[]返回2
否则返回0
|
protected java.lang.Object |
searchIn(java.lang.Object input,
java.lang.String field,
java.lang.Object conditionValue)
在
input中遍历所有元素找到匹配的值,没找到返回null |
protected abstract void |
setIndexedProperty(java.lang.Object bean,
java.lang.String name,
int index,
java.lang.Object value)
Set the value of the specified indexed property of the specified
bean, with no type conversions.
|
protected void |
setIndexedProperty(java.lang.Object bean,
java.lang.String name,
java.lang.Object value)
Set the value of the specified indexed property of the specified
bean, with no type conversions.
|
protected void |
setMappedProperty(java.lang.Object bean,
java.lang.String name,
java.lang.Object value)
Set the value of the specified mapped property of the
specified bean, with no type conversions.
|
protected abstract void |
setMappedProperty(java.lang.Object bean,
java.lang.String name,
java.lang.String key,
java.lang.Object value)
Set the value of the specified mapped property of the specified
bean, with no type conversions.
|
protected void |
setOrAddIndexValue(java.lang.String name,
java.lang.Object bean,
int index,
java.lang.Object value)
设置
List对象索引指定位置的值index为-1时向列表头部添加元素, index为-2时向列表尾部添加元素, |
java.lang.Object |
setProperty(java.lang.Object bean,
java.lang.String name,
java.lang.Object value)
Set the value of the (possibly nested) property of the specified
name, for the specified bean, with no type conversions.
|
protected java.lang.Object |
setProperty0(java.lang.Object bean,
java.lang.String name,
java.lang.Object value) |
java.lang.Object |
setPropertyChecked(java.lang.Object bean,
java.lang.String name,
java.lang.Object value)
Set the value of the (possibly nested) property of the specified
name, for the specified bean, with no type conversions.
|
protected abstract void |
setSimpleProperty(java.lang.Object bean,
java.lang.String name,
java.lang.Object value)
Set the value of the specified simple property of the specified bean,
with no type conversions.
|
static void |
setTraceEnabled(boolean traceEnabled) |
protected abstract java.lang.Object |
tryConstructIfNull(java.lang.Object nestedBean,
java.lang.Object bean,
java.lang.String name,
java.lang.Class<?> expectType)
当
nestedBean为null时尝试为bean的name字段构造新实例 |
public static final BeanPropertySupport BEAN_SUPPORT
protected static final java.lang.Object[] EMPTY_OBJECT_ARRAY
protected static boolean traceEnabled
public abstract java.util.Set<java.lang.String> getPropertyNames(java.lang.Class<?> beanClass,
int rw,
boolean lenient)
beanClass - rw - 属性类型标记 lenient - 是否为宽容模式---允许返回类型不为void的setter方法public java.util.Set<java.lang.String> getPropertyNames(java.lang.Object bean,
int rw,
boolean lenient)
getPropertyNames(Class, int, boolean)public abstract void clearDescriptors()
public java.lang.Object getProperty(java.lang.Object bean,
java.lang.String name)
bean - Bean whose property is to be extractedname - Possibly nested name of the property to be extractedgetProperty(Object, String, Object)public java.lang.Object getProperty(java.lang.Object bean,
java.lang.String name,
java.lang.Object defaultValue)
throws BeanPropertyRuntimeException
bean - Bean whose property is to be extractedname - Possibly nested name of the property to be extracteddefaultValue - default value if value of property is nullBeanPropertyRuntimeException - wrap all reflect option exceptionpublic <T> T getPropertyCheckType(java.lang.Object bean,
java.lang.String name,
java.lang.Class<T> targetType)
throws BeanPropertyRuntimeException
bean - Bean whose property is to be extractedname - Possibly nested name of the property to be extractedtargetType - type requiredBeanPropertyRuntimeException - wrap all reflect option exceptionpublic java.lang.Object getPropertyChecked(java.lang.Object bean,
java.lang.String name)
throws java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.NoSuchMethodException
bean - Bean whose property is to be extractedname - Possibly nested name of the property to be extractedjava.lang.IllegalAccessException - if the caller does not have
access to the property accessor methodjava.lang.IllegalArgumentException - if bean or
name is nullNestedNullException - if a nested reference to a
property returns nulljava.lang.reflect.InvocationTargetException - if the property accessor method throws an exceptionjava.lang.NoSuchMethodException - if an accessor method for this
propety cannot be foundprotected java.lang.Object getProperty0(java.lang.Object bean,
java.lang.String name)
throws java.lang.IllegalArgumentException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.NoSuchMethodException
java.lang.IllegalArgumentExceptionjava.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetExceptionjava.lang.NoSuchMethodExceptionprotected java.lang.Object getMappedProperty(java.lang.Object bean,
java.lang.String name)
throws java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.NoSuchMethodException
IllegalArgumentException will be
thrown.bean - Bean whose property is to be extractedname - propertyname(key) of the property value
to be extractedjava.lang.IllegalAccessException - if the caller does not have
access to the property accessor methodjava.lang.reflect.InvocationTargetException - if the property accessor method
throws an exceptionjava.lang.NoSuchMethodException - if an accessor method for this
propety cannot be foundprotected abstract java.lang.Object getMappedProperty(java.lang.Object bean,
java.lang.String name,
java.lang.String key)
throws java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.NoSuchMethodException
bean - Bean whose property is to be extractedname - Mapped property name of the property value to be extractedkey - Key of the property value to be extractedjava.lang.IllegalAccessException - if the caller does not have
access to the property accessor methodjava.lang.reflect.InvocationTargetException - if the property accessor method
throws an exceptionjava.lang.NoSuchMethodException - if an accessor method for this
propety cannot be foundprotected java.lang.Object getIndexedProperty(java.lang.Object bean,
java.lang.String name)
throws java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.NoSuchMethodException
IllegalArgumentException will be
thrown. In addition to supporting the JavaBeans specification, this
method has been extended to support List objects as well.bean - Bean whose property is to be extractedname - propertyname[index] of the property value
to be extractedjava.lang.IndexOutOfBoundsException - if the specified index
is outside the valid range for the underlying array or Listjava.lang.IllegalAccessException - if the caller does not have
access to the property accessor methodjava.lang.IllegalArgumentException - if bean or
name is nulljava.lang.reflect.InvocationTargetException - if the property accessor method
throws an exceptionjava.lang.NoSuchMethodException - if an accessor method for this
propety cannot be foundprotected abstract java.lang.Object getIndexedProperty(java.lang.Object bean,
java.lang.String name,
int index)
throws java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.NoSuchMethodException
List objects as well.bean - Bean whose property is to be extractedname - Simple property name of the property value to be extractedindex - Index of the property value to be extractedjava.lang.IndexOutOfBoundsException - if the specified index
is outside the valid range for the underlying propertyjava.lang.IllegalAccessException - if the caller does not have
access to the property accessor methodjava.lang.IllegalArgumentException - if bean or
name is nulljava.lang.reflect.InvocationTargetException - if the property accessor method
throws an exceptionjava.lang.NoSuchMethodException - if an accessor method for this
propety cannot be foundprotected java.lang.Object getSearchedProperty(java.lang.Object bean,
java.lang.String name)
throws java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.NoSuchMethodException
IllegalArgumentException will be
thrown. In addition to supporting the JavaBeans specification, this
method has been extended to support List objects as well.bean - Bean whose property is to be extractedname - propertyname[index] of the property value
to be extractedjava.lang.IndexOutOfBoundsException - if the specified index
is outside the valid range for the underlying array or Listjava.lang.IllegalAccessException - if the caller does not have
access to the property accessor methodjava.lang.IllegalArgumentException - if bean or
name is nulljava.lang.reflect.InvocationTargetException - if the property accessor method
throws an exceptionjava.lang.NoSuchMethodException - if an accessor method for this
propety cannot be foundprotected abstract java.lang.Object getSearchedProperty(java.lang.Object bean,
java.lang.String name,
java.lang.String field,
java.lang.Object conditionValue)
throws java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.NoSuchMethodException
List objects as well.bean - Bean whose property is to be extractedname - Simple property name of the property value to be extractedfield - sub property nameconditionValue - search satisfied value of fieldjava.lang.IndexOutOfBoundsException - if the specified index
is outside the valid range for the underlying propertyjava.lang.IllegalAccessException - if the caller does not have
access to the property accessor methodjava.lang.IllegalArgumentException - if bean or
name is nulljava.lang.reflect.InvocationTargetException - if the property accessor method
throws an exceptionjava.lang.NoSuchMethodException - if an accessor method for this
property cannot be foundprotected abstract java.lang.Object getSimpleProperty(java.lang.Object bean,
java.lang.String name)
throws java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.NoSuchMethodException
bean - Bean whose property is to be extractedname - Name of the property to be extractedjava.lang.IllegalAccessException - if the caller does not have
access to the property accessor methodjava.lang.IllegalArgumentException - if bean or
name is nulljava.lang.IllegalArgumentException - if the property name
is nested or indexedjava.lang.reflect.InvocationTargetException - if the property accessor method
throws an exceptionjava.lang.NoSuchMethodException - if an accessor method for this
propety cannot be foundpublic java.lang.Object setProperty(java.lang.Object bean,
java.lang.String name,
java.lang.Object value)
bean - Bean whose property is to be modifiedname - Possibly nested name of the property to be modifiedvalue - Value to which the property is to be setBeanPropertyRuntimeException - wrap all reflect option exceptionsetPropertyChecked(Object, String, Object)public java.lang.Object setPropertyChecked(java.lang.Object bean,
java.lang.String name,
java.lang.Object value)
throws java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.NoSuchMethodException
Example values for parameter "name" are:
bean - Bean whose property is to be modifiedname - Possibly nested name of the property to be modifiedvalue - Value to which the property is to be setjava.lang.IllegalAccessException - if the caller does not have
access to the property accessor methodjava.lang.IllegalArgumentException - if bean or
name is nulljava.lang.IllegalArgumentException - if a nested reference to a
property returns nulljava.lang.reflect.InvocationTargetException - if the property accessor method
throws an exceptionjava.lang.NoSuchMethodException - if an accessor method for this
propety cannot be foundprotected java.lang.Object setProperty0(java.lang.Object bean,
java.lang.String name,
java.lang.Object value)
throws java.lang.IllegalArgumentException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.NoSuchMethodException
java.lang.IllegalArgumentExceptionjava.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetExceptionjava.lang.NoSuchMethodExceptionprotected void setMappedProperty(java.lang.Object bean,
java.lang.String name,
java.lang.Object value)
throws java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.NoSuchMethodException
IllegalArgumentException will be
thrown.bean - Bean whose property is to be setname - propertyname(key) of the property value
to be setvalue - The property value to be setjava.lang.IllegalAccessException - if the caller does not have
access to the property accessor methodjava.lang.reflect.InvocationTargetException - if the property accessor method
throws an exceptionjava.lang.NoSuchMethodException - if an accessor method for this
propety cannot be foundprotected abstract void setMappedProperty(java.lang.Object bean,
java.lang.String name,
java.lang.String key,
java.lang.Object value)
throws java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.NoSuchMethodException
bean - Bean whose property is to be setname - Mapped property name of the property value to be setkey - Key of the property value to be setvalue - The property value to be setjava.lang.IllegalAccessException - if the caller does not have
access to the property accessor methodjava.lang.reflect.InvocationTargetException - if the property accessor method
throws an exceptionjava.lang.NoSuchMethodException - if an accessor method for this
propety cannot be foundprotected void setIndexedProperty(java.lang.Object bean,
java.lang.String name,
java.lang.Object value)
throws java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.NoSuchMethodException
IllegalArgumentException will be
thrown. In addition to supporting the JavaBeans specification, this
method has been extended to support List objects as well.bean - Bean whose property is to be modifiedname - propertyname[index] of the property value
to be modifiedvalue - Value to which the specified property element
should be setjava.lang.IndexOutOfBoundsException - if the specified index
is outside the valid range for the underlying propertyjava.lang.IllegalAccessException - if the caller does not have
access to the property accessor methodjava.lang.IllegalArgumentException - if bean or
name is nulljava.lang.reflect.InvocationTargetException - if the property accessor method
throws an exceptionjava.lang.NoSuchMethodException - if an accessor method for this
propety cannot be foundprotected abstract void setIndexedProperty(java.lang.Object bean,
java.lang.String name,
int index,
java.lang.Object value)
throws java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.NoSuchMethodException
List objects as well.bean - Bean whose property is to be setname - Simple property name of the property value to be setindex - Index of the property value to be setvalue - Value to which the indexed property element is to be setjava.lang.IndexOutOfBoundsException - if the specified index
is outside the valid range for the underlying propertyjava.lang.IllegalAccessException - if the caller does not have
access to the property accessor methodjava.lang.IllegalArgumentException - if bean or
name is nulljava.lang.reflect.InvocationTargetException - if the property accessor method
throws an exceptionjava.lang.NoSuchMethodException - if an accessor method for this
propety cannot be foundprotected void setOrAddIndexValue(java.lang.String name,
java.lang.Object bean,
int index,
java.lang.Object value)
List对象索引指定位置的值name - bean - index - value - protected java.lang.Object getIndexValue(java.lang.String name,
java.lang.Object bean,
int index)
List对象索引指定位置的值bean - index - bean - protected abstract void setSimpleProperty(java.lang.Object bean,
java.lang.String name,
java.lang.Object value)
throws java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.NoSuchMethodException
bean - Bean whose property is to be modifiedname - Name of the property to be modifiedvalue - Value to which the property should be setjava.lang.IllegalAccessException - if the caller does not have
access to the property accessor methodjava.lang.IllegalArgumentException - if bean or
name is nulljava.lang.IllegalArgumentException - if the property name is
nested or indexedjava.lang.reflect.InvocationTargetException - if the property accessor method
throws an exceptionjava.lang.NoSuchMethodException - if an accessor method for this
propety cannot be foundpublic abstract void copyProperties(java.lang.Object dest,
java.lang.Object orig)
Copy property values from the "origin" bean to the "destination" bean
for all cases where the property names are the same (even though the
actual getter and setter methods might have been customized via
BeanInfo classes). No conversions are performed on the
actual property values -- it is assumed that the values retrieved from
the origin bean are assignment-compatible with the types expected by
the destination bean.
If the origin "bean" is actually a Map, it is assumed
to contain String-valued simple property names as the keys, pointing
at the corresponding property values that will be set in the destination
bean.Note that this method is intended to perform
a "shallow copy" of the properties and so complex properties
(for example, nested ones) will not be copied.
Note, that this method will not copy a List to a List, or an Object[] to an Object[]. It's specifically for copying JavaBean properties.
dest - Destination bean whose properties are modifiedorig - Origin bean whose properties are retrieved
orig argument is nullpublic abstract boolean isReadable(java.lang.Object bean,
java.lang.String name)
Return true if the specified property name identifies
a readable property on the specified bean; otherwise, return
false.
bean - Bean to be examinedname - Property name to be evaluatedtrue if the property is readable,
otherwise falsejava.lang.IllegalArgumentException - if bean
or name is nullpublic abstract boolean isWriteable(java.lang.Object bean,
java.lang.String name)
Return true if the specified property name identifies
a writeable property on the specified bean; otherwise, return
false.
bean - Bean to be examinedname - Property name to be evaluatedtrue if the property is writeable,
otherwise falsejava.lang.IllegalArgumentException - if bean
or name is nullpublic <T> BeanDifference createBeanDifference(com.google.common.base.Function<T,java.lang.Object> rightGetter)
public java.util.Map<java.lang.String,java.lang.Object> describe(java.lang.Object bean)
bean - Bean whose properties are to be extractedpublic java.util.Map<java.lang.String,java.lang.Object> describe(java.lang.Object bean,
boolean throwOnCycleReference)
bean - Bean whose properties are to be extractedthrowOnCycleReference - 当检测到循环引用时是否抛出CycleReferenceExceptionpublic boolean hasCycleReference(java.lang.Object bean)
true否则返回falsebean - public void checkCycleReference(java.lang.Object bean)
throws CycleReferenceException
bean - CycleReferenceException - 检测到循环引用public java.util.Map<java.lang.String,BeanPropertySupport.DiffNode> different(java.lang.Object left, java.lang.Object right)
left - right - public java.util.Map<java.lang.String,BeanPropertySupport.DiffNode> different(java.lang.Object left, java.lang.Object right, java.lang.String focusNames)
left - right - public java.util.Map<java.lang.String,BeanPropertySupport.DiffNode> different(java.lang.Object left, java.lang.Object right, java.lang.String... focusNames)
left - right - public java.util.Map<java.lang.String,BeanPropertySupport.DiffNode> different(java.lang.Object left, java.lang.Object right, java.lang.Iterable<java.lang.String> focusNames)
left - right - public java.util.Map<java.lang.String,BeanPropertySupport.DiffNode> different(java.lang.Object left, java.lang.Object right, com.google.common.base.Predicate<java.lang.String> originNameFilter, java.lang.Iterable<java.lang.String> focusNames)
left - right - originNameFilter - focusNames - public java.util.Map<java.lang.String,BeanPropertySupport.DiffNode> different(java.lang.Object left, java.lang.Object right, com.google.common.base.Predicate<java.lang.String> originNameFilter, java.lang.String... focusNames)
left - right - originNameFilter - focusNames - public java.util.Map<java.lang.String,BeanPropertySupport.DiffNode> different(java.lang.Object left, java.lang.Object right, com.google.common.base.Predicate<java.lang.String> originNameFilter, java.lang.String[] forceExcludeNames, boolean includeRequired, java.lang.String... focusNames)
public java.util.Map<java.lang.String,BeanPropertySupport.DiffNode> different(java.lang.Object left, java.lang.Object right, com.google.common.base.Predicate<java.lang.String> originNameFilter, java.lang.Iterable<java.lang.String> forceExcludeNames, java.lang.Iterable<java.lang.String> focusNames, boolean includeRequired)
left - right - originNameFilter - forceExcludeNames - 强制排除比较的字段名focusNames - 比较字段黑/白名单includeRequired - 为true时focusNames为白名单,否则为黑名单protected java.lang.Object searchIn(java.lang.Object input,
java.lang.String field,
java.lang.Object conditionValue)
throws java.lang.IllegalArgumentException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.NoSuchMethodException
input中遍历所有元素找到匹配的值,没找到返回nullinput - field - conditionValue - java.lang.IllegalArgumentExceptionjava.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetExceptionjava.lang.NoSuchMethodExceptionprotected abstract java.lang.Object tryConstructIfNull(java.lang.Object nestedBean,
java.lang.Object bean,
java.lang.String name,
java.lang.Class<?> expectType)
throws java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.NoSuchMethodException
nestedBean为null时尝试为bean的name字段构造新实例nestedBean - bean - name - 字段名expectType - 期望的新实例类型,为null使用从字段对应的属性类型java.lang.IllegalAccessExceptionjava.lang.reflect.InvocationTargetExceptionjava.lang.NoSuchMethodExceptionpublic static void setTraceEnabled(boolean traceEnabled)
public static boolean isEmpty(java.lang.Object value)
null或空String,Collection,Iterable,Iterator,Map,数组类型则返回其是否为空,
否则返回falsevalue - 为null返回truepublic static boolean isEmpty(boolean all,
java.lang.Iterable<java.lang.Object> values)
all为true判断都为空,即values中的所有元素都为空时返回true
否则判断有空,即 values中的任一元素为空时就返回true,
values为空则返回trueall - 为true要求values 所有元素为空,为false则只要values中元素为空即返回truevalues - 待判空元素迭代器对象isEmpty(Object)public static boolean isEmpty(boolean all,
java.lang.Object... values)
all为true判断都为空,即values中的所有元素都为空时返回true
否则判断有空,即 values中的任一元素为空时就返回true,
values为空则返回trueall - 为true要求values 所有元素为空,为false则只要values中元素为空即返回truevalues - 待判空元素迭代器对象isEmpty(Object)public static boolean allEmpty(java.lang.Iterable<java.lang.Object> values)
values - 待判空元素迭代器对象isEmpty(boolean, Iterable)public static boolean allEmpty(java.lang.Object... values)
values - 待判空元素数组isEmpty(boolean, Object...)public static boolean hasEmpty(java.lang.Iterable<java.lang.Object> values)
values - 待判空元素迭代器对象isEmpty(boolean, Iterable)public static boolean hasEmpty(java.lang.Object... values)
values - 待判空元素数组isEmpty(boolean, Object...)protected static int maybeJsonString(java.lang.Object object)
object - Copyright © 2023. All Rights Reserved.