Class AnyVal<T>

  • All Implemented Interfaces:
    Serializable, org.zkoss.json.JSONAware

    public class AnyVal<T>
    extends Object
    implements org.zkoss.json.JSONAware, Serializable
    AnyVal is the root class of all primitive types, which describe values not implemented as objects in the underlying host system.
    Author:
    jumperchen
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      AnyVal​(T val)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Object[] asArray()
      Returns the origin value as an array, if possible.
      boolean asBoolean()
      Returns the origin value as boolean type, if possible.
      boolean[] asBooleanArray()
      Returns the origin value as boolean array, if possible.
      byte asByte()
      Returns the origin value in byte type, if possible.
      byte[] asByteArray()
      Returns the origin value as byte array, if possible.
      char asChar()
      Returns the origin value as char type, if possible.
      char[] asCharArray()
      Returns the origin value as char array, if possible.
      double asDouble()
      Returns the origin value as double type, if possible.
      double[] asDoubleArray()
      Returns the origin value as double array, if possible.
      float asFloat()
      Returns the origin value as float type, if possible.
      float[] asFloatArray()
      Returns the origin value as float array, if possible.
      int asInt()
      Returns the origin value as int type, if possible.
      int[] asIntArray()
      Returns the origin value as int array, if possible.
      List<?> asList()
      Returns the origin value as a list, if possible.
      long asLong()
      Returns the origin value as long type, if possible.
      long[] asLongArray()
      Returns the origin value as long array, if possible.
      Map<?,​?> asMap()
      Returns the origin value as a map, if possible.
      Number asNumber()
      Returns the origin value as number type, if possible.
      Number[] asNumberArray()
      Returns the origin value as Number array, if possible.
      Set<?> asSet()
      Returns the origin value as a set, if possible.
      short asShort()
      Returns the origin value as short type, if possible.
      short[] asShortArray()
      Returns the origin value as short array, if possible.
      String asString()
      Returns the origin value as string type, if possible.
      String[] asStringArray()
      Returns the origin value as string array, if possible.
      Object asValue()
      Returns the origin value
      boolean equals​(Object obj)  
      int hashCode()  
      String toJSONString()  
      String toString()  
    • Constructor Detail

      • AnyVal

        public AnyVal​(T val)
    • Method Detail

      • asValue

        public Object asValue()
        Returns the origin value
      • asInt

        public int asInt()
        Returns the origin value as int type, if possible.
      • asString

        public String asString()
        Returns the origin value as string type, if possible.
      • asBoolean

        public boolean asBoolean()
        Returns the origin value as boolean type, if possible.
      • asNumber

        public Number asNumber()
        Returns the origin value as number type, if possible.
      • asLong

        public long asLong()
        Returns the origin value as long type, if possible.
      • asDouble

        public double asDouble()
        Returns the origin value as double type, if possible.
      • asFloat

        public float asFloat()
        Returns the origin value as float type, if possible.
      • asShort

        public short asShort()
        Returns the origin value as short type, if possible.
      • asChar

        public char asChar()
        Returns the origin value as char type, if possible.
      • asByte

        public byte asByte()
        Returns the origin value in byte type, if possible.
      • asList

        public List<?> asList()
        Returns the origin value as a list, if possible.
      • asMap

        public Map<?,​?> asMap()
        Returns the origin value as a map, if possible.
      • asSet

        public Set<?> asSet()
        Returns the origin value as a set, if possible.
      • asArray

        public Object[] asArray()
        Returns the origin value as an array, if possible.
      • asNumberArray

        public Number[] asNumberArray()
        Returns the origin value as Number array, if possible.
      • asIntArray

        public int[] asIntArray()
        Returns the origin value as int array, if possible.
      • asFloatArray

        public float[] asFloatArray()
        Returns the origin value as float array, if possible.
      • asLongArray

        public long[] asLongArray()
        Returns the origin value as long array, if possible.
      • asDoubleArray

        public double[] asDoubleArray()
        Returns the origin value as double array, if possible.
      • asBooleanArray

        public boolean[] asBooleanArray()
        Returns the origin value as boolean array, if possible.
      • asShortArray

        public short[] asShortArray()
        Returns the origin value as short array, if possible.
      • asCharArray

        public char[] asCharArray()
        Returns the origin value as char array, if possible.
      • asStringArray

        public String[] asStringArray()
        Returns the origin value as string array, if possible.
      • asByteArray

        public byte[] asByteArray()
        Returns the origin value as byte array, if possible.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • toJSONString

        public String toJSONString()
        Specified by:
        toJSONString in interface org.zkoss.json.JSONAware