Class DocumentElement

    • Constructor Detail

      • DocumentElement

        public DocumentElement()
    • Method Detail

      • fromJson

        public static DocumentElement fromJson​(com.inductiveautomation.ignition.common.gson.JsonElement element)
        Utility method to convert a Gson JsonElement to an Ignition DocumentElement.
      • deepCopy

        public abstract DocumentElement deepCopy()
        Returns a deep copy of this element. Immutable elements like primitives and nulls are not copied.
        Since:
        2.8.2
      • toJsonElement

        public abstract com.inductiveautomation.ignition.common.gson.JsonElement toJsonElement()
      • isDocumentArray

        public boolean isDocumentArray()
        provides check for verifying if this element is an array or not.
        Returns:
        true if this element is of type DocumentArray, false otherwise.
      • isDocument

        public boolean isDocument()
        provides check for verifying if this element is a Document object or not.
        Returns:
        true if this element is of type Document, false otherwise.
      • isDocumentPrimitive

        public boolean isDocumentPrimitive()
        provides check for verifying if this element is a primitive or not.
        Returns:
        true if this element is of type DocumentPrimitive, false otherwise.
      • isDocumentNull

        public boolean isDocumentNull()
        provides check for verifying if this element represents a null value or not.
        Returns:
        true if this element is of type DocumentNull, false otherwise.
        Since:
        1.2
      • getAsDocument

        public Document getAsDocument()
        convenience method to get this element as a Document. If the element is of some other type, a IllegalStateException will result. Hence it is best to use this method after ensuring that this element is of the desired type by calling isDocument() first.
        Returns:
        get this element as a Document.
        Throws:
        java.lang.IllegalStateException - if the element is of another type.
      • getAsDocumentArray

        public DocumentArray getAsDocumentArray()
        convenience method to get this element as a DocumentArray. If the element is of some other type, a IllegalStateException will result. Hence it is best to use this method after ensuring that this element is of the desired type by calling isDocumentArray() first.
        Returns:
        get this element as a DocumentArray.
        Throws:
        java.lang.IllegalStateException - if the element is of another type.
      • getAsDocumentPrimitive

        public DocumentPrimitive getAsDocumentPrimitive()
        convenience method to get this element as a DocumentPrimitive. If the element is of some other type, a IllegalStateException will result. Hence it is best to use this method after ensuring that this element is of the desired type by calling isDocumentPrimitive() first.
        Returns:
        get this element as a DocumentPrimitive.
        Throws:
        java.lang.IllegalStateException - if the element is of another type.
      • getAsDocumentNull

        public DocumentNull getAsDocumentNull()
        convenience method to get this element as a DocumentNull. If the element is of some other type, a IllegalStateException will result. Hence it is best to use this method after ensuring that this element is of the desired type by calling isDocumentNull() first.
        Returns:
        get this element as a DocumentNull.
        Throws:
        java.lang.IllegalStateException - if the element is of another type.
        Since:
        1.2
      • getAsBoolean

        public boolean getAsBoolean()
        convenience method to get this element as a boolean value.
        Returns:
        get this element as a primitive boolean value.
        Throws:
        java.lang.ClassCastException - if the element is of not a DocumentPrimitive and is not a valid boolean value.
        java.lang.IllegalStateException - if the element is of the type DocumentArray but contains more than a single element.
      • getAsNumber

        public java.lang.Number getAsNumber()
        convenience method to get this element as a Number.
        Returns:
        get this element as a Number.
        Throws:
        java.lang.ClassCastException - if the element is of not a DocumentPrimitive and is not a valid number.
        java.lang.IllegalStateException - if the element is of the type DocumentArray but contains more than a single element.
      • getAsString

        public java.lang.String getAsString()
        convenience method to get this element as a string value.
        Returns:
        get this element as a string value.
        Throws:
        java.lang.ClassCastException - if the element is of not a DocumentPrimitive and is not a valid string value.
        java.lang.IllegalStateException - if the element is of the type DocumentArray but contains more than a single element.
      • getAsDouble

        public double getAsDouble()
        convenience method to get this element as a primitive double value.
        Returns:
        get this element as a primitive double value.
        Throws:
        java.lang.ClassCastException - if the element is of not a DocumentPrimitive and is not a valid double value.
        java.lang.IllegalStateException - if the element is of the type DocumentArray but contains more than a single element.
      • getAsFloat

        public float getAsFloat()
        convenience method to get this element as a primitive float value.
        Returns:
        get this element as a primitive float value.
        Throws:
        java.lang.ClassCastException - if the element is of not a DocumentPrimitive and is not a valid float value.
        java.lang.IllegalStateException - if the element is of the type DocumentArray but contains more than a single element.
      • getAsLong

        public long getAsLong()
        convenience method to get this element as a primitive long value.
        Returns:
        get this element as a primitive long value.
        Throws:
        java.lang.ClassCastException - if the element is of not a DocumentPrimitive and is not a valid long value.
        java.lang.IllegalStateException - if the element is of the type DocumentArray but contains more than a single element.
      • getAsInt

        public int getAsInt()
        convenience method to get this element as a primitive integer value.
        Returns:
        get this element as a primitive integer value.
        Throws:
        java.lang.ClassCastException - if the element is of not a DocumentPrimitive and is not a valid integer value.
        java.lang.IllegalStateException - if the element is of the type DocumentArray but contains more than a single element.
      • getAsByte

        public byte getAsByte()
        convenience method to get this element as a primitive byte value.
        Returns:
        get this element as a primitive byte value.
        Throws:
        java.lang.ClassCastException - if the element is of not a DocumentPrimitive and is not a valid byte value.
        java.lang.IllegalStateException - if the element is of the type DocumentArray but contains more than a single element.
        Since:
        1.3
      • getAsCharacter

        public char getAsCharacter()
        convenience method to get this element as a primitive character value.
        Returns:
        get this element as a primitive char value.
        Throws:
        java.lang.ClassCastException - if the element is of not a DocumentPrimitive and is not a valid char value.
        java.lang.IllegalStateException - if the element is of the type DocumentArray but contains more than a single element.
        Since:
        1.3
      • getAsBigDecimal

        public java.math.BigDecimal getAsBigDecimal()
        convenience method to get this element as a BigDecimal.
        Returns:
        get this element as a BigDecimal.
        Throws:
        java.lang.ClassCastException - if the element is of not a DocumentPrimitive.
        java.lang.NumberFormatException - if the element is not a valid BigDecimal.
        java.lang.IllegalStateException - if the element is of the type DocumentArray but contains more than a single element.
        Since:
        1.2
      • getAsBigInteger

        public java.math.BigInteger getAsBigInteger()
        convenience method to get this element as a BigInteger.
        Returns:
        get this element as a BigInteger.
        Throws:
        java.lang.ClassCastException - if the element is of not a DocumentPrimitive.
        java.lang.NumberFormatException - if the element is not a valid BigInteger.
        java.lang.IllegalStateException - if the element is of the type DocumentArray but contains more than a single element.
        Since:
        1.2
      • getAsShort

        public short getAsShort()
        convenience method to get this element as a primitive short value.
        Returns:
        get this element as a primitive short value.
        Throws:
        java.lang.ClassCastException - if the element is of not a DocumentPrimitive and is not a valid short value.
        java.lang.IllegalStateException - if the element is of the type DocumentArray but contains more than a single element.
      • toString

        public java.lang.String toString()
        Returns a String representation of this element.
        Overrides:
        toString in class java.lang.Object
      • toStringNoIndent

        public java.lang.String toStringNoIndent()