Interface EnumField<ENTITY,E extends Enum<E>>

All Superinterfaces:
ComparableField<ENTITY,E>, Comparator<ENTITY>, com.speedment.runtime.compute.expression.Expression<ENTITY>, Field<ENTITY>, Function<ENTITY,E>, HasColumnName, HasComparableOperators<ENTITY,E>, com.speedment.runtime.compute.trait.HasCompare<ENTITY>, com.speedment.runtime.compute.trait.HasCompose<ENTITY>, HasGetter<ENTITY>, com.speedment.runtime.compute.trait.HasHash<ENTITY>, com.speedment.runtime.compute.trait.HasMapIfPresent<ENTITY,UnaryOperator<E>,com.speedment.runtime.compute.ToEnumNullable<ENTITY,E>>, com.speedment.runtime.compute.trait.HasMapToDoubleIfPresent<ENTITY,ToDoubleFunction<E>>, HasReferenceOperators<ENTITY>, HasReferenceValue<ENTITY,E>, HasTable<ENTITY>, ReferenceField<ENTITY,E>, com.speedment.runtime.compute.ToEnumNullable<ENTITY,E>, com.speedment.runtime.compute.trait.ToNullable<ENTITY,E,com.speedment.runtime.compute.ToEnum<ENTITY,E>>

public interface EnumField<ENTITY,E extends Enum<E>> extends ComparableField<ENTITY,E>, com.speedment.runtime.compute.ToEnumNullable<ENTITY,E>
A field representing an Enum value in the entity.
Since:
3.0.10
Author:
Emil Forslund
See Also:
  • Method Details

    • enumClass

      Class<E> enumClass()
      Returns the enum class of this field.
      Specified by:
      enumClass in interface com.speedment.runtime.compute.ToEnumNullable<ENTITY,E extends Enum<E>>
      Returns:
      the enum class
      Since:
      3.0.13
    • constants

      EnumSet<E> constants()
      Returns the set of possible values for this enum. The order will be the ordinal order of the enum.

      This method creates a copy of the internal storage structure so changes to the returned collection are allowed.

      Returns:
      the constants
    • isNull

      Description copied from interface: HasReferenceOperators
      Returns a Predicate that will evaluate to true, if and only if this Field is null.
      Specified by:
      isNull in interface HasReferenceOperators<ENTITY>
      Specified by:
      isNull in interface com.speedment.runtime.compute.trait.ToNullable<ENTITY,E extends Enum<E>,com.speedment.runtime.compute.ToEnum<ENTITY,E extends Enum<E>>>
      Returns:
      a Predicate that will evaluate to true, if and only if this Field is null
    • isNotNull

      default FieldIsNotNullPredicate<ENTITY,E> isNotNull()
      Description copied from interface: HasReferenceOperators
      Returns a Predicate that will evaluate to true, if and only if this Field is not null.
      Specified by:
      isNotNull in interface HasReferenceOperators<ENTITY>
      Specified by:
      isNotNull in interface com.speedment.runtime.compute.trait.ToNullable<ENTITY,E extends Enum<E>,com.speedment.runtime.compute.ToEnum<ENTITY,E extends Enum<E>>>
      Returns:
      a Predicate that will evaluate to true, if and only if this Field is not null
    • apply

      default E apply(ENTITY entity)
      Specified by:
      apply in interface Function<ENTITY,E extends Enum<E>>
    • mapToDoubleIfPresent

      default com.speedment.runtime.compute.ToDoubleNullable<ENTITY> mapToDoubleIfPresent(ToDoubleFunction<E> mapper)
      Description copied from interface: ReferenceField
      Returns an ToDoubleNullable expression that has the value returned by the specified mapper function if the value for this field is not null, and otherwise null.
      Specified by:
      mapToDoubleIfPresent in interface com.speedment.runtime.compute.trait.HasMapToDoubleIfPresent<ENTITY,E extends Enum<E>>
      Specified by:
      mapToDoubleIfPresent in interface ReferenceField<ENTITY,E extends Enum<E>>
      Specified by:
      mapToDoubleIfPresent in interface com.speedment.runtime.compute.ToEnumNullable<ENTITY,E extends Enum<E>>
      Parameters:
      mapper - the mapper operation
      Returns:
      expression for this value after mapper has been applied
    • create

      static <ENTITY, E extends Enum<E>> EnumField<ENTITY,E> create(Class<ENTITY> table, String columnName, ReferenceGetter<ENTITY,E> getter, Class<E> enumClass)
      Create a new instance of this interface using the default implementation.
      Type Parameters:
      ENTITY - the entity type
      E - the java enum type
      Parameters:
      table - the table that this field belongs to
      columnName - the name of the database column the field represents
      getter - method reference to the getter in the entity
      enumClass - the enum class
      Returns:
      the created field