Enum Class ValueType

java.lang.Object
java.lang.Enum<ValueType>
ru.sergkorot.dynamic.model.enums.ValueType
All Implemented Interfaces:
Serializable, Comparable<ValueType>, Constable

public enum ValueType extends Enum<ValueType>
Author:
Sergey Korotaev Enum which has types for casts When an object comes in a request, its type is determined and the collection or the object itself is cast into its type for searching
  • Enum Constant Details

    • STRING_VARIABLE

      public static final ValueType STRING_VARIABLE
      Element of enum for casting object to the string type
    • LONG_VARIABLE

      public static final ValueType LONG_VARIABLE
      Element of enum for casting object to the long type
    • DOUBLE_VARIABLE

      public static final ValueType DOUBLE_VARIABLE
      Element of enum for casting object to the double type
    • BOOLEAN_VARIABLE

      public static final ValueType BOOLEAN_VARIABLE
      Element of enum for casting object to the boolean type
    • DATETIME_VARIABLE

      public static final ValueType DATETIME_VARIABLE
      Element of enum for casting object to the instant type
  • Method Details

    • values

      public static ValueType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ValueType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • checkValueType

      public abstract <U> Boolean checkValueType(U u)
      Method that checks the type of the incoming object for further filtering by condition
      Type Parameters:
      U - - generic by incoming object
      Parameters:
      u - - an object whose type is determined for further insertion
      Returns:
      - true/false depending on the condition
    • castCollection

      public abstract Collection<?> castCollection(Object obj)
      Method that casts the entire collection to the desired type
      Parameters:
      obj - - an object, which is then parsed into a collection of the desired type
      Returns:
      - collection of the desired type
    • simpleCast

      public abstract Object simpleCast(Object obj)
      Method that casts an object to the desired type
      Parameters:
      obj - - object, which is then cast to the desired type
      Returns:
      - Object of the desired type
    • cast

      public static Object cast(Object value)
      Static method that is called on an object to determine its type and cast to the appropriate type
      Parameters:
      value - - incoming object
      Returns:
      - Object of the desired type
    • collectionCast

      public static Collection<?> collectionCast(Object value)
      A static method that is called on a collection to determining the types of elements in the collection and casting the collection to the appropriate type
      Parameters:
      value - - incoming collection as an object
      Returns:
      - collection of the desired type