Jumpi v1.2.0

org.jumpi.spi
Interface Properties

All Known Implementing Classes:
Properties

public interface Properties

A collection interface for String key, value pairs. Essentially identical to J2SE java.util.Properties. Define our own properties since MIDP does not provide java.util.Properties and a major design goal of Jumpi is to keep multiple Java Platform compliancy of the spi interface.

Although only used within a single threaded context, a Properties implementation should be fully thread-safe for set, get and remove operations. Using keys() is only allowed after flagging the Properties as being read-only setReadOnly().


Method Summary
 java.lang.String get(java.lang.String name)
          Get the value of the named property.
 java.lang.String get(java.lang.String name, java.lang.String def)
          Get the value of the named property if existing otherwise return the provided default value.
 java.util.Enumeration keys()
          Return all the property names.
 void remove(java.lang.String name)
          Remove the named property.
 void set(java.lang.String name, java.lang.String value)
          Add the property.
 void setReadOnly()
          Make the properties invariant.
 int size()
          Return the number of properties in the collection.
 

Method Detail

set

public void set(java.lang.String name,
                java.lang.String value)
Add the property. Overwrite the property value if the property exists already.

Parameters:
name - the name of the property.
value - the value of the property.
Throws:
java.lang.IllegalArgumentException - if either name or value are null.
java.lang.IllegalStateException - if read only.
See Also:
get(java.lang.String), setReadOnly()

get

public java.lang.String get(java.lang.String name)
Get the value of the named property.

Parameters:
name - the name of the property.
Returns:
the value of the property or null if the property doesn't exist.
Throws:
java.lang.IllegalArgumentException - if name is null.
See Also:
set(java.lang.String, java.lang.String)

get

public java.lang.String get(java.lang.String name,
                            java.lang.String def)
Get the value of the named property if existing otherwise return the provided default value.

Parameters:
name - the name of the property.
def - the default value of the property
Returns:
the property value or default value provided if the property does not exist.
Throws:
java.lang.IllegalArgumentException - if name is null.
See Also:
set(java.lang.String, java.lang.String)

remove

public void remove(java.lang.String name)
Remove the named property. Has no effect if the property does not exist.

Parameters:
name - the name of the property to remove.
Throws:
java.lang.IllegalArgumentException - if name is null.
java.lang.IllegalStateException - if read only.
See Also:
setReadOnly()

setReadOnly

public void setReadOnly()
Make the properties invariant. Calling set or remove throws IllegalStateExceptions if the instance is read-only.

See Also:
set(java.lang.String, java.lang.String), remove(java.lang.String)

keys

public java.util.Enumeration keys()
Return all the property names. Never use the returned Enumeration at the same time as modifying the properties, since the semantics are undefined. Only allowed when read-only.

Returns:
all the property names.
Throws:
java.lang.IllegalStateException - when not read only.

size

public int size()
Return the number of properties in the collection.

Returns:
the number of properties in the collection.

Jumpi v1.2.0

Copyright 2003, Peter Jonathan Klauser.