Module jakarta.data

Interface BooleanAttribute<T>

Type Parameters:
T - entity class of the static metamodel.
All Superinterfaces:
Attribute<T>, BasicAttribute<T,Boolean>, BooleanExpression<T>, ComparableAttribute<T,Boolean>, ComparableExpression<T,Boolean>, Expression<T,Boolean>, SortableAttribute<T>

public interface BooleanAttribute<T> extends ComparableAttribute<T,Boolean>, BooleanExpression<T>

Represents a boolean entity attribute in the StaticMetamodel. Boolean entity attributes can be sorted on in query results and can be compared in query restrictions. When sorting in ascending direction, the value false is ordered before the value true. When sorting in descending direction, the value true is ordered before the value false.

Entity attribute types that are considered boolean include:

  • boolean primitve type
  • Boolean wrapper type

Where possible, BooleanAttribute, which provides more function, is preferred over ComparableAttribute and SortableAttribute.

Since:
1.1
  • Method Details

    • of

      static <T> BooleanAttribute<T> of(Class<T> entityClass, String name, Class<Boolean> attributeType)

      Creates a static metamodel BooleanAttribute representing the entity attribute with the specified name.

      Type Parameters:
      T - entity class of the static metamodel.
      Parameters:
      entityClass - the entity class.
      name - the name of the entity attribute.
      attributeType - type of the entity attribute: boolean.class or Boolean.class.
      Returns:
      instance of BooleanAttribute.
    • type

      Class<Boolean> type()
      Returns boolean.class or Boolean.class as the entity attribute type for boolean attributes.
      Specified by:
      type in interface Attribute<T>
      Specified by:
      type in interface BasicAttribute<T,Boolean>
      Specified by:
      type in interface BooleanExpression<T>
      Specified by:
      type in interface Expression<T,Boolean>
      Returns:
      boolean.class or Boolean.class.