Interface AttributeAccessor

All Superinterfaces:
AnnotatedElement

public interface AttributeAccessor extends AnnotatedElement
Offers access to a persistent attribute in an entity class. Instances are created using one of the AccessStyles.
Author:
Tobias Liefke
  • Method Details

    • getAccessStyle

      AccessStyle getAccessStyle()
      Describes how this attribute accesses the values below.
      Returns:
      the type that has created this attribute accessor
    • getDeclaringClass

      Class<?> getDeclaringClass()
      The class that declared this attribute.
      Returns:
      the class that contains the attribute
    • getElement

      AnnotatedElement getElement()
      The actual field or method.
      Returns:
      the wrapped element of the attribute
    • getGenericType

      Type getGenericType()
      The generic type of the accessed attribute.
      Returns:
      the generic type of the field or the generic return type of the method
    • getImplementationClass

      Class<?> getImplementationClass()
      The class that is the type of every object that contains this attribute. Either the class that declared this attribute or a sub class. Used to resolve any generic type parameter in getType().
      Returns:
      the class where the scan of attributes started
    • getModifiers

      int getModifiers()
      The combination of Modifiers.
      Returns:
      the modifiers of the field or method
    • getName

      String getName()
      The name of the accessed attribute.
      Returns:
      the name (decapitalized if necessary)
    • getType

      Class<?> getType()
      The type of the accessed attribute. If the type is a generic type, any type variable is resolved with getImplementationClass().
      Returns:
      the type of the field or the return type of the method
    • getValue

      <E, T> T getValue(E entity)
      Resolves the current value for the attribute on the given entity.
      Parameters:
      entity - the entity to inspect
      Returns:
      the value, null if entity is null
    • setValue

      <E, T> void setValue(E entity, T value)
      Sets a new value for the attribute on the given entity.
      Parameters:
      entity - the entity to inspect
      value - the new value