public final class STJS extends Object
| Modifier and Type | Field and Description |
|---|---|
Function2<Object,String,Object> |
getFieldHandler
this handler will be called any time a field annotated with the template "gsetter" is get.
|
Function3<Object,String,Object,Boolean> |
setFieldHandler
this handler will be called any time a field annotated with the template "gsetter" is set.
|
| Constructor and Description |
|---|
STJS() |
| Modifier and Type | Method and Description |
|---|---|
<T extends CallbackOrFunction> |
bind(Object object,
CallbackOrFunction func)
this functions is used to be able to atach lambdas to an object
|
<T extends CallbackOrFunction> |
bind(Object object,
CallbackOrFunction func,
int THISParamPosition)
this functions is used to be able to atach lambdas to an object
|
<T extends CallbackOrFunction> |
bind(Object object,
String methodName)
this functions is used to be able to send method references as callbacks
|
Exception |
exception(Object ex)
throw an exception of any type in Javascript.
|
Map<String,Map<String,Map<String,Object>>> |
getAnnotations(Class<?> clazz)
return the annotations of the given type in the format:
|
Map<String,Object> |
getMemberAnnotation(Class<?> clazz,
String memberName,
String annTypeName) |
Map<String,Object> |
getParameterAnnotation(Class<?> clazz,
String methodName,
int idx,
String annTypeName) |
Map<String,Object> |
getTypeAnnotation(Class<?> clazz,
String annTypeName) |
boolean |
isEnum(Object obj) |
<T> T |
parseJSON(String json,
Class<T> clazz)
parse the given json String and build the object hierarchy in a typed-manner: i.e it builds the objects using their corresponding
constructors.
|
<T> Map<String,? extends Object> |
stringify(T obj,
Class<T> cls)
using the type description it converts the fields of the object in strings or other primitve types to be able to send the object via AJAX
for example.You need to include stjs-ext.js
|
<T> Array<T> |
typefy(Array<Object> obj,
Class<T> cls)
using the type description, it converts an array of POJOs (i.e arrived as JSON in your client) to an object of the given type,
transforming recursively the fields.You need to include stjs-ext.js
|
<T> T |
typefy(Map<String,? extends Object> obj,
Class<T> cls)
using the type description, it converts a POJO (i.e arrived as JSON in your client) to an object of the given type, transforming
recursively the fields.
|
<T> T |
typefy(T obj,
Class<T> cls)
using the type description, it converts a POJO (i.e arrived as JSON in your client) to an object of the given type, transforming
recursively the fields.
|
public Function3<Object,String,Object,Boolean> setFieldHandler
public boolean isEnum(Object obj)
obj - public Exception exception(Object ex)
ex - public <T> T parseJSON(String json, Class<T> clazz)
json - clazz - public <T> T typefy(T obj,
Class<T> cls)
obj - cls - public <T> T typefy(Map<String,? extends Object> obj, Class<T> cls)
obj - cls - public <T> Array<T> typefy(Array<Object> obj, Class<T> cls)
obj - cls - public <T> Map<String,? extends Object> stringify(T obj, Class<T> cls)
obj - cls - public Map<String,Map<String,Map<String,Object>>> getAnnotations(Class<?> clazz)
$annotations : {
_: {....}
field1: {...}
method1: {...}
method1$0: {...}
method1$1: {...}...
}
for each annotation list you have:
{
"annotationType1": {value:"v1", value2: "v2"},
"annotationType2": {}
}
clazz - public Map<String,Object> getMemberAnnotation(Class<?> clazz, String memberName, String annTypeName)
public Map<String,Object> getParameterAnnotation(Class<?> clazz, String methodName, int idx, String annTypeName)
public <T extends CallbackOrFunction> T bind(Object object, String methodName)
public <T extends CallbackOrFunction> T bind(Object object, CallbackOrFunction func)
public <T extends CallbackOrFunction> T bind(Object object, CallbackOrFunction func, int THISParamPosition)
Copyright © 2015. All Rights Reserved.