Package com.adobe.xfa

Class Arg


  • public final class Arg
    extends java.lang.Object
    This class represents an argument to a function or a return value. Instances of this class are primarily for use in scripting environments.
    • Constructor Summary

      Constructors 
      Constructor Description
      Arg()
      Instantiates an empty arg object.
      Arg​(Arg src)
      Instantiates a copy of the given arg object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void assign​(Arg src)
      Assigns the given arg object to this arg.
      void empty()
      Set this argument to be empty
      boolean equals​(java.lang.Object object)
      Comparison operator -- equality
      int getArgType()
      Return the argument type
      java.lang.Boolean getAsBool​(boolean bThrowException)
      Get the value as a boolean.
      java.lang.String getAsString​(boolean bThrowException)
      Get the value in the form of a string.
      java.lang.Boolean getBool()
      Return the boolean value held by this argument
      java.lang.Double getDouble​(boolean bStrongTyping)
      Return the double value held by this argument
      ExFull getException()
      Return the exception held by this argument.
      java.lang.Integer getInteger()
      Return the integer held by this argument
      Obj getObject()
      Return the object held by this argument.
      java.lang.String getString()
      Return the string value held by this argument
      java.lang.Object getVoid​(boolean bThrowException)
      Return the data object held by this argument.
      int hashCode()
      Returns a hash code value for the object.
      boolean isCompatibleWith​(int eType)
      Return the this Arg is compatible with a given type
      boolean isEmpty()
      Find out if this argument is empty
      boolean isRefObject()
      Is the current Object a reference/pointer to another Object.
      boolean isXFAProperty()
      Is the current Object resolved through property.
      void setBool​(java.lang.Boolean b)
      Assign this argument to a boolean
      void setDouble​(java.lang.Double d)
      Assign this argument to a double
      void setException​(ExFull ex)
      Assign this argument to an exception (representing an error)
      void setInteger​(java.lang.Integer i)
      Assign this argument to an integer
      void setNull()
      Set this argument to be NULL
      void setObject​(Obj obj)
      Assign this argument to a given XFA object
      void setObject​(Obj obj, boolean bIsRef)
      Assign this argument to a given XFA object
      void setObject​(Obj obj, boolean bIsRef, boolean bIsProp)
      Assign this argument to a given XFA object
      void setString​(java.lang.String s)
      Assign this argument to a string
      void setVoid​(java.lang.Object oData)
      Assign this argument to a data object..
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Arg

        public Arg()
        Instantiates an empty arg object.
      • Arg

        public Arg​(Arg src)
        Instantiates a copy of the given arg object.
        Parameters:
        src - The Arg to be copied.
    • Method Detail

      • assign

        public void assign​(Arg src)
        Assigns the given arg object to this arg. This is the assignment operator.
      • empty

        public void empty()
        Set this argument to be empty
      • equals

        public boolean equals​(java.lang.Object object)
        Comparison operator -- equality
        Overrides:
        equals in class java.lang.Object
        Parameters:
        object - the object to compare
        Returns:
        true if this object equals the given.
      • hashCode

        public int hashCode()
        Returns a hash code value for the object. This method is unsupported.
        Overrides:
        hashCode in class java.lang.Object
      • getArgType

        public int getArgType()
        Return the argument type
        Returns:
        our argument type as an XFAArgType
      • getAsBool

        public java.lang.Boolean getAsBool​(boolean bThrowException)
        Get the value as a boolean. This involves interpreting the various types as described below.

        This is a convenience function. It checks the current type of this Arg, and returns a boolean value which best represents the current value according to the following criteria:
         
               Current Type:    Returned Value:
               EMPTY            FALSE
               NULL             FALSE
               BOOL,            result of getBool()
               INTEGER,         TRUE if non-zero, FALSE otherwise
               DOUBLE,          TRUE if non-zero, FALSE otherwise
               STRING,          TRUE if string represents a non-zero number, FALSE otherwise
               OBJECT,          TRUE if object is non-NULL, FALSE otherwise
               EXCEPTION        FALSE
          
         
        The parameter bThrowException only affects the behaviour if the current value of this Arg is of type EXCEPTION. If bThrowException is FALSE, then this routine will simply return FALSE. If bThrowException is TRUE, then an exception will be thrown which contains the error message of the exception. This can simplify processing for an application.
        Parameters:
        bThrowException - when type is EXCEPTION; if TRUE: throws an exception, if FALSE: returns FALSE
        Returns:
        the value of this Arg as a boolean
        Throws:
        the - stored exception if bThrowException is TRUE and the current value is an exception
      • getAsString

        public java.lang.String getAsString​(boolean bThrowException)
        Get the value in the form of a string.

        This is a convenience function. It checks the current type of this Arg, and returns a string which represents the current value according to the following examples:

         
               Current Type:    Returned String (example):
               EMPTY            "Empty"
               NULL             "Null"
               BOOL,            "True" or "False"
               INTEGER,         "123"
               DOUBLE,          "123.45"
               STRING,          (the same string)
               OBJECT,          "Object45" (i.e. "Object" with the ID value)
               EXCEPTION        "Error: " + error message
          
         
        The parameter bThrowException only affects the behaviour if the current value of this Arg is of type EXCEPTION. If bThrowException is FALSE, then this routine will simply return a string representing the exception. If bThrowException is TRUE, then an exception will be thrown which contains the error message of the exception. This can simplify processing for an application.
        Parameters:
        bThrowException - when type is EXCEPTION; if TRUE: throws an exception, if FALSE: returns an error message
        Returns:
        the value of this Arg in the form of a string
        Throws:
        the - stored exception if bThrowException is TRUE and the current value is an exception
      • getBool

        public java.lang.Boolean getBool()
        Return the boolean value held by this argument
        Returns:
        Our boolean value
        Throws:
        ArgumentMismatchException - if the current type is not BOOL
      • getDouble

        public java.lang.Double getDouble​(boolean bStrongTyping)
        Return the double value held by this argument
        Parameters:
        bStrongTyping - apply strong typing when set.
        Returns:
        our double value
        Throws:
        ArgumentMismatchException - if the current type is not DOUBLE or INTEGER. If the current type is INTEGER, the value is automatically converted to a double.
      • getException

        public ExFull getException()
        Return the exception held by this argument.
        Returns:
        the current exception
        Throws:
        ArgumentMismatchException - if the current type is not EXCEPTION
      • getInteger

        public java.lang.Integer getInteger()
        Return the integer held by this argument
        Returns:
        our integer value.
        Throws:
        ArgumentMismatchException - if the current type is cannot be converted to an integer. If the current type is INTEGER, the integer value is returned. If the current type is DOUBLE and the double value has no fractional part, then the double value is returned as an integer. If the double value has a fractional part, ArgumentMismatchException is thrown.
      • getObject

        public Obj getObject()
        Return the object held by this argument.
        Returns:
        the current Obj
        Throws:
        ArgumentMismatchException - if the current type is not OBJECT
      • getString

        public java.lang.String getString()
        Return the string value held by this argument
        Returns:
        our string value
        Throws:
        ArgumentMismatchException - if the current type is not STRING
      • getVoid

        public java.lang.Object getVoid​(boolean bThrowException)
        Return the data object held by this argument.
        Returns:
        the data object.
        Throws:
        ExFull - ArgumentMismatchException - if the current type is not EXCEPTION
      • isCompatibleWith

        public boolean isCompatibleWith​(int eType)
        Return the this Arg is compatible with a given type
        Parameters:
        eType - the argument type use in the comparison
        Returns:
        true if compatible else false
      • isEmpty

        public boolean isEmpty()
        Find out if this argument is empty
        Returns:
        TRUE if the argument is empty, FALSE otherwise
      • setBool

        public void setBool​(java.lang.Boolean b)
        Assign this argument to a boolean
        Parameters:
        b - the boolean value to take on
      • setDouble

        public void setDouble​(java.lang.Double d)
        Assign this argument to a double
        Parameters:
        d - the double value to take on
      • setException

        public void setException​(ExFull ex)
        Assign this argument to an exception (representing an error)
        Parameters:
        ex - The exception to hold.
      • setInteger

        public void setInteger​(java.lang.Integer i)
        Assign this argument to an integer
        Parameters:
        i - the integer value to take on
      • setNull

        public void setNull()
        Set this argument to be NULL
      • setObject

        public void setObject​(Obj obj)
        Assign this argument to a given XFA object
        Parameters:
        obj - The XFA object to hold.
      • setObject

        public void setObject​(Obj obj,
                              boolean bIsRef)
        Assign this argument to a given XFA object
        Parameters:
        obj - The XFA object to hold.
        bIsRef - Set to true if the object is a reference/pointer to another Object.
      • setObject

        public void setObject​(Obj obj,
                              boolean bIsRef,
                              boolean bIsProp)
        Assign this argument to a given XFA object
        Parameters:
        obj - The XFA object to hold.
        bIsRef - Set to true if the object is a reference/pointer to another Object.
      • setString

        public void setString​(java.lang.String s)
        Assign this argument to a string
        Parameters:
        s - the string value to take on
      • setVoid

        public void setVoid​(java.lang.Object oData)
        Assign this argument to a data object..
        Parameters:
        oData - the object.
      • isRefObject

        public boolean isRefObject()
        Is the current Object a reference/pointer to another Object.
        Returns:
        True if the current object is a reference/pointer to another Object, otherwise FALSE.
      • isXFAProperty

        public boolean isXFAProperty()
        Is the current Object resolved through property.
        Returns:
        True if the current object is resolved through property, otherwise FALSE.