Class WffBMObject

  • All Implemented Interfaces:
    WffBMData, WffData, java.io.Serializable


    public class WffBMObject
    extends java.util.LinkedHashMap<java.lang.String,ValueValueType>
    implements WffBMData
    The java object representation for JavaScript object.
    Sample code :-
     WffBMObject bmObject = new WffBMObject();
     bmObject.put("serverKey", BMValueType.STRING, "value from server");
     bmObject.put("string", BMValueType.STRING, "sample string");
     bmObject.put("nul", BMValueType.NULL, null);
     bmObject.put("number", BMValueType.NUMBER, 555);
     bmObject.put("undef", BMValueType.UNDEFINED, null);
     bmObject.put("reg", BMValueType.REG_EXP, "[w]");
     bmObject.put("bool", BMValueType.BOOLEAN, true);
     bmObject.put("testFun", BMValueType.FUNCTION, "function(arg) {alert(arg);}");
     
    The WffBMObject can also hold array and binary data (as byte array). Check out WffBMArray and WffBMByteArray respectively.
    See Also:
    WffBMArray, WffBMByteArray, Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,V extends java.lang.Object>
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] build​()  
      byte[] build​(boolean outer)  
      byte[] getbMBytes​()  
      BMType getBMType​()  
      java.lang.Object getValue​(java.lang.String key)  
      BMValueType getValueType​(java.lang.String key)  
      boolean isOuter​()  
      void put​(java.lang.String key, BMValueType valueType, java.lang.Object value)  
      ValueValueType put​(java.lang.String key, ValueValueType value)  
      void setOuter​(boolean outer)  
      • Methods inherited from class java.util.AbstractMap

        equals, hashCode, toString
      • Methods inherited from class java.util.HashMap

        clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, putAll, putIfAbsent, remove, remove, replace, replace, size
      • Methods inherited from class java.util.LinkedHashMap

        clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values
      • Methods inherited from interface java.util.Map

        compute, computeIfAbsent, computeIfPresent, containsKey, entry, equals, hashCode, isEmpty, merge, of, of, of, of, of, of, of, of, of, of, of, ofEntries, putAll, putIfAbsent, remove, remove, replace, replace, size
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • WffBMObject

        public WffBMObject​()
      • WffBMObject

        public WffBMObject​(boolean outer)
      • WffBMObject

        public WffBMObject​(byte[] bMBytes)
      • WffBMObject

        public WffBMObject​(byte[] bMBytes,
                           boolean outer)
    • Method Detail

      • put

        public void put​(java.lang.String key,
                        BMValueType valueType,
                        java.lang.Object value)
      • build

        public byte[] build​()
                     throws java.io.UnsupportedEncodingException
        Returns:
        Throws:
        java.io.UnsupportedEncodingException
        Since:
        1.1.5
      • build

        public byte[] build​(boolean outer)
                     throws java.io.UnsupportedEncodingException
        Specified by:
        build in interface WffBMData
        Parameters:
        outer -
        Returns:
        Throws:
        java.io.UnsupportedEncodingException
        Since:
        1.1.5
      • getbMBytes

        public byte[] getbMBytes​()
      • isOuter

        public boolean isOuter​()
      • setOuter

        public void setOuter​(boolean outer)
      • getValue

        public java.lang.Object getValue​(java.lang.String key)
        Parameters:
        name - the key name
        Returns:
        the value
        Since:
        2.0.0
      • getValueType

        public BMValueType getValueType​(java.lang.String key)
        Parameters:
        key -
        Returns:
        the value type of this key
        Since:
        2.0.0