Class Property

java.lang.Object
cn.dinodev.spring.commons.bean.Property

public final class Property extends Object
Author:
Cody Lu
  • Constructor Details

    • Property

      public Property(Class<?> objectType, @Nullable Method readMethod, @Nullable Method writeMethod)
    • Property

      public Property(Class<?> objectType, @Nullable Method readMethod, @Nullable Method writeMethod, @Nullable String name)
  • Method Details

    • getObjectType

      public Class<?> getObjectType()
      The object declaring this property, either directly or in a superclass the object extends.
      Returns:
      the object type
    • getName

      public String getName()
      The name of the property: e.g. 'foo'
      Returns:
      the name of the property
    • getType

      public Class<?> 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

      @Nullable public Method getReadMethod()
      The property getter method: e.g. getFoo()
      Returns:
      the property getter method, or null if not found
    • getWriteMethod

      @Nullable public Method getWriteMethod()
      The property setter method: e.g. setFoo(String)
      Returns:
      the property setter method, or null if not found
    • getField

      @Nullable public Field 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

      public boolean isVisiableInJsonView(@Nullable Class<?> activeView)
      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

      public boolean isReadableInJsonView(@Nullable Class<?> activeView)
      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

      public boolean isWritableInJsonView(@Nullable Class<?> activeView)
      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

      public Annotation[] getAnnotations()
      The property Annotations
      Returns:
      the property Annotations on the getter/setter method or field
    • getReadAnnotation

      public <A extends Annotation> A getReadAnnotation(Class<A> annotationType)
      The property Annotation on getter method
      Parameters:
      annotationType - the annotation type
      Returns:
      the property Annotation on getter method or field
    • getWriteAnnotation

      public <A extends Annotation> A getWriteAnnotation(Class<A> annotationType)
      The property Annotation on setter method
      Parameters:
      annotationType - the annotation type
      Returns:
      the property Annotation on setter method or field
    • equals

      public boolean equals(@Nullable Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object