Package cronapi

Class Var

  • All Implemented Interfaces:
    com.fasterxml.jackson.databind.JsonSerializable, cronapi.Variable, Comparable<Var>, org.apache.olingo.odata2.core.ep.producer.OlingoJsonSerializer, org.apache.olingo.odata2.jpa.processor.core.access.data.VirtualClassInterface

    public class Var
    extends Object
    implements Comparable<Var>, com.fasterxml.jackson.databind.JsonSerializable, org.apache.olingo.odata2.core.ep.producer.OlingoJsonSerializer, org.apache.olingo.odata2.jpa.processor.core.access.data.VirtualClassInterface, cronapi.Variable
    • Field Detail

      • ISO_PATTERN

        public static final Pattern ISO_PATTERN
      • EMPTY_OBJ_ARRAY

        public static final Object[] EMPTY_OBJ_ARRAY
      • VAR_NULL

        public static final Var VAR_NULL
      • VAR_TRUE

        public static final Var VAR_TRUE
      • VAR_FALSE

        public static final Var VAR_FALSE
      • VAR_ZERO

        public static final Var VAR_ZERO
      • VAR_ONE

        public static final Var VAR_ONE
      • VAR_NEGATIVE_ONE

        public static final Var VAR_NEGATIVE_ONE
      • VAR_EMPTY

        public static final Var VAR_EMPTY
      • VAR_DATE_ZERO

        public static final Var VAR_DATE_ZERO
      • ALLOWED_TYPES

        public static String[] ALLOWED_TYPES
      • MAPPED_TYPES

        public static Class[] MAPPED_TYPES
    • Constructor Detail

      • Var

        public Var()
        Construct a Var with an NULL type
      • Var

        public Var​(String id,
                   Object object)
        Construct a Var and assign its contained object to that specified.
        Parameters:
        object - The value to set this object to
      • Var

        public Var​(Object object)
        Construct a Var and assign its contained object to that specified.
        Parameters:
        object - The value to set this object to
      • Var

        public Var​(Object object,
                   boolean modifiable)
      • Var

        public Var​(Var var)
        Construct a Var from a given Var
        Parameters:
        var - var to construct this one from
    • Method Detail

      • serializeAsJson

        public String serializeAsJson()
        Specified by:
        serializeAsJson in interface org.apache.olingo.odata2.core.ep.producer.OlingoJsonSerializer
      • get

        public Object get​(String name)
        Specified by:
        get in interface org.apache.olingo.odata2.jpa.processor.core.access.data.VirtualClassInterface
      • containsKey

        public boolean containsKey​(String name)
        Specified by:
        containsKey in interface org.apache.olingo.odata2.jpa.processor.core.access.data.VirtualClassInterface
      • set

        public org.apache.olingo.odata2.jpa.processor.core.access.data.VirtualClassInterface set​(String name,
                                                                                                 Object value)
        Specified by:
        set in interface org.apache.olingo.odata2.jpa.processor.core.access.data.VirtualClassInterface
      • isString

        public boolean isString()
        Specified by:
        isString in interface cronapi.Variable
      • isNumber

        public boolean isNumber()
      • isBoolean

        public boolean isBoolean()
      • main

        public static void main​(String[] args)
      • eval

        public static Var eval​(String val)
      • valueOf

        public static Var valueOf​(Object val)
        Static constructor to make a var from some value.
        Parameters:
        val - some value to construct a var around
        Returns:
        the Var object
      • deserializeType

        public static String deserializeType​(String value)
      • getType

        public static Class getType​(String key)
      • deserialize

        public static Object deserialize​(String value)
      • newMap

        public static Var newMap()
      • newList

        public static Var newList()
      • asObjectArray

        public static Object[] asObjectArray​(Var[] vars)
      • getType

        public Var.Type getType()
        Get the type of the underlying object
        Returns:
        Will return the object's type as defined by Type
      • getId

        public String getId()
      • setId

        public void setId​(String id)
      • getObjectAsDataSource

        public DataSource getObjectAsDataSource()
        Get the contained datasource
        Returns:
        the object
      • getObject

        public Object getObject()
        Specified by:
        getObject in interface org.apache.olingo.odata2.jpa.processor.core.access.data.VirtualClassInterface
      • setObject

        public void setObject​(Object val)
        Set the value of the underlying object. Note that the type of Var will be determined when setObject is called.
        Parameters:
        val - the value to set this Var to
      • getTypedObject

        public <T> T getTypedObject​(Class<T> type)
        Specified by:
        getTypedObject in interface cronapi.Variable
      • cloneObject

        public Object cloneObject()
        Clone Object
        Returns:
        a new object equal to this one
      • getObjectAsInt

        public Integer getObjectAsInt()
        Get object as an int. Does not make sense for a "LIST" type object
        Specified by:
        getObjectAsInt in interface cronapi.Variable
        Returns:
        an integer whose value equals this object
      • getObjectAsLong

        public Long getObjectAsLong()
        Get object as an int. Does not make sense for a "LIST" type object
        Returns:
        an integer whose value equals this object
      • getObjectAsShort

        public Short getObjectAsShort()
      • getObjectAsFile

        public File getObjectAsFile()
      • getObjectAsJsonElement

        public com.google.gson.JsonElement getObjectAsJsonElement()
      • getObjectAsJson

        public com.google.gson.JsonElement getObjectAsJson()
      • getObjectAsDateTime

        public Calendar getObjectAsDateTime()
        Get object as an boolean.
        Returns:
        an bool whose value equals this object
      • getObjectAsBoolean

        public Boolean getObjectAsBoolean()
        Get object as an boolean.
        Returns:
        an bool whose value equals this object
      • getMD5

        public String getMD5()
      • getObjectAsDouble

        public Double getObjectAsDouble()
        Get object as a double. Does not make sense for a "LIST" type object.
        Specified by:
        getObjectAsDouble in interface cronapi.Variable
        Returns:
        a double whose value equals this object
      • getObjectAsByteArray

        public byte[] getObjectAsByteArray()
        Get object as a byte array. Does not make sense for a "LIST" type object.
        Returns:
        a byte array whose value equals this object
      • getObjectAsString

        public String getObjectAsString()
        Get object as a string.
        Specified by:
        getObjectAsString in interface cronapi.Variable
        Returns:
        The string value of the object. Note that for lists, this is a comma separated list of the form {x,y,z,...}
      • getObjectAsRawList

        public Collection getObjectAsRawList​(Class clazz)
      • getObjectAsVarList

        public Collection getObjectAsVarList​(Class clazz)
      • getObjectAsList

        public List getObjectAsList()
        Get the object as a list.
        Specified by:
        getObjectAsList in interface cronapi.Variable
        Returns:
        a LinkedList whose elements are of type Var
      • getObjectAsMap

        public Map getObjectAsMap()
      • getObjectAsPOJOList

        public Var getObjectAsPOJOList()
      • isNative

        public boolean isNative()
      • getPOJO

        public Var getPOJO()
      • get

        public Var get​(int index)
        If this object is a linked list, then calling this method will return the Var at the index indicated
        Parameters:
        index - the index of the Var to read (0 based)
        Returns:
        the Var at that index
      • size

        public int size()
        If this object is a linked list, then calling this method will return the size of the linked list.
        Returns:
        size of list
      • length

        public int length()
      • trim

        public void trim()
      • set

        public void set​(int index,
                        Var var)
        Set the value of of a list at the index specified. Note that this is only value if this object is a list and also note that index must be in bounds.
        Parameters:
        index - the index into which the Var will be inserted
        var - the var to insert
      • addAll

        public void addAll​(Var var)
        Add all values from one List to another. Both lists are Var objects that contain linked lists.
        Parameters:
        var - The list to add
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public boolean equals​(Object obj)
        Test to see if this object equals another one. This is done by converting both objects to strings and then doing a string compare.
        Overrides:
        equals in class Object
        Returns:
        true if equals
      • inc

        public void inc​(Object value)
      • multiply

        public void multiply​(Object value)
      • append

        public Var append​(Object value)
      • lessThan

        public boolean lessThan​(Var var)
        Check to see if this Var is less than some other var.
        Parameters:
        var - the var to compare to
        Returns:
        true if it is less than
      • lessThanOrEqual

        public boolean lessThanOrEqual​(Var var)
        Check to see if this var is less than or equal to some other var
        Parameters:
        var - the var to compare to
        Returns:
        true if this is less than or equal to var
      • greaterThan

        public boolean greaterThan​(Var var)
        Check to see if this var is greater than a given var.
        Parameters:
        var - the var to compare to.
        Returns:
        true if this object is grater than the given var
      • greaterThanOrEqual

        public boolean greaterThanOrEqual​(Var var)
        Check to see if this var is greater than or equal to a given var
        Parameters:
        var - the var to compare to
        Returns:
        true if this var is greater than or equal to the given var
      • compareTo

        public int compareTo​(Var var)
        Compare this object's value to another
        Specified by:
        compareTo in interface Comparable<Var>
        Parameters:
        var - the object to compare to
        Returns:
        the value 0 if this is equal to the argument; a value less than 0 if this is numerically less than the argument; and a value greater than 0 if this is numerically greater than the argument (signed comparison).
      • toString

        public String toString()
        Convert this Var to a string format.
        Overrides:
        toString in class Object
        Returns:
        the string format of this var
      • negate

        public Var negate()
      • serialize

        public void serialize​(com.fasterxml.jackson.core.JsonGenerator gen,
                              com.fasterxml.jackson.databind.SerializerProvider serializers)
                       throws IOException
        Specified by:
        serialize in interface com.fasterxml.jackson.databind.JsonSerializable
        Throws:
        IOException
      • serializeWithType

        public void serializeWithType​(com.fasterxml.jackson.core.JsonGenerator gen,
                                      com.fasterxml.jackson.databind.SerializerProvider serializers,
                                      com.fasterxml.jackson.databind.jsontype.TypeSerializer typeSer)
                               throws IOException
        Specified by:
        serializeWithType in interface com.fasterxml.jackson.databind.JsonSerializable
        Throws:
        IOException
      • getField

        public Var getField​(String field)
      • getStringField

        public String getStringField​(String field)
      • setField

        public void setField​(String field,
                             Object value)
      • updateWith

        public void updateWith​(Object obj)
      • isNull

        public Boolean isNull()
        Specified by:
        isNull in interface cronapi.Variable
      • isEmpty

        public Boolean isEmpty()
      • isEmptyOrNull

        public Boolean isEmptyOrNull()