Class AnyValue


  • @Immutable
    public abstract class AnyValue
    extends Object
    A class that represents all the possible values for a data body. An AnyValue can have 6 types of values: String, boolean, int, double, array, or kvlist. represented through AnyValue.Type. A array or a kvlist can in turn hold other AnyValue instances, allowing for mapping to JSON-like structures.
    • Constructor Detail

      • AnyValue

        public AnyValue()
    • Method Detail

      • stringAnyValue

        public static AnyValue stringAnyValue​(String stringValue)
        Returns an AnyValue with a string value.
        Parameters:
        stringValue - The new value.
        Returns:
        an AnyValue with a string value.
      • getStringValue

        public String getStringValue()
        Returns the string value of this AnyValue. An UnsupportedOperationException will be thrown if getType() is not AnyValue.Type.STRING.
        Returns:
        the string value of this AttributeValue.
      • longAnyValue

        public static AnyValue longAnyValue​(long longValue)
        Returns an AnyValue with an int value.
        Parameters:
        longValue - The new value.
        Returns:
        an AnyValue with a int value.
      • getLongValue

        public long getLongValue()
      • boolAnyValue

        public static AnyValue boolAnyValue​(boolean boolValue)
        Returns an AnyValue with a bool value.
        Parameters:
        boolValue - The new value.
        Returns:
        an AnyValue with a bool value.
      • getBoolValue

        public boolean getBoolValue()
        Returns the boolean value of this AnyValue. An UnsupportedOperationException will be thrown if getType() is not AnyValue.Type.BOOL.
        Returns:
        the boolean value of this AttributeValue.
      • doubleAnyValue

        public static AnyValue doubleAnyValue​(double doubleValue)
        Returns an AnyValue with a double value.
        Parameters:
        doubleValue - The new value.
        Returns:
        an AnyValue with a double value.
      • getDoubleValue

        public double getDoubleValue()
        Returns the double value of this AnyValue. An UnsupportedOperationException will be thrown if getType() is not AnyValue.Type.DOUBLE.
        Returns:
        the double value of this AttributeValue.
      • arrayAnyValue

        public static AnyValue arrayAnyValue​(List<AnyValue> values)
        Returns an AnyValue with a array value.
        Parameters:
        values - The new value.
        Returns:
        an AnyValue with a array value.
      • getArrayValue

        public List<AnyValue> getArrayValue()
        Returns the array value of this AnyValue. An UnsupportedOperationException will be thrown if getType() is not AnyValue.Type.ARRAY.
        Returns:
        the array value of this AttributeValue.
      • kvlistAnyValue

        public static AnyValue kvlistAnyValue​(Map<String,​AnyValue> values)
        Returns an AnyValue with a kvlist value.
        Parameters:
        values - The new value.
        Returns:
        an AnyValue with a kvlist value.
      • getKvlistValue

        public Map<String,​AnyValue> getKvlistValue()
        Returns the string value of this AnyValue. An UnsupportedOperationException will be thrown if getType() is not AnyValue.Type.STRING.
        Returns:
        the string value of this AttributeValue.