Class WffBMObject
- All Implemented Interfaces:
WffBMData
,WffData
,Serializable
,Cloneable
,Map<String,
ValueValueType>
The java object representation for JavaScript object.
Sample code :-
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
ConstructorDescriptionWffBMObject
(boolean outer) WffBMObject
(byte[] bMBytes) WffBMObject
(byte[] bMBytes, boolean outer) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
build()
Deprecated.building bytes implementation doesn't throw UnsupportedEncodingException so deprecated this method.byte[]
build
(boolean outer) Deprecated.building bytes implementation doesn't throw UnsupportedEncodingException so deprecated this method.byte[]
replacement method for build() method.byte[]
buildBytes
(boolean outer) byte[]
Deprecated.usegetBMBytes()
byte[]
getValueType
(String key) boolean
isOuter()
void
put
(String key, BMValueType valueType, Object value) put
(String key, ValueValueType value) void
setOuter
(boolean outer) Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values
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.AbstractMap
equals, hashCode, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, putAll, putIfAbsent, remove, remove, replace, replace, size
-
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
- Specified by:
put
in interfaceMap<String,
ValueValueType> - Overrides:
put
in classHashMap<String,
ValueValueType>
-
put
-
build
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.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 interfaceWffBMData
- 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 interfaceWffBMData
- Parameters:
outer
-- Returns:
- bytes for this WffBMObject
- Since:
- 3.0.2
-
getbMBytes
Deprecated.usegetBMBytes()
- 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
- Parameters:
key
- the key name- Since:
- 2.0.0
-
getValueType
- Parameters:
key
-- Returns:
- the value type of this key
- Since:
- 2.0.0
-
getBMType
-