Top Description Fields Constructors Methods
com.dlsc.gmapsfx.javascript

public Class JavascriptObject

extends Object
Class Inheritance
Known Direct Subclasses
com.dlsc.gmapsfx.javascript.object.DirectionsPane, com.dlsc.gmapsfx.javascript.object.GMapPoint, com.dlsc.gmapsfx.javascript.object.GoogleMap, com.dlsc.gmapsfx.javascript.object.InfoWindow, com.dlsc.gmapsfx.javascript.object.InfoWindowOptions, com.dlsc.gmapsfx.javascript.object.LatLong, com.dlsc.gmapsfx.javascript.object.LatLongBounds, com.dlsc.gmapsfx.javascript.object.MapOptions, com.dlsc.gmapsfx.javascript.object.MapShape, com.dlsc.gmapsfx.javascript.object.Marker, com.dlsc.gmapsfx.javascript.object.MarkerClusterer, com.dlsc.gmapsfx.javascript.object.MarkerOptions, com.dlsc.gmapsfx.javascript.object.MVCArray, com.dlsc.gmapsfx.javascript.object.Projection, com.dlsc.gmapsfx.javascript.object.Size, com.dlsc.gmapsfx.service.directions.DirectionsGeocodedWaypoint, com.dlsc.gmapsfx.service.directions.DirectionsLeg, com.dlsc.gmapsfx.service.directions.DirectionsRenderer, com.dlsc.gmapsfx.service.directions.DirectionsRequest, com.dlsc.gmapsfx.service.directions.DirectionsResult, com.dlsc.gmapsfx.service.directions.DirectionsRoute, com.dlsc.gmapsfx.service.directions.DirectionsService, com.dlsc.gmapsfx.service.directions.DirectionsSteps, com.dlsc.gmapsfx.service.directions.DirectionsWaypoint, com.dlsc.gmapsfx.service.directions.Distance, com.dlsc.gmapsfx.service.directions.DrivingOptions, com.dlsc.gmapsfx.service.directions.Duration, com.dlsc.gmapsfx.service.elevation.ElevationResult, com.dlsc.gmapsfx.service.elevation.ElevationService, com.dlsc.gmapsfx.service.elevation.LocationElevationRequest, com.dlsc.gmapsfx.service.elevation.PathElevationRequest, com.dlsc.gmapsfx.service.geocoding.GeocoderAddressComponent, com.dlsc.gmapsfx.service.geocoding.GeocoderComponentRestrictions, com.dlsc.gmapsfx.service.geocoding.GeocoderGeometry, com.dlsc.gmapsfx.service.geocoding.GeocoderRequest, com.dlsc.gmapsfx.service.geocoding.GeocodingResult, com.dlsc.gmapsfx.service.geocoding.GeocodingService, com.dlsc.gmapsfx.shapes.MapShapeOptions, com.dlsc.gmapsfx.zoom.MaxZoomResult, com.dlsc.gmapsfx.zoom.MaxZoomService, com.dlsc.gmapsfx.ArrayTester.TestJSO, com.dlsc.gmapsfx.javascript.JavascriptArray, com.dlsc.gmapsfx.javascript.JavascriptFunction
Imports
java.lang.reflect.Constructor, java.util.Map, .WeakHashMap, netscape.javascript.JSObject

Base class for any Google JavaScript object.
Author
Rob Terpilowski

Field Summary

Modifier and TypeField and Description
protected JSObject
jsObject

References Deprecated JSObject is deprecated or references (maybe indirectly) at least one deprecated element.
protected static int
protected static Map<JSObject, JavascriptObject>
protected IJavascriptRuntime
protected String

Constructor Summary

AccessConstructor and Description
protected
protected
JavascriptObject(String
The type of underlying Javascript object to create
type
)

protected
JavascriptObject(String
The type of object to build
type
,
String
A string representation of the object, which can be executed by the Javascript runtime.
stringRepresentation
)

Builds a new JavascriptObject based on a string representation of the object.

protected
JavascriptObject(String
The type of underlying Javascript object to create.
type
,
Object...
Any arguments required to create the object.
args
)

