com.google.gwt.ajaxloader.client
Class Properties

java.lang.Object
  extended by com.google.gwt.core.client.JavaScriptObject
      extended by com.google.gwt.ajaxloader.client.Properties
Direct Known Subclasses:
AbstractDrawOptions, ChartArea, Color, Color3D, Properties, Query.Options, TextStyle

public abstract class Properties
extends com.google.gwt.core.client.JavaScriptObject

A collection of properties of arbitrary type, for interoperability with non-GWT JavaScript libraries.


Nested Class Summary
static class Properties.TypeException
          An exception thrown by the get methods when the key is found but the value has an unexpected type.
 
Constructor Summary
protected Properties()
           
 
Method Summary
static Properties create()
          Create an empty Properties object.
 java.lang.Boolean getBoolean(java.lang.String key)
          Get a Boolean value mapped to the specified key.
 java.util.Date getDate(java.lang.String key)
          Get a Date object mapped to the specified key.
 java.lang.Double getNumber(java.lang.String key)
          Get a Double value mapped to the specified key.
 com.google.gwt.core.client.JavaScriptObject getObject(java.lang.String key)
          Get a JavaScriptObject mapped to the specified key.
 java.lang.String getString(java.lang.String key)
          Get a String mapped to the specified key.
 void remove(java.lang.String key)
          Remove the property at the specified key.
 void set(java.lang.String key, java.lang.Boolean value)
          Set a property.
 void set(java.lang.String key, java.util.Date value)
          Set a property.
 void set(java.lang.String key, java.lang.Double value)
          Set a property.
 void set(java.lang.String key, com.google.gwt.core.client.JavaScriptObject value)
          Set a property.
 void set(java.lang.String key, java.lang.String value)
          Set a property.
 java.lang.String typeof(java.lang.String key)
          Executes the JavaScript typeof operator against the property with the given key.
 
Methods inherited from class com.google.gwt.core.client.JavaScriptObject
cast, createArray, createFunction, createObject, equals, hashCode, toSource, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Properties

protected Properties()
Method Detail

create

public static Properties create()
Create an empty Properties object.

Returns:
An empty Properties object.

getBoolean

public final java.lang.Boolean getBoolean(java.lang.String key)
                                   throws Properties.TypeException
Get a Boolean value mapped to the specified key.

Parameters:
key - The name of the Boolean property.
Returns:
A Boolean value, or null if the key is not found.
Throws:
Properties.TypeException - if the key is found but the object returned is not a Boolean.

getDate

public final java.util.Date getDate(java.lang.String key)
                             throws com.google.gwt.core.client.JavaScriptException,
                                    Properties.TypeException
Get a Date object mapped to the specified key.

Parameters:
key - The name of the Date property.
Returns:
A Date object, or null if the key is not found.
Throws:
com.google.gwt.core.client.JavaScriptException - if the key is found but the object returned is not a Date.
Properties.TypeException - If the key is found but the value is not an object.

getNumber

public final java.lang.Double getNumber(java.lang.String key)
                                 throws Properties.TypeException
Get a Double value mapped to the specified key.

Parameters:
key - The name of the Double property.
Returns:
A Double value, or null if the key is not found.
Throws:
Properties.TypeException - If the key is found but the value is not a number (integers are fine).

getObject

public final com.google.gwt.core.client.JavaScriptObject getObject(java.lang.String key)
                                                            throws Properties.TypeException
Get a JavaScriptObject mapped to the specified key.

Parameters:
key - The name of the JavaScriptObject property.
Returns:
A JavaScriptObject, or null if the key is not found.
Throws:
Properties.TypeException - If the key is found but the value is not a JavaScriptObject.

getString

public final java.lang.String getString(java.lang.String key)
                                 throws Properties.TypeException
Get a String mapped to the specified key.

Parameters:
key - The name of the String property.
Returns:
A String, or null if the key is not found.
Throws:
Properties.TypeException - If the key is found but the value is not a String.

remove

public final void remove(java.lang.String key)
Remove the property at the specified key.

Parameters:
key - The name of the property to remove.

set

public final void set(java.lang.String key,
                      java.lang.Boolean value)
Set a property.

Parameters:
key - The name of the property.
value - The value of the property.

set

public final void set(java.lang.String key,
                      java.util.Date value)
Set a property.

Parameters:
key - The name of the property.
value - The value of the property.

set

public final void set(java.lang.String key,
                      java.lang.Double value)
Set a property.

Parameters:
key - The name of the property.
value - The value of the property.

set

public final void set(java.lang.String key,
                      com.google.gwt.core.client.JavaScriptObject value)
Set a property.

Parameters:
key - The name of the property.
value - The value of the property.

set

public final void set(java.lang.String key,
                      java.lang.String value)
Set a property.

Parameters:
key - The name of the property.
value - The value of the property.

typeof

public final java.lang.String typeof(java.lang.String key)
Executes the JavaScript typeof operator against the property with the given key. Note that the typeof undefined is "undefined" and the typeof null is "object".

Parameters:
key - The name of the property to type check.
Returns:
The JavaScript type of the property, as defined by the JavaScipt typeof operator.