| Modifier | Constructor and Description |
|---|---|
protected |
Proto.Type(Class<Model> clazz,
Class<?> modelFor,
int properties,
int functions)
Constructor for subclasses generated by the annotation processor
associated with
Model annotation. |
| Modifier and Type | Method and Description |
|---|---|
Boolean |
boolValue(Object val)
Converts the value to boolean.
|
protected abstract void |
call(Model model,
int index,
Object data,
Object event)
Invokes a
registerFunction(java.lang.String, int) registered function
on given object. |
protected abstract Model |
cloneTo(Model model,
BrwsrCtx ctx)
Re-binds the model object to new browser context.
|
<T> void |
copyJSON(BrwsrCtx context,
Object[] src,
Class<T> destType,
T[] dest)
Converts and array of raw JSON objects into an array of typed
Java classes.
|
Proto |
createProto(Object obj,
BrwsrCtx context)
Creates new proto-object for given
Model class bound to
provided context. |
<T> T |
extractValue(Class<T> type,
Object val)
Extracts value of specific type from given object.
|
protected abstract Object |
getValue(Model model,
int index)
Obtains and returns value of a
registered property. |
int |
hashPlus(Object o,
int h)
Cumulative hash function.
|
Character |
charValue(Object val)
Converts the value to character.
|
boolean |
isSame(double a,
double b)
Compares two objects that can be converted to (floating point)
numbers.
|
boolean |
isSame(int a,
int b)
Compares two objects that can be converted to integers.
|
boolean |
isSame(Object a,
Object b)
Compares two objects for being the same - e.g. either
==
or equals. |
Number |
numberValue(Object val)
Converts the value to number.
|
protected abstract void |
onChange(Model model,
int index)
Called when a
registered property
changes its value. |
protected abstract void |
onMessage(Model model,
int index,
int type,
Object data)
Called to report results of asynchronous over-the-wire
communication.
|
protected abstract Proto |
protoFor(Object object)
Finds out if there is an associated proto-object for given
object.
|
protected abstract Model |
read(BrwsrCtx c,
Object json)
Reads raw JSON data and converts them to our model class.
|
protected void |
registerFunction(String name,
int index)
Registers function of given name at given index.
|
protected void |
registerProperty(String name,
int index,
boolean readOnly)
Registers property for the type.
|
protected abstract void |
setValue(Model model,
int index,
Object value)
Sets value of a
registered property
to new value. |
String |
stringValue(Object val)
Converts the value to string.
|
String |
toJSON(Object obj)
Converts an object to its JSON value.
|
protected Proto.Type(Class<Model> clazz, Class<?> modelFor, int properties, int functions)
Model annotation.clazz - the generated model classmodelFor - the original class annotated by the Model annotation.properties - number of properties the class hasfunctions - number of functions the class hasprotected final void registerProperty(String name, int index, boolean readOnly)
name - name of the propertyindex - index of the propertyreadOnly - is the property read only?protected final void registerFunction(String name, int index)
name - name of the functionindex - name of the typepublic Proto createProto(Object obj, BrwsrCtx context)
Model class bound to
provided context.obj - instance of appropriate Model classcontext - the browser contextprotected abstract void setValue(Model model, int index, Object value)
registered property
to new value.model - the instance of model classindex - index of the property used during registrationvalue - the value to set the property toprotected abstract Object getValue(Model model, int index)
registered property.model - the instance of model classindex - index of the property used during registrationprotected abstract void call(Model model, int index, Object data, Object event)
registerFunction(java.lang.String, int) registered function
on given object.model - the instance of model classindex - index of the property used during registrationdata - the currently selected object the function is about to operate onevent - the event that triggered the eventprotected abstract Model cloneTo(Model model, BrwsrCtx ctx)
model - the instance of model classctx - browser context to clone the object toprotected abstract Model read(BrwsrCtx c, Object json)
c - the browser context to work injson - raw JSON data to get values fromprotected abstract void onChange(Model model, int index)
registered property
changes its value.model - the object that has the propertyindex - the index of the property during registrationprotected abstract Proto protoFor(Object object)
object - an object, presumably (but not necessarily) instance of Model classnullprotected abstract void onMessage(Model model, int index, int type, Object data)
Proto.wsOpen(int, java.lang.String, java.lang.Object)
or Proto.loadJSON(int, java.lang.String, java.lang.String, java.lang.String, java.lang.Object).model - the instance of the model classindex - index used during initiating the communication (via loadJSON or wsOpen calls)type - type of the message: 0 - onOpen, 1 - onMessage, 2 - onError, 3 - onClose -
not all messages are applicable to all communication protocols (JSON has only 1 and 2).data - null or string, number or a Model class
obtained to the server as a responsepublic <T> void copyJSON(BrwsrCtx context, Object[] src, Class<T> destType, T[] dest)
T - the type of the destination arraycontext - browser context to usesrc - array of raw JSON objectsdestType - type of the individual array elementsdest - array to be filled with read type instancespublic final boolean isSame(int a,
int b)
a - first valueb - second valuepublic final boolean isSame(double a,
double b)
a - first valueb - second valuepublic final boolean isSame(Object a, Object b)
==
or equals.a - first valueb - second valuepublic final int hashPlus(Object o, int h)
o - the object (or null)h - the previous value of the hashpublic final String toJSON(Object obj)
obj - the object to convertpublic final String stringValue(Object val)
val - the valuepublic final Number numberValue(Object val)
val - the valuepublic final Character charValue(Object val)
val - the valuepublic final Boolean boolValue(Object val)
val - the valueCopyright © 2014 NetBeans. All Rights Reserved.