Class DocumentPrimitive
- java.lang.Object
- 
- com.inductiveautomation.ignition.common.document.DocumentElement
- 
- com.inductiveautomation.ignition.common.document.DocumentPrimitive
 
 
- 
- All Implemented Interfaces:
- java.io.Serializable
 
 public final class DocumentPrimitive extends DocumentElement A class representing a Json primitive value. A primitive value is either a String, a Java primitive, or a Java primitive wrapper type.- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description DocumentPrimitive(java.lang.Boolean bool)Create a primitive containing a boolean value.DocumentPrimitive(java.lang.Character c)Create a primitive containing a character.DocumentPrimitive(java.lang.Number number)Create a primitive containing aNumber.DocumentPrimitive(java.lang.String string)Create a primitive containing a String value.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description DocumentPrimitivedeepCopy()Returns the same value, as primitives are immutable.booleanequals(java.lang.Object obj)java.math.BigDecimalgetAsBigDecimal()convenience method to get this element as aBigDecimal.java.math.BigIntegergetAsBigInteger()convenience method to get this element as aBigInteger.booleangetAsBoolean()convenience method to get this element as a boolean value.bytegetAsByte()convenience method to get this element as a primitive byte value.chargetAsCharacter()convenience method to get this element as a primitive character value.doublegetAsDouble()convenience method to get this element as a primitive double.floatgetAsFloat()convenience method to get this element as a float.intgetAsInt()convenience method to get this element as a primitive integer.longgetAsLong()convenience method to get this element as a primitive long.java.lang.NumbergetAsNumber()convenience method to get this element as a Number.shortgetAsShort()convenience method to get this element as a primitive short.java.lang.StringgetAsString()convenience method to get this element as a String.inthashCode()booleanisBoolean()Check whether this primitive contains a boolean value.booleanisNumber()Check whether this primitive contains a Number.booleanisString()Check whether this primitive contains a String value.com.inductiveautomation.ignition.common.gson.JsonPrimitivetoJsonElement()- 
Methods inherited from class com.inductiveautomation.ignition.common.document.DocumentElementfromJson, getAsDocument, getAsDocumentArray, getAsDocumentNull, getAsDocumentPrimitive, isDocument, isDocumentArray, isDocumentNull, isDocumentPrimitive, toString
 
- 
 
- 
- 
- 
Constructor Detail- 
DocumentPrimitivepublic DocumentPrimitive(java.lang.Boolean bool) Create a primitive containing a boolean value.- Parameters:
- bool- the value to create the primitive with.
 
 - 
DocumentPrimitivepublic DocumentPrimitive(java.lang.Number number) Create a primitive containing aNumber.- Parameters:
- number- the value to create the primitive with.
 
 - 
DocumentPrimitivepublic DocumentPrimitive(java.lang.String string) Create a primitive containing a String value.- Parameters:
- string- the value to create the primitive with.
 
 - 
DocumentPrimitivepublic DocumentPrimitive(java.lang.Character c) Create a primitive containing a character. The character is turned into a one character String since Json only supports String.- Parameters:
- c- the value to create the primitive with.
 
 
- 
 - 
Method Detail- 
toJsonElementpublic com.inductiveautomation.ignition.common.gson.JsonPrimitive toJsonElement() - Specified by:
- toJsonElementin class- DocumentElement
 
 - 
deepCopypublic DocumentPrimitive deepCopy() Returns the same value, as primitives are immutable.- Specified by:
- deepCopyin class- DocumentElement
 
 - 
isBooleanpublic boolean isBoolean() Check whether this primitive contains a boolean value.- Returns:
- true if this primitive contains a boolean value, false otherwise.
 
 - 
getAsBooleanpublic boolean getAsBoolean() convenience method to get this element as a boolean value.- Overrides:
- getAsBooleanin class- DocumentElement
- Returns:
- get this element as a primitive boolean value.
 
 - 
isNumberpublic boolean isNumber() Check whether this primitive contains a Number.- Returns:
- true if this primitive contains a Number, false otherwise.
 
 - 
getAsNumberpublic java.lang.Number getAsNumber() convenience method to get this element as a Number.- Overrides:
- getAsNumberin class- DocumentElement
- Returns:
- get this element as a Number.
- Throws:
- java.lang.NumberFormatException- if the value contained is not a valid Number.
 
 - 
isStringpublic boolean isString() Check whether this primitive contains a String value.- Returns:
- true if this primitive contains a String value, false otherwise.
 
 - 
getAsStringpublic java.lang.String getAsString() convenience method to get this element as a String.- Overrides:
- getAsStringin class- DocumentElement
- Returns:
- get this element as a String.
 
 - 
getAsDoublepublic double getAsDouble() convenience method to get this element as a primitive double.- Overrides:
- getAsDoublein class- DocumentElement
- Returns:
- get this element as a primitive double.
- Throws:
- java.lang.NumberFormatException- if the value contained is not a valid double.
 
 - 
getAsBigDecimalpublic java.math.BigDecimal getAsBigDecimal() convenience method to get this element as aBigDecimal.- Overrides:
- getAsBigDecimalin class- DocumentElement
- Returns:
- get this element as a BigDecimal.
- Throws:
- java.lang.NumberFormatException- if the value contained is not a valid- BigDecimal.
 
 - 
getAsBigIntegerpublic java.math.BigInteger getAsBigInteger() convenience method to get this element as aBigInteger.- Overrides:
- getAsBigIntegerin class- DocumentElement
- Returns:
- get this element as a BigInteger.
- Throws:
- java.lang.NumberFormatException- if the value contained is not a valid- BigInteger.
 
 - 
getAsFloatpublic float getAsFloat() convenience method to get this element as a float.- Overrides:
- getAsFloatin class- DocumentElement
- Returns:
- get this element as a float.
- Throws:
- java.lang.NumberFormatException- if the value contained is not a valid float.
 
 - 
getAsLongpublic long getAsLong() convenience method to get this element as a primitive long.- Overrides:
- getAsLongin class- DocumentElement
- Returns:
- get this element as a primitive long.
- Throws:
- java.lang.NumberFormatException- if the value contained is not a valid long.
 
 - 
getAsShortpublic short getAsShort() convenience method to get this element as a primitive short.- Overrides:
- getAsShortin class- DocumentElement
- Returns:
- get this element as a primitive short.
- Throws:
- java.lang.NumberFormatException- if the value contained is not a valid short value.
 
 - 
getAsIntpublic int getAsInt() convenience method to get this element as a primitive integer.- Overrides:
- getAsIntin class- DocumentElement
- Returns:
- get this element as a primitive integer.
- Throws:
- java.lang.NumberFormatException- if the value contained is not a valid integer.
 
 - 
getAsBytepublic byte getAsByte() Description copied from class:DocumentElementconvenience method to get this element as a primitive byte value.- Overrides:
- getAsBytein class- DocumentElement
- Returns:
- get this element as a primitive byte value.
 
 - 
getAsCharacterpublic char getAsCharacter() Description copied from class:DocumentElementconvenience method to get this element as a primitive character value.- Overrides:
- getAsCharacterin class- DocumentElement
- Returns:
- get this element as a primitive char value.
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 - 
equalspublic boolean equals(java.lang.Object obj) - Overrides:
- equalsin class- java.lang.Object
 
 
- 
 
-