Class WffBMObject

java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<String,ValueValueType>
com.webfirmframework.wffweb.wffbm.data.WffBMObject
All Implemented Interfaces:
WffBMData, WffData, Serializable, Cloneable, Map<String,ValueValueType>

public class WffBMObject extends LinkedHashMap<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:
  • Constructor Details

    • WffBMObject

      public WffBMObject()
    • WffBMObject

      public WffBMObject(boolean outer)
    • WffBMObject

      public WffBMObject(byte[] bMBytes)
    • WffBMObject

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

    • put

      public ValueValueType put(String key, ValueValueType value)
      Specified by:
      put in interface Map<String,ValueValueType>
      Overrides:
      put in class HashMap<String,ValueValueType>
    • put

      public void put(String key, BMValueType valueType, Object value)
    • build

      @Deprecated public byte[] build() throws UnsupportedEncodingException
      Deprecated.
      building bytes implementation doesn't throw UnsupportedEncodingException so deprecated this method. The same goal can be achieved using buildBytes method.
      Returns:
      Throws:
      UnsupportedEncodingException - throwing this exception will be removed in future version because its internal implementation will never make this exception due to the code changes since 3.0.1.
      Since:
      1.1.5
    • buildBytes

      public byte[] buildBytes()
      replacement method for build() method.
      Returns:
      Since:
      3.0.15
    • build

      @Deprecated public byte[] build(boolean outer) throws UnsupportedEncodingException
      Deprecated.
      building bytes implementation doesn't throw UnsupportedEncodingException so deprecated this method. The same goal can be achieved using buildBytes method.
      NB: use buildBytes instead of this method.
      Specified by:
      build in interface WffBMData
      Parameters:
      outer -
      Returns:
      the bytes representation of the object
      Throws:
      UnsupportedEncodingException - throwing this exception will be removed in future version because its internal implementation will never make this exception due to the code changes since 3.0.1.
      Since:
      1.1.5
    • buildBytes

      public byte[] buildBytes(boolean outer)
      Specified by:
      buildBytes in interface WffBMData
      Parameters:
      outer -
      Returns:
      bytes for this WffBMObject
      Since:
      3.0.2
    • getbMBytes

      @Deprecated public byte[] getbMBytes()
      Deprecated.
      Returns:
      the bmBytes
    • getBMBytes

      public byte[] getBMBytes()
      Returns:
      the bmBytes
      Since:
      3.0.16
    • isOuter

      public boolean isOuter()
    • setOuter

      public void setOuter(boolean outer)
    • getValue

      public Object getValue(String key)
      Parameters:
      key - the key name
      Since:
      2.0.0
    • getValueType

      public BMValueType getValueType(String key)
      Parameters:
      key -
      Returns:
      the value type of this key
      Since:
      2.0.0
    • getBMType

      public BMType getBMType()
      Specified by:
      getBMType in interface WffBMData
      Returns:
      the BMType