Class Attribute

java.lang.Object
jakarta.data.model.Attribute

public class Attribute extends Object
Represents an entity attribute in the StaticMetamodel.
  • Method Summary

    Modifier and Type
    Method
    Description
    final Sort
    asc()
    Obtain a request for an ascending Sort based on the entity attribute.
    final Sort
    Obtain a request for an ascending, case insensitive Sort based on the entity attribute.
    final Sort
    Obtain a request for a descending Sort based on the entity attribute.
    final Sort
    Obtain a request for a descending, case insensitive Sort based on the entity attribute.
    static final Attribute
    get()
    Obtains a new instance for the Jakarta Data provider to initialize.
    final boolean
    init(AttributeInfo attrInfo)
    Used by the Jakarta Data provider to initialize this Attribute with implementation.
    final String
    Obtain the entity attribute name, suitable for use wherever the specification requires an entity attribute name.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • asc

      public final Sort asc()
      Obtain a request for an ascending Sort based on the entity attribute.
      Returns:
      a request for an ascending sort on the entity attribute.
      Throws:
      MappingException - if an entity attribute with this name does not exist or if no Jakarta Data provider provides a repository for the entity type.
    • ascIgnoreCase

      public final Sort ascIgnoreCase()
      Obtain a request for an ascending, case insensitive Sort based on the entity attribute.
      Returns:
      a request for an ascending, case insensitive sort on the entity attribute.
      Throws:
      MappingException - if an entity attribute with this name does not exist or if no Jakarta Data provider provides a repository for the entity type.
    • desc

      public final Sort desc()
      Obtain a request for a descending Sort based on the entity attribute.
      Returns:
      a request for a descending sort on the entity attribute.
      Throws:
      MappingException - if an entity attribute with this name does not exist or if no Jakarta Data provider provides a repository for the entity type.
    • descIgnoreCase

      public final Sort descIgnoreCase()
      Obtain a request for a descending, case insensitive Sort based on the entity attribute.
      Returns:
      a request for a descending, case insensitive sort on the entity attribute.
      Throws:
      MappingException - if an entity attribute with this name does not exist or if no Jakarta Data provider provides a repository for the entity type.
    • get

      public static final Attribute get()

      Obtains a new instance for the Jakarta Data provider to initialize.

      The Jakarta Data provider automatically initializes the instance when used as the value of a public, static, final field of a class that is annotated with StaticMetamodel, where the field name matches the name of an entity attribute. For example, a Vehicle entity with attributes vin, make, model, and year could have the following static metamodel,

       @StaticMetamodel(Vehicle.class)
       public class Vehicle_ {
           public static final Attribute vin = Attribute.get();
           public static final Attribute make = Attribute.get();
           public static final Attribute model = Attribute.get();
           public static final Attribute year = Attribute.get();
       }
       
      Returns:
      a new instance for an entity attribute.
    • init

      public final boolean init(AttributeInfo attrInfo)
      Used by the Jakarta Data provider to initialize this Attribute with implementation.
      Parameters:
      attrInfo - attribute information provided by the Jakarta Data provider.
      Returns:
      true if initialization was successful; false if previously initialized.
    • name

      public final String name()
      Obtain the entity attribute name, suitable for use wherever the specification requires an entity attribute name. For example, as the parameter to Sort.asc(String).
      Returns:
      the entity attribute name.
      Throws:
      MappingException - if an entity attribute with this name does not exist or if no Jakarta Data provider provides a repository for the entity type.