Class Val

    • Field Detail

      • FALSE

        public static final Val FALSE
        False value
      • NULL

        public static final Val NULL
        Null value
      • TRUE

        public static final Val TRUE
        True value
    • Constructor Detail

      • Val

        protected Val​(Object toConvert)
        Default Constructor
        Parameters:
        toConvert - The object to convert
    • Method Detail

      • of

        public static Val of​(Object o)
        Convenience method for creating a Convertible Object
        Parameters:
        o - The object to convert
        Returns:
        The ConvertibleObject wrapping the given object
      • as

        public <T> T as​(Type type)
        As t.
        Type Parameters:
        T - the type parameter
        Parameters:
        type - the type
        Returns:
        the t
      • as

        public <T> T as​(Type type,
                        T defaultValue)
        As t.
        Type Parameters:
        T - the type parameter
        Parameters:
        type - the type
        defaultValue - the default value
        Returns:
        the t
      • as

        public <T> T as​(Class<T> clazz)
        Converts the underlying object to the given class type.
        Type Parameters:
        T - the type parameter
        Parameters:
        clazz - The class to convert to
        Returns:
        This object as the given type or null if the wrapped object is null
      • as

        public <T> T as​(Class<T> clazz,
                        T defaultValue)
        Converts the underlying object to the given class type.
        Type Parameters:
        T - the type parameter
        Parameters:
        clazz - The class to convert to
        defaultValue - The value to return if the wrapped value is null or cannot be converted
        Returns:
        This object as the given type or null if the wrapped object is null
      • asArray

        public <T> T[] asArray​(Type componentType)
        As array t [ ].
        Type Parameters:
        T - the type parameter
        Parameters:
        componentType - the component type
        Returns:
        the t [ ]
      • asArray

        public <T> T[] asArray​(Class<T> clazz)
        Converts an object into an array of objects
        Type Parameters:
        T - the type parameter
        Parameters:
        clazz - The type of the object to create.
        Returns:
        An array of the object
      • asBoolean

        public Boolean asBoolean()
        As boolean.
        Returns:
        the object as a Boolean.
      • asBoolean

        public Boolean asBoolean​(Boolean defaultValue)
        As boolean.
        Parameters:
        defaultValue - the default value
        Returns:
        the object as a Boolean.
      • asBooleanArray

        public Boolean[] asBooleanArray()
        As boolean array.
        Returns:
        the object as a Boolean array.
      • asBooleanValue

        public boolean asBooleanValue()
        As boolean value.
        Returns:
        the object as a boolean.
      • asBooleanValue

        public boolean asBooleanValue​(boolean defaultValue)
        As boolean value.
        Parameters:
        defaultValue - the default value
        Returns:
        the object as a boolean.
      • asBooleanValueArray

        public boolean[] asBooleanValueArray()
        As boolean value array.
        Returns:
        the object as a boolean array.
      • asByte

        public Byte asByte()
        As byte.
        Returns:
        the object as a Byte.
      • asByte

        public Byte asByte​(Byte defaultValue)
        As byte.
        Parameters:
        defaultValue - the default value
        Returns:
        the object as a Byte.
      • asByteArray

        public Byte[] asByteArray()
        As byte array.
        Returns:
        the object as a Byte array.
      • asByteValue

        public byte asByteValue()
        As byte value.
        Returns:
        the object as a byte.
      • asByteValue

        public byte asByteValue​(byte defaultValue)
        As byte value.
        Parameters:
        defaultValue - the default value
        Returns:
        the object as a byte.
      • asByteValueArray

        public byte[] asByteValueArray()
        As byte value array.
        Returns:
        the object as a byte array.
      • asCharacter

        public Character asCharacter()
        As character.
        Returns:
        The object as a Character
      • asCharacter

        public Character asCharacter​(Character defaultValue)
        As character.
        Parameters:
        defaultValue - The default value
        Returns:
        The object as a char
      • asCharacterArray

        public Character[] asCharacterArray()
        As character array.
        Returns:
        The object as a Character array
      • asCharacterValue

        public char asCharacterValue()
        As character value.
        Returns:
        The object as a char
      • asCharacterValue

        public char asCharacterValue​(char defaultValue)
        As character value.
        Parameters:
        defaultValue - The default value
        Returns:
        The object as a char
      • asCharacterValueArray

        public char[] asCharacterValueArray()
        As character value array.
        Returns:
        The object as a char array
      • asClass

        public Class<?> asClass()
        As class.
        Returns:
        the object as a class
      • asClass

        public <T> Class<T> asClass​(Class<T> defaultValue)
        As class.
        Type Parameters:
        T - the type parameter
        Parameters:
        defaultValue - the default value
        Returns:
        The object as a class
      • asDouble

        public Double asDouble()
        As double.
        Returns:
        The object as a Double
      • asDouble

        public Double asDouble​(Double defaultValue)
        As double.
        Parameters:
        defaultValue - The default value
        Returns:
        The object as a double
      • asDoubleArray

        public Double[] asDoubleArray()
        As double array.
        Returns:
        The object as a Double array
      • asDoubleValue

        public double asDoubleValue()
        As double value.
        Returns:
        The object as a double
      • asDoubleValue

        public double asDoubleValue​(double defaultValue)
        As double value.
        Parameters:
        defaultValue - The default value
        Returns:
        The object as a double
      • asDoubleValueArray

        public double[] asDoubleValueArray()
        As double value array.
        Returns:
        The object as a double array
      • asFloat

        public Float asFloat()
        As float.
        Returns:
        The object as a Float
      • asFloat

        public Float asFloat​(Float defaultValue)
        As float.
        Parameters:
        defaultValue - The default value
        Returns:
        The object as a float
      • asFloatArray

        public Float[] asFloatArray()
        As float array.
        Returns:
        The object as a Float array
      • asFloatValue

        public float asFloatValue()
        As float value.
        Returns:
        The object as a float
      • asFloatValue

        public float asFloatValue​(float defaultValue)
        As float value.
        Parameters:
        defaultValue - The default value
        Returns:
        The object as a float
      • asFloatValueArray

        public float[] asFloatValueArray()
        As float value array.
        Returns:
        The object as a float array
      • asInteger

        public Integer asInteger()
        As integer.
        Returns:
        The object as a Integer
      • asInteger

        public Integer asInteger​(Integer defaultValue)
        As integer.
        Parameters:
        defaultValue - The default value
        Returns:
        The object as a int
      • asIntegerArray

        public Integer[] asIntegerArray()
        As integer array.
        Returns:
        The object as a Integer array
      • asIntegerValue

        public int asIntegerValue()
        As integer value.
        Returns:
        The object as a int
      • asIntegerValue

        public int asIntegerValue​(int defaultValue)
        As integer value.
        Parameters:
        defaultValue - The default value
        Returns:
        The object as a int
      • asIntegerValueArray

        public int[] asIntegerValueArray()
        As integer value array.
        Returns:
        The object as a int array
      • asList

        public <T> List<T> asList​(Class<T> itemType)
        Converts the object to a List
        Type Parameters:
        T - the type parameter
        Parameters:
        itemType - The class of the item in the List
        Returns:
        The object as a List
      • asList

        public <T> List<T> asList​(Type itemType)
      • asLong

        public Long asLong()
        As long.
        Returns:
        The object as a Long
      • asLong

        public Long asLong​(Long defaultValue)
        As long.
        Parameters:
        defaultValue - The default value
        Returns:
        The object as a long
      • asLongArray

        public Long[] asLongArray()
        As long array.
        Returns:
        The object as a Long array
      • asLongValue

        public long asLongValue()
        As long value.
        Returns:
        The object as a long
      • asLongValue

        public long asLongValue​(long defaultValue)
        As long value.
        Parameters:
        defaultValue - The default value
        Returns:
        The object as a long
      • asLongValueArray

        public long[] asLongValueArray()
        As long value array.
        Returns:
        The object as a long array
      • asMap

        public <K,​V> Map<K,​V> asMap​(Class<K> keyClass,
                                                Class<V> valueClass)
        Converts the object to a map
        Type Parameters:
        K - the type parameter
        V - the type parameter
        Parameters:
        keyClass - The key class
        valueClass - The value class
        Returns:
        the object as a map
      • asResource

        public Resource asResource()
        Converts the object to resource
        Returns:
        The object as a Resource
      • asResource

        public Resource asResource​(Resource defaultResource)
        Converts the object to resource with a given default if the conversion results in a null value.
        Parameters:
        defaultResource - The default value when conversion results in null
        Returns:
        The value as a resource or defaultResource if null
      • asSet

        public <T> Set<T> asSet​(Class<T> itemType)
        Converts the object to a Set
        Type Parameters:
        T - the type parameter
        Parameters:
        itemType - The class of the item in the Set
        Returns:
        The object as a Set
      • asSet

        public <T> Set<T> asSet​(Type itemType)
      • asShort

        public Short asShort()
        As short.
        Returns:
        The object as a Short
      • asShort

        public Short asShort​(Short defaultValue)
        As short.
        Parameters:
        defaultValue - The default value
        Returns:
        The object as a short
      • asShortArray

        public Short[] asShortArray()
        As short array.
        Returns:
        The object as a Short array
      • asShortValue

        public short asShortValue()
        As short value.
        Returns:
        The object as a short
      • asShortValue

        public short asShortValue​(short defaultValue)
        As short value.
        Parameters:
        defaultValue - The default value
        Returns:
        The object as a short
      • asShortValueArray

        public short[] asShortValueArray()
        As short value array.
        Returns:
        The object as a short array
      • asString

        public String asString()
        As string.
        Returns:
        the object as a string
      • asString

        public String asString​(String defaultValue)
        As string.
        Parameters:
        defaultValue - The default value
        Returns:
        the object as a string
      • cast

        public <T> T cast()
        Casts the object
        Type Parameters:
        T - the type of the class
        Returns:
        the object cast as the class type
      • get

        public Object get()
        Get object.
        Returns:
        The wrapped object
      • getWrappedClass

        public Class<?> getWrappedClass()
        Get wrapped class.
        Returns:
        the class
      • isArray

        public boolean isArray()
        Determines if the wrapped object is an array
        Returns:
        True if it the wrapped object is an array
      • isCollection

        public boolean isCollection()
        Determines if the wrapped object is a Collection
        Returns:
        True if it the wrapped object is a Collection
      • isIterable

        public boolean isIterable()
        Determines if the wrapped object is an Iterable
        Returns:
        True if it the wrapped object is an Iterable
      • isIterator

        public boolean isIterator()
        Determines if the wrapped object is an Iterator
        Returns:
        True if it the wrapped object is an Iterator
      • isMap

        public boolean isMap()
        Determines if the wrapped object is a Map
        Returns:
        True if it the wrapped object is a Map
      • isNull

        public boolean isNull()
        Is null.
        Returns:
        True if the object to convert is null
      • isPrimitiveArray

        public boolean isPrimitiveArray()
        Determines if the wrapped object is a primitive array
        Returns:
        True if it the wrapped object is a primitive array