org.netbeans.modules.server/0 1.20

org.netbeans.api.server.properties
Class InstanceProperties

java.lang.Object
  extended by org.netbeans.api.server.properties.InstanceProperties

public abstract class InstanceProperties
extends Object

The set of properties to persist. Every property set is persisted unless the whole object is not removed by the remove() call.

In the scope of namespace used in InstancePropertiesManager the object has assigned unique id identifying it.


Constructor Summary
InstanceProperties(String id)
          Creates the new InstanceProperties.
 
Method Summary
abstract  boolean getBoolean(String key, boolean def)
          Returns the value of the given property.
abstract  double getDouble(String key, double def)
          Returns the value of the given property.
abstract  float getFloat(String key, float def)
          Returns the value of the given property.
 String getId()
          Returns unique id of these properties.
abstract  int getInt(String key, int def)
          Returns the value of the given property.
abstract  long getLong(String key, long def)
          Returns the value of the given property.
abstract  String getString(String key, String def)
          Returns the value of the given property.
abstract  void putBoolean(String key, boolean value)
          Associates the specified value with the specified property.
abstract  void putDouble(String key, double value)
          Associates the specified value with the specified property.
abstract  void putFloat(String key, float value)
          Associates the specified value with the specified property.
abstract  void putInt(String key, int value)
          Associates the specified value with the specified property.
abstract  void putLong(String key, long value)
          Associates the specified value with the specified property.
abstract  void putString(String key, String value)
          Associates the specified value with the specified property.
abstract  void remove()
          Removes this instance from the persistent space.
abstract  void removeKey(String key)
          Removes the value of the given property, if any.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstanceProperties

public InstanceProperties(String id)
Creates the new InstanceProperties.

Parameters:
id - id of the properties, unique in the scope of the namespace
See Also:
InstancePropertiesManager
Method Detail

getId

public final String getId()
Returns unique id of these properties. It is guaranteed that this id is unique in the scope of single namespace used in manager (however it is not related directly to it).

Client may use it for its own purposes (don't have to), but client can't influence the actual value of id in any way.

Returns:
id of the properties unique in the scope of the property set
See Also:
InstancePropertiesManager, InstancePropertiesManager.createProperties(String)

getString

public abstract String getString(String key,
                                 String def)
Returns the value of the given property. If the value was not assigned to the property default value is returned. This method is designed to be used in conjuction with putString(String, String).

Parameters:
key - name of the property
def - default value
Returns:
the value of the property or defined default value

putString

public abstract void putString(String key,
                               String value)
Associates the specified value with the specified property. This method is expected to be used in conjuction with getString(String, String).

Parameters:
key - name of the property
value - value to set

getBoolean

public abstract boolean getBoolean(String key,
                                   boolean def)
Returns the value of the given property. If the value was not assigned to the property or it is not valid integer the default value is returned. Valid stored values are "true" and "false" (case insensitive). This method is designed to be used in conjuction with putBoolean(String, boolean).

Parameters:
key - name of the property
def - default value
Returns:
the value of the property or defined default value

putBoolean

public abstract void putBoolean(String key,
                                boolean value)
Associates the specified value with the specified property. This method is expected to be used in conjuction with getBoolean(String, boolean).

Parameters:
key - name of the property
value - value to set

getInt

public abstract int getInt(String key,
                           int def)
Returns the value of the given property. If the value was not assigned to the property or it is not valid integer the default value is returned. Valid string values associated with the property are values parseable with Integer.parseInt(String). However this method is designed to be used in conjuction with putInt(String, int).

Parameters:
key - name of the property
def - default value
Returns:
the value of the property or defined default value

putInt

public abstract void putInt(String key,
                            int value)
Associates the specified value with the specified property. This method is expected to be used in conjuction with getInt(String, int).

Parameters:
key - name of the property
value - value to set

getLong

public abstract long getLong(String key,
                             long def)
Returns the value of the given property. If the value was not assigned to the property or it is not valid long the default value is returned. Valid string values associated with the property are values parseable with Long.parseLong(String). However this method is designed to be used in conjuction with putLong(String, long).

Parameters:
key - name of the property
def - default value
Returns:
the value of the property or defined default value

putLong

public abstract void putLong(String key,
                             long value)
Associates the specified value with the specified property. This method is expected to be used in conjuction with getLong(String, long).

Parameters:
key - name of the property
value - value to set

getFloat

public abstract float getFloat(String key,
                               float def)
Returns the value of the given property. If the value was not assigned to the property or it is not valid float the default value is returned. Valid string values associated with the property are values parseable with Float.parseFloat(String). However this method is designed to be used in conjuction with putFloat(String, float).

Parameters:
key - name of the property
def - default value
Returns:
the value of the property or defined default value

putFloat

public abstract void putFloat(String key,
                              float value)
Associates the specified value with the specified property. This method is expected to be used in conjuction with getFloat(String, float).

Parameters:
key - name of the property
value - value to set

getDouble

public abstract double getDouble(String key,
                                 double def)
Returns the value of the given property. If the value was not assigned to the property or it is not valid double the default value is returned. Valid string values associated with the property are values parseable with Double.parseDouble(String). However this method is designed to be used in conjuction with putDouble(String, double).

Parameters:
key - name of the property
def - default value
Returns:
the value of the property or defined default value

putDouble

public abstract void putDouble(String key,
                               double value)
Associates the specified value with the specified property. This method is expected to be used in conjuction with getDouble(String, double).

Parameters:
key - name of the property
value - value to set

removeKey

public abstract void removeKey(String key)
Removes the value of the given property, if any.

Parameters:
key - name of the property

remove

public abstract void remove()
Removes this instance from the persistent space. All values of previously set are lost. The result of call to InstancePropertiesManager.getProperties(String) with appropriate parameter will not contain this set of properties anymore.

Return value of any method after removal is not defined and most likely will lead to IllegalStateException.


org.netbeans.modules.server/0 1.20

Built on May 25 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.