protected
JavascriptObject(String
The type of underlying Javascript object to create.
type
,
Object[]
The array to be passed in.
ary
,
boolean
boolean to indicate the an array is to be used as the parameter rather than breaking up into individual parameters.
isArray
)

protected
JavascriptObject(String
Type of Javascript object to create.
type
,
JSObject
Object returned from Javascript.
jsObject
)
References Deprecated JSObject is deprecated or references (maybe indirectly) at least one deprecated element.

Wraps a Javascript JSObject returned from a function.

Method Summary

Modifier and TypeMethod and Description
protected Boolean

Returns:

The actual value, or if null, returns false.
checkBoolean
(Object
The value from Javascript to be checked.
val
,
Boolean
The default return value, which can be null.
def
)

Checks a returned Javascript value where we expect a boolean but could get null.

protected Integer
protected Object

Returns:

Either null or the value passed in.
checkUndefined
(Object
The value from Javascript to be checked.
val
)

JSObject will return the String "undefined" at certain times, so we need to make sure we're not getting a value that looks valid, but isn't.

public JSObject

Returns:

The underlying Javascript object
getJSObject
()
References Deprecated JSObject is deprecated or references (maybe indirectly) at least one deprecated element.

Get the underlying object used by the Javascript runtime.

protected final String

Returns:

The name of the next variable to create
getNextVariableName
()

Gets the name of the next variable which will be the objectname plus a unique number

protected Object

Returns:

The value of the property
getProperty
(String
The property name
key
)

Get the specified property for this object.

protected <T> T

Returns:

The value of the property
getProperty
(String
The property name
key
,
Class<T>
The property type
type
)

Gets the property and casts to the appropriate type

public String

Returns:

The name of this variable.
getVariableName
()

Gets the name of this variable within the Javascript runtime

protected Object

Returns:

The return value of the function call.
invokeJavascript
(String
The function to invoke
function
)

Invokes a JavaScript function that takes no arguments.

protected Object

Returns:

The result of the function.
invokeJavascript
(String
The function to invoke
function
,
Object...
Any arguments to pass to the function
args
)

Invoke the specified JavaScript function in the JavaScript runtime.

protected <T> T

Returns:

The result of the function.
invokeJavascriptReturnValue
(String
The function to invoke
function
,
Class<T>
The type of object to return
returnType
)

Invokes a JavaScript function that takes no arguments.

protected <T> T

Returns:

The result of the function.
invokeJavascriptReturnValue
(String
The function to invoke
function
,
Class<T>
The type of object to return
returnType
,
Object...
Any arguments to pass to the function
args
)

Invoke the specified JavaScript function in the JavaScript runtime.

protected boolean
protected void
setProperty(String
The property name
propertyName
,
Object
The property value.
propertyValue
)

Sets a property on this Javascript object.

protected void
setProperty(String
The name of the property.
propertyName
,
JavascriptObject
The value of the property.
propertyValue
)

Sets a property on this Javascript object for which the value is a Javascript object itself.

protected void
setProperty(String
The name of the property.
propertyName
,
JavascriptEnum
The value of the property.
propertyValue
)

Sets a property on this Javascript object for which the value is a JavascriptEnum The value is set to what is returned by the getEnumValue() method on the JavascriptEnum

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

jsObjectback to summary
protected JSObject jsObject

References Deprecated

JSObject is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

objectCounterback to summary
protected static int objectCounter
peerRegistryback to summary
protected static Map<JSObject, JavascriptObject> peerRegistry
runtimeback to summary
protected IJavascriptRuntime runtime
variableNameback to summary
protected String variableName

Constructor Detail

JavascriptObjectback to summary
protected JavascriptObject()
JavascriptObjectback to summary
protected JavascriptObject(String type)
Parameters
type:String

The type of underlying Javascript object to create

JavascriptObjectback to summary
protected JavascriptObject(String type, String stringRepresentation)

Builds a new JavascriptObject based on a string representation of the object. This is useful when constructing functions as objects

Parameters
type:String

The type of object to build

stringRepresentation:String

A string representation of the object, which can be executed by the Javascript runtime.

JavascriptObjectback to summary
protected JavascriptObject(String type, Object... args)
Parameters
type:String

The type of underlying Javascript object to create.

args:Object[]

