public class JsUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <D> void |
add(jsinterop.base.JsArrayLike<D> jsArrayLike,
D element) |
static <D,E extends D> |
addAll(jsinterop.base.JsArrayLike<D> jsArrayLike,
E... elements) |
static <D> D |
fromAttributesMap(Map<QName,String> original)
Extracts the otherAttributes property from a regular Java Map to a JavaScriptObject.
|
static JSIName |
getJSIName(String namespaceURI,
String localPart,
String prefix) |
static <D> jsinterop.base.JsArrayLike<D> |
getNativeArray()
Helper method to create a new, empty
JsArrayLike |
static <D> jsinterop.base.JsArrayLike<D> |
getNativeElementsArray(jsinterop.base.JsArrayLike<D> original)
Returns the original
JsArrayLike or, ift the original JsArrayLike is null , a new, empty one |
static String |
getTypeName(Object instance) |
static Object |
getUnwrappedElement(Object original) |
static <D> jsinterop.base.JsArrayLike<D> |
getUnwrappedElementsArray(jsinterop.base.JsArrayLike<D> original)
Returns a
JsArrayLike where each element represents the unwrapped object (i.e. object.value) of the original one. |
static <D> D |
getWrappedElement(Object value) |
static <D> D |
newWrappedInstance()
Returns a stub object with name and value attributes
|
static <D> void |
remove(jsinterop.base.JsArrayLike<D> jsArrayLike,
int index) |
static <D> void |
setNameOnWrapped(D wrappedObject,
JSIName name)
Set the name attribute of the given wrapped
D with the json representation of the given JSIName |
static <D,E> void |
setValueOnWrapped(D wrappedObject,
E value)
Set the value attribute of the given wrapped
D with the json representation of value E |
static Map<QName,String> |
toAttributesMap(Object original)
Extracts the otherAttributes property from a JavaScriptObject to a regular Java Map.
|
static <D> jsinterop.base.JsArrayLike<D> |
toJsArrayLike(List<D> list) |
static <D> List<D> |
toList(jsinterop.base.JsArrayLike<D> jsArrayLike) |
public static <D> void add(jsinterop.base.JsArrayLike<D> jsArrayLike, D element)
public static <D,E extends D> void addAll(jsinterop.base.JsArrayLike<D> jsArrayLike, E... elements)
public static <D> void remove(jsinterop.base.JsArrayLike<D> jsArrayLike, int index)
public static <D> List<D> toList(jsinterop.base.JsArrayLike<D> jsArrayLike)
public static <D> jsinterop.base.JsArrayLike<D> toJsArrayLike(List<D> list)
public static Map<QName,String> toAttributesMap(Object original)
original
- js object to transform.Map<QName, String>
public static <D> D fromAttributesMap(Map<QName,String> original)
original
- the Map<QName, String>
to transform.public static <D> D newWrappedInstance()
public static <D> void setNameOnWrapped(D wrappedObject, JSIName name)
D
with the json representation of the given JSIName
wrappedObject
- name
- public static <D,E> void setValueOnWrapped(D wrappedObject, E value)
D
with the json representation of value E
wrappedObject
- value
- public static <D> jsinterop.base.JsArrayLike<D> getNativeElementsArray(jsinterop.base.JsArrayLike<D> original)
JsArrayLike
or, ift the original JsArrayLike
is null
, a new, empty oneD
- original
- public static <D> jsinterop.base.JsArrayLike<D> getUnwrappedElementsArray(jsinterop.base.JsArrayLike<D> original)
JsArrayLike
where each element represents the unwrapped object (i.e. object.value) of the original one.
It the original JsArrayLike
is null
, returns a new, empty oneD
- original
- public static <D> D getWrappedElement(Object value)
public static <D> jsinterop.base.JsArrayLike<D> getNativeArray()
JsArrayLike
Copyright © 2001–2020 JBoss by Red Hat. All rights reserved.