Package cn.dinodev.spring.commons.bean
Class Property
java.lang.Object
cn.dinodev.spring.commons.bean.Property
Bean属性描述类,用于表示对象的属性信息
- Since:
- 2022-07-01
- Author:
- Cody Lu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanThe property AnnotationsgetField()The property Field: e.g.org.springframework.core.MethodParameterThe method parameter for the property getter or setter method: e.g.getName()The name of the property: e.g.Class<?> The object declaring this property, either directly or in a superclass the object extends.<A extends Annotation>
AgetReadAnnotation(Class<A> annotationType) The property Annotation on getter methodThe property getter method: e.g.org.springframework.core.ResolvableTypeThe ResolvableType property type.Class<?> getType()The property type: e.g.<A extends Annotation>
AgetWriteAnnotation(Class<A> annotationType) The property Annotation on setter methodThe property setter method: e.g.inthashCode()booleanThe property is readable.booleanisReadableInJsonView(Class<?> activeView) is the property readable && visible in the given view.booleanisVisiableInJsonView(Class<?> activeView) The property is readable or writable in given view.booleanThe property is writable.booleanisWritableInJsonView(Class<?> activeView) is the property writable && visible in the given view.
-
Constructor Details
-
Property
构造Property实例(不指定属性名)。属性名将根据读方法或写方法自动推导。
- Parameters:
objectType- 对象类型readMethod- 读方法(可以为null)writeMethod- 写方法(可以为null)
-
Property
public Property(Class<?> objectType, @Nullable Method readMethod, @Nullable Method writeMethod, @Nullable String name) 构造Property实例(指定属性名)。如果name为null,属性名将根据读方法或写方法自动推导。
- Parameters:
objectType- 对象类型readMethod- 读方法(可以为null)writeMethod- 写方法(可以为null)name- 属性名(可以为null,会自动推导)
-
-
Method Details
-
getObjectType
The object declaring this property, either directly or in a superclass the object extends.- Returns:
- the object type
-
getName
The name of the property: e.g. 'foo'- Returns:
- the name of the property
-
getType
The property type: e.g.java.lang.String- Returns:
- the property type
-
getResolvableType
public org.springframework.core.ResolvableType getResolvableType()The ResolvableType property type.- Returns:
- the ResolvableType property type
-
getReadMethod
The property getter method: e.g.getFoo()- Returns:
- the property getter method, or null if not found
-
getWriteMethod
The property setter method: e.g.setFoo(String)- Returns:
- the property setter method, or null if not found
-
getField
The property Field: e.g.String foo;- Returns:
- the property Field, or null if not found
-
isReadable
public boolean isReadable()The property is readable.- Returns:
- true if the property is readable
-
isWritable
public boolean isWritable()The property is writable.- Returns:
- true if the property is writable
-
isVisiableInJsonView
The property is readable or writable in given view.- Parameters:
activeView- active jsonView- Returns:
- true if the property is readable or writable in given view
-
isReadableInJsonView
is the property readable && visible in the given view.- Parameters:
activeView- active jsonView- Returns:
- true if the property is readable and visible in the given view.
-
isWritableInJsonView
is the property writable && visible in the given view.- Parameters:
activeView- active jsonView- Returns:
- true if the property is writable and visible in the given view.
-
getMethodParameter
public org.springframework.core.MethodParameter getMethodParameter()The method parameter for the property getter or setter method: e.g.MethodParameter(getFoo())- Returns:
- the method parameter for the property getter or setter method
-
getAnnotations
The property Annotations- Returns:
- the property Annotations on the getter/setter method or field
-
getReadAnnotation
The property Annotation on getter method- Parameters:
annotationType- the annotation type- Returns:
- the property Annotation on getter method or field
-
getWriteAnnotation
The property Annotation on setter method- Parameters:
annotationType- the annotation type- Returns:
- the property Annotation on setter method or field
-
equals
-
hashCode
public int hashCode()
-