Interface ReferenceField<ENTITY,V>

Type Parameters:
ENTITY - the entity type
V - the field value type
All Superinterfaces:
Field<ENTITY>, HasColumnName, HasGetter<ENTITY>, com.speedment.runtime.compute.trait.HasMapToDoubleIfPresent<ENTITY,ToDoubleFunction<V>>, HasReferenceOperators<ENTITY>, HasReferenceValue<ENTITY,V>, HasTable<ENTITY>
All Known Subinterfaces:
ComparableField<ENTITY,V>, EnumField<ENTITY,E>, StringField<ENTITY>

public interface ReferenceField<ENTITY,V> extends Field<ENTITY>, HasReferenceOperators<ENTITY>, HasReferenceValue<ENTITY,V>, com.speedment.runtime.compute.trait.HasMapToDoubleIfPresent<ENTITY,ToDoubleFunction<V>>
A field that represents an object value.
Since:
2.2.0
Author:
Per Minborg, Emil Forslund
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    default com.speedment.runtime.compute.ToBigDecimalNullable<ENTITY>
    Returns an ToBigDecimalNullable expression that has the value of this field but casted to a BigDecimal.
    default com.speedment.runtime.compute.ToBooleanNullable<ENTITY>
    Returns an ToBooleanNullable expression that has the value of this field, casted to a boolean by first casting it to Boolean.
    default com.speedment.runtime.compute.ToByteNullable<ENTITY>
    Returns an ToByteNullable expression that has the value of this field, casted to a byte by first casting it to Number and then invoking Number.byteValue().
    default com.speedment.runtime.compute.ToCharNullable<ENTITY>
    Returns an ToCharNullable expression that has the value of this field, casted to a char by first casting it to Number and then invoking Number.intValue() and casting it to a char.
    default com.speedment.runtime.compute.ToDoubleNullable<ENTITY>
    Returns an ToDoubleNullable expression that has the value of this field, casted to a double by first casting it to Number and then invoking Number.doubleValue().
    default <E extends Enum<E>>
    com.speedment.runtime.compute.ToEnumNullable<ENTITY,E>
    asEnum(Class<E> enumClass)
    Returns an ToBooleanNullable expression that has the value of this field, casted to a particular enum class.
    default com.speedment.runtime.compute.ToFloatNullable<ENTITY>
    Returns an ToFloatNullable expression that has the value of this field, casted to a float by first casting it to Number and then invoking Number.floatValue().
    default com.speedment.runtime.compute.ToIntNullable<ENTITY>
    Returns an ToIntNullable expression that has the value of this field, casted to a int by first casting it to Number and then invoking Number.intValue().
    default com.speedment.runtime.compute.ToLongNullable<ENTITY>
    Returns an ToLongNullable expression that has the value of this field, casted to a long by first casting it to Number and then invoking Number.longValue().
    default com.speedment.runtime.compute.ToShortNullable<ENTITY>
    Returns an ToShortNullable expression that has the value of this field, casted to a short by first casting it to Number and then invoking Number.shortValue().
    default com.speedment.runtime.compute.ToStringNullable<ENTITY>
    Returns an ToBooleanNullable expression that has the value of this field, casted to a boolean by first casting it to Boolean.
    static <ENTITY, V> ReferenceField<ENTITY,V>
    create(Class<ENTITY> table, String columnName, ReferenceGetter<ENTITY,V> getter, boolean unique)
    Creates a new ReferenceField using the default implementation.
    default com.speedment.runtime.compute.ToBigDecimalNullable<ENTITY>
    Returns an ToStringNullable expression that has the value returned by the specified mapper function if the value for this field is not null, and otherwise null.
    default com.speedment.runtime.compute.ToBooleanNullable<ENTITY>
    mapToBooleanIfPresent(com.speedment.common.function.ToBooleanFunction<V> mapper)
    Returns an ToBooleanNullable expression that has the value returned by the specified mapper function if the value for this field is not null, and otherwise null.
    default com.speedment.runtime.compute.ToByteNullable<ENTITY>
    mapToByteIfPresent(com.speedment.common.function.ToByteFunction<V> mapper)
    Returns an ToByteNullable expression that has the value returned by the specified mapper function if the value for this field is not null, and otherwise null.
    default com.speedment.runtime.compute.ToCharNullable<ENTITY>
    mapToCharIfPresent(com.speedment.common.function.ToCharFunction<V> mapper)
    Returns an ToCharNullable expression that has the value returned by the specified mapper function if the value for this field is not null, and otherwise null.
    default com.speedment.runtime.compute.ToDoubleNullable<ENTITY>
    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.
    default <E extends Enum<E>>
    com.speedment.runtime.compute.ToEnumNullable<ENTITY,E>
    mapToEnumIfPresent(Function<V,E> mapper, Class<E> enumClass)
    Returns an ToEnumNullable expression that has the value returned by the specified mapper function if the value for this field is not null, and otherwise null.
    default com.speedment.runtime.compute.ToFloatNullable<ENTITY>
    mapToFloatIfPresent(com.speedment.common.function.ToFloatFunction<V> mapper)
    Returns an ToFloatNullable expression that has the value returned by the specified mapper function if the value for this field is not null, and otherwise null.
    default com.speedment.runtime.compute.ToIntNullable<ENTITY>
    Returns an ToIntNullable expression that has the value returned by the specified mapper function if the value for this field is not null, and otherwise null.
    default com.speedment.runtime.compute.ToLongNullable<ENTITY>
    Returns an ToLongNullable expression that has the value returned by the specified mapper function if the value for this field is not null, and otherwise null.
    default com.speedment.runtime.compute.ToShortNullable<ENTITY>
    mapToShortIfPresent(com.speedment.common.function.ToShortFunction<V> mapper)
    Returns an ToShortNullable expression that has the value returned by the specified mapper function if the value for this field is not null, and otherwise null.
    default com.speedment.runtime.compute.ToStringNullable<ENTITY>
    Returns an ToStringNullable expression that has the value returned by the specified mapper function if the value for this field is not null, and otherwise null.

    Methods inherited from interface com.speedment.jpastreamer.field.Field

    isUnique

    Methods inherited from interface com.speedment.jpastreamer.field.trait.HasColumnName

    columnName

    Methods inherited from interface com.speedment.jpastreamer.field.trait.HasReferenceOperators

    isNotNull, isNull

    Methods inherited from interface com.speedment.jpastreamer.field.trait.HasReferenceValue

    get, getter

    Methods inherited from interface com.speedment.jpastreamer.field.trait.HasTable

    table
  • Method Details

    • create

      static <ENTITY, V> ReferenceField<ENTITY,V> create(Class<ENTITY> table, String columnName, ReferenceGetter<ENTITY,V> getter, boolean unique)
      Creates a new ReferenceField using the default implementation.
      Type Parameters:
      ENTITY - the entity type
      V - the field value type
      Parameters:
      table - the column that this field represents
      columnName - the name of the database column the field represents
      getter - method reference to the getter in the entity
      unique - represented column only contains unique values
      Returns:
      the created field
    • mapToByteIfPresent

      default com.speedment.runtime.compute.ToByteNullable<ENTITY> mapToByteIfPresent(com.speedment.common.function.ToByteFunction<V> mapper)
      Returns an ToByteNullable expression that has the value returned by the specified mapper function if the value for this field is not null, and otherwise null.
      Parameters:
      mapper - the mapper operation
      Returns:
      expression for this value after mapper has been applied
      Since:
      3.1.0
    • asByte

      default com.speedment.runtime.compute.ToByteNullable<ENTITY> asByte()
      Returns an ToByteNullable expression that has the value of this field, casted to a byte by first casting it to Number and then invoking Number.byteValue().
      Returns:
      expression for this value after mapper has been applied
      Since:
      3.1.0
    • mapToShortIfPresent

      default com.speedment.runtime.compute.ToShortNullable<ENTITY> mapToShortIfPresent(com.speedment.common.function.ToShortFunction<V> mapper)
      Returns an ToShortNullable expression that has the value returned by the specified mapper function if the value for this field is not null, and otherwise null.
      Parameters:
      mapper - the mapper operation
      Returns:
      expression for this value after mapper has been applied
      Since:
      3.1.0
    • asShort

      default com.speedment.runtime.compute.ToShortNullable<ENTITY> asShort()
      Returns an ToShortNullable expression that has the value of this field, casted to a short by first casting it to Number and then invoking Number.shortValue().
      Returns:
      expression for this value after mapper has been applied
      Since:
      3.1.0
    • mapToIntIfPresent

      default com.speedment.runtime.compute.ToIntNullable<ENTITY> mapToIntIfPresent(ToIntFunction<V> mapper)
      Returns an ToIntNullable expression that has the value returned by the specified mapper function if the value for this field is not null, and otherwise null.
      Parameters:
      mapper - the mapper operation
      Returns:
      expression for this value after mapper has been applied
      Since:
      3.1.0
    • asInt

      default com.speedment.runtime.compute.ToIntNullable<ENTITY> asInt()
      Returns an ToIntNullable expression that has the value of this field, casted to a int by first casting it to Number and then invoking Number.intValue().
      Returns:
      expression for this value after mapper has been applied
      Since:
      3.1.0
    • mapToLongIfPresent

      default com.speedment.runtime.compute.ToLongNullable<ENTITY> mapToLongIfPresent(ToLongFunction<V> mapper)
      Returns an ToLongNullable expression that has the value returned by the specified mapper function if the value for this field is not null, and otherwise null.
      Parameters:
      mapper - the mapper operation
      Returns:
      expression for this value after mapper has been applied
      Since:
      3.1.0
    • asLong

      default com.speedment.runtime.compute.ToLongNullable<ENTITY> asLong()
      Returns an ToLongNullable expression that has the value of this field, casted to a long by first casting it to Number and then invoking Number.longValue().
      Returns:
      expression for this value after mapper has been applied
      Since:
      3.1.0
    • mapToFloatIfPresent

      default com.speedment.runtime.compute.ToFloatNullable<ENTITY> mapToFloatIfPresent(com.speedment.common.function.ToFloatFunction<V> mapper)
      Returns an ToFloatNullable expression that has the value returned by the specified mapper function if the value for this field is not null, and otherwise null.
      Parameters:
      mapper - the mapper operation
      Returns:
      expression for this value after mapper has been applied
      Since:
      3.1.0
    • asFloat

      default com.speedment.runtime.compute.ToFloatNullable<ENTITY> asFloat()
      Returns an ToFloatNullable expression that has the value of this field, casted to a float by first casting it to Number and then invoking Number.floatValue().
      Returns:
      expression for this value after mapper has been applied
      Since:
      3.1.0
    • mapToDoubleIfPresent

      default com.speedment.runtime.compute.ToDoubleNullable<ENTITY> mapToDoubleIfPresent(ToDoubleFunction<V> mapper)
      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,V>
      Parameters:
      mapper - the mapper operation
      Returns:
      expression for this value after mapper has been applied
      Since:
      3.1.0
    • asDouble

      default com.speedment.runtime.compute.ToDoubleNullable<ENTITY> asDouble()
      Returns an ToDoubleNullable expression that has the value of this field, casted to a double by first casting it to Number and then invoking Number.doubleValue().
      Returns:
      expression for this value after mapper has been applied
      Since:
      3.1.0
    • mapToCharIfPresent

      default com.speedment.runtime.compute.ToCharNullable<ENTITY> mapToCharIfPresent(com.speedment.common.function.ToCharFunction<V> mapper)
      Returns an ToCharNullable expression that has the value returned by the specified mapper function if the value for this field is not null, and otherwise null.
      Parameters:
      mapper - the mapper operation
      Returns:
      expression for this value after mapper has been applied
      Since:
      3.1.0
    • asChar

      default com.speedment.runtime.compute.ToCharNullable<ENTITY> asChar()
      Returns an ToCharNullable expression that has the value of this field, casted to a char by first casting it to Number and then invoking Number.intValue() and casting it to a char.
      Returns:
      expression for this value after mapper has been applied
      Since:
      3.1.0
    • mapToBooleanIfPresent

      default com.speedment.runtime.compute.ToBooleanNullable<ENTITY> mapToBooleanIfPresent(com.speedment.common.function.ToBooleanFunction<V> mapper)
      Returns an ToBooleanNullable expression that has the value returned by the specified mapper function if the value for this field is not null, and otherwise null.
      Parameters:
      mapper - the mapper operation
      Returns:
      expression for this value after mapper has been applied
      Since:
      3.1.0
    • asBoolean

      default com.speedment.runtime.compute.ToBooleanNullable<ENTITY> asBoolean()
      Returns an ToBooleanNullable expression that has the value of this field, casted to a boolean by first casting it to Boolean.
      Returns:
      expression for this value after mapper has been applied
      Since:
      3.1.0
    • mapToStringIfPresent

      default com.speedment.runtime.compute.ToStringNullable<ENTITY> mapToStringIfPresent(Function<V,String> mapper)
      Returns an ToStringNullable expression that has the value returned by the specified mapper function if the value for this field is not null, and otherwise null.
      Parameters:
      mapper - the mapper operation
      Returns:
      expression for this value after mapper has been applied
      Since:
      3.1.0
    • asString

      default com.speedment.runtime.compute.ToStringNullable<ENTITY> asString()
      Returns an ToBooleanNullable expression that has the value of this field, casted to a boolean by first casting it to Boolean.
      Returns:
      expression for this value after mapper has been applied
      Since:
      3.1.0
    • mapToBigDecimalIfPresent

      default com.speedment.runtime.compute.ToBigDecimalNullable<ENTITY> mapToBigDecimalIfPresent(Function<V,BigDecimal> mapper)
      Returns an ToStringNullable expression that has the value returned by the specified mapper function if the value for this field is not null, and otherwise null.
      Parameters:
      mapper - the mapper operation
      Returns:
      expression for this value after mapper has been applied
      Since:
      3.1.0
    • asBigDecimal

      default com.speedment.runtime.compute.ToBigDecimalNullable<ENTITY> asBigDecimal()
      Returns an ToBigDecimalNullable expression that has the value of this field but casted to a BigDecimal.
      Returns:
      expression for this value after mapper has been applied
      Since:
      3.1.0
    • mapToEnumIfPresent

      default <E extends Enum<E>> com.speedment.runtime.compute.ToEnumNullable<ENTITY,E> mapToEnumIfPresent(Function<V,E> mapper, Class<E> enumClass)
      Returns an ToEnumNullable expression that has the value returned by the specified mapper function if the value for this field is not null, and otherwise null.
      Type Parameters:
      E - the enum type
      Parameters:
      mapper - the mapper operation
      enumClass - class of the enum to map to
      Returns:
      expression for this value after mapper has been applied
      Since:
      3.1.0
    • asEnum

      default <E extends Enum<E>> com.speedment.runtime.compute.ToEnumNullable<ENTITY,E> asEnum(Class<E> enumClass)
      Returns an ToBooleanNullable expression that has the value of this field, casted to a particular enum class.
      Type Parameters:
      E - the enum type
      Parameters:
      enumClass - class of the enum to map to
      Returns:
      expression for this value after mapper has been applied
      Since:
      3.1.0