Package snap.util

Class JSValue

java.lang.Object
snap.util.JSValue
Direct Known Subclasses:
JSArray, JSObject

public class JSValue extends Object
Represents a node in a JSON tree.
  • Constructor Details

    • JSValue

      public JSValue()
      Creates a new node.
    • JSValue

      public JSValue(Object anObj)
      Creates a new node.
  • Method Details

    • getValue

      public Object getValue()
      Returns the value.
    • setValue

      protected void setValue(Object anObj)
      Sets the value.
    • getValueAsString

      public String getValueAsString()
      Returns the value as String if type is String.
    • getNative

      public Object getNative()
      Returns the node as a native object.
    • equals

      public boolean equals(Object anObj)
      Standard equals implementation.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Standard hashCode implementation.
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Returns a string representation of node (as JSON, of course).
      Overrides:
      toString in class Object
    • toStringCompacted

      public String toStringCompacted()
      Returns a string representation of node (as JSON, of course).
    • readSource

      public static JSValue readSource(Object aSource)
      Reads JSON from a source.