Any arguments required to create the object.

JavascriptObjectback to summary
protected JavascriptObject(String type, Object[] ary, boolean isArray)
Parameters
type:String

The type of underlying Javascript object to create.

ary:Object[]

The array to be passed in.

isArray:boolean

boolean to indicate the an array is to be used as the parameter rather than breaking up into individual parameters.

JavascriptObjectback to summary
protected JavascriptObject(String type, JSObject jsObject)

References Deprecated

JSObject is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Wraps a Javascript JSObject returned from a function.

Parameters
type:String

Type of Javascript object to create.

jsObject:JSObject

Object returned from Javascript.

Method Detail

checkBooleanback to summary
protected Boolean checkBoolean(Object val, Boolean def)

Checks a returned Javascript value where we expect a boolean but could get null.

Parameters
val:Object

The value from Javascript to be checked.

def:Boolean

The default return value, which can be null.

Returns:Boolean

The actual value, or if null, returns false.

checkIntegerback to summary
protected Integer checkInteger(Object val, Integer def)
checkUndefinedback to summary
protected Object checkUndefined(Object val)

JSObject will return the String "undefined" at certain times, so we need to make sure we're not getting a value that looks valid, but isn't.

Parameters
val:Object

The value from Javascript to be checked.

Returns:Object

Either null or the value passed in.

getJSObjectback to summary
public JSObject getJSObject()

References Deprecated

JSObject is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Get the underlying object used by the Javascript runtime.

Returns:JSObject

The underlying Javascript object

getNextVariableNameback to summary
protected final String getNextVariableName()

Gets the name of the next variable which will be the objectname plus a unique number

Returns:String

The name of the next variable to create

getPropertyback to summary
protected Object getProperty(String key)

Get the specified property for this object.

Parameters
key:String

The property name

Returns:Object

The value of the property

getPropertyback to summary
protected <T> T getProperty(String key, Class<T> type)

Gets the property and casts to the appropriate type

Parameters
key:String

The property name

type:Class<T>

The property type

Returns:T

The value of the property

getVariableNameback to summary
public String getVariableName()

Gets the name of this variable within the Javascript runtime

Returns:String

The name of this variable.

invokeJavascriptback to summary
protected Object invokeJavascript(String function)

Invokes a JavaScript function that takes no arguments.

Parameters
function:String

The function to invoke

Returns:Object

The return value of the function call.

invokeJavascriptback to summary
protected Object invokeJavascript(String function, Object... args)

Invoke the specified JavaScript function in the JavaScript runtime.

Parameters
function:String

The function to invoke

args:Object[]

Any arguments to pass to the function

Returns:Object

The result of the function.

invokeJavascriptReturnValueback to summary
protected <T> T invokeJavascriptReturnValue(String function, Class<T> returnType)

Invokes a JavaScript function that takes no arguments.

Parameters
function:String

The function to invoke

returnType:Class<T>

The type of object to return

Returns:T

The result of the function.

invokeJavascriptReturnValueback to summary
protected <T> T invokeJavascriptReturnValue(String function, Class<T> returnType, Object... args)

Invoke the specified JavaScript function in the JavaScript runtime.

Parameters
function:String

The function to invoke

returnType:Class<T>

The type of object to return

args:Object[]

Any arguments to pass to the function

Returns:T

The result of the function.

isMemberDefinedback to summary
protected boolean isMemberDefined(String member)
setPropertyback to summary
protected void setProperty(String propertyName, Object propertyValue)

Sets a property on this Javascript object.

Parameters
propertyName:String

The property name

propertyValue:Object

The property value.

setPropertyback to summary
protected void setProperty(String propertyName, JavascriptObject propertyValue)

Sets a property on this Javascript object for which the value is a Javascript object itself.

Parameters
propertyName:String

The name of the property.

propertyValue:JavascriptObject

The value of the property.

setPropertyback to summary
protected void setProperty(String propertyName, JavascriptEnum propertyValue)

Sets a property on this Javascript object for which the value is a JavascriptEnum The value is set to what is returned by the getEnumValue() method on the JavascriptEnum

Parameters
propertyName:String

The name of the property.

propertyValue:JavascriptEnum

The value of the property.