Class ColorField

All Implemented Interfaces:
Copyable, ColorFunction, Settable<Color>, Serializable

public final class ColorField extends Pattern implements Settable<Color>, Copyable, ColorFunction
See Also:
  • Constructor Details

    • ColorField

      public ColorField()
  • Method Details

    • copy

      public ColorField copy(CopyMapper mapper)
      Specified by:
      copy in interface Copyable
    • toFinal

      public ColorField toFinal()
    • optional

      public ColorField optional()
    • defaultTo

      public ColorField defaultTo(Color defaultConstant)
    • allowAlpha

      public ColorField allowAlpha()
      See Also:
    • isInitial

      public boolean isInitial()
      Description copied from interface: Settable
      Returns true, if a value for the settable should be specified on the creation of an item.
      Specified by:
      isInitial in interface Settable<Color>
    • isFinal

      public boolean isFinal()
      Description copied from interface: Settable
      Returns true, if a value for the settable can be specified on the creation of an item only, thus cannot be modified later.
      Specified by:
      isFinal in interface Settable<Color>
    • isMandatory

      public boolean isMandatory()
      Specified by:
      isMandatory in interface Settable<Color>
    • getInitialType

      public Class<?> getInitialType()
      Specified by:
      getInitialType in interface Settable<Color>
    • isAlphaAllowed

      public boolean isAlphaAllowed()
      If this method returns false, this ColorField allows opaque colors only. This means, the alpha value must be 255. If this method returns true, this ColorField allows any colors with any alpha value.
    • getDefaultConstant

      public Color getDefaultConstant()
    • getRGB

      public IntegerField getRGB()
      Returns the field containing almost the result of Color.getRGB() of the persisted color. The difference is as follows:

      For Color.getRGB() an alpha value of 255 means that the color is completely opaque and an alpha value of 0 means that the color is completely transparent.

      Values of the IntegerField returned by this method do have the reverse meaning: An alpha value of 255 means that the color is completely transparent and an alpha value of 0 means that the color is completely opaque.

      This transformation ensures, that the persistent value of any opaque Color does not depend on whether the ColorField allows alpha or not.

    • getInitialExceptions

      public Set<Class<? extends Throwable>> getInitialExceptions()
      Description copied from interface: Settable
      Returns the exceptions possibly thrown, when setting a value for this settable.
      Specified by:
      getInitialExceptions in interface Settable<Color>
    • get

      public Color get(@Nonnull Item item)
    • set

      public void set(@Nonnull Item item, Color value)
    • execute

      public SetValue<?>[] execute(Color value, Item exceptionItem)
      Specified by:
      execute in interface Settable<Color>
    • toRGB

      public static int toRGB(Color color)
      Returns the value for field getRGB() representing the given color.
    • fromRGB

      public static Color fromRGB(int rgb)
      Converts a value for field getRGB() into a color.
    • bind

      public ColorFunction bind(Join join)
    • isNull

      public IsNullCondition<?> isNull()
      Specified by:
      isNull in interface ColorFunction
    • isNotNull

      public IsNullCondition<?> isNotNull()
      Specified by:
      isNotNull in interface ColorFunction
    • equal

      public Condition equal(Color value)
      Specified by:
      equal in interface ColorFunction
    • notEqual

      public Condition notEqual(Color value)
      NOT EQUAL Condition. Note: according to SQL, a NULL value is evaluated to unknown, so a NOT EQUAL using a non null RHS is false for null values
      Specified by:
      notEqual in interface ColorFunction
    • isOpaque

      public Condition isOpaque()
    • isNotOpaque

      public Condition isNotOpaque()