PenProfile 2.x

com.livescribe.configuration
Class Config

java.lang.Object
  extended by com.livescribe.configuration.Config
Direct Known Subclasses:
SystemConfig

public abstract class Config
extends Object

This class contains utility functions for retrieving and storing typed data. Subclasses can provide the data in any way they see fit.

It is up to the implementation to decide what to do in the following cases:

  1. The property name to set or get is null,
  2. The property does not exist, or
  3. The value cannot be represented as the desired type.

One strategy may be to throw, for example, a NumberFormatException if a number is expected, but the value cannot be parsed as a number, and a NullPointerException if the property name is null. This class, however, makes no guarantees.


Field Summary
protected static int VALUE_BOOLEAN
           
protected static int VALUE_DOUBLE
           
protected static int VALUE_LONG
           
protected static int VALUE_STRING
           
 
Constructor Summary
Config()
           
 
Method Summary
abstract  boolean getBooleanValue(String name)
          Gets the value of the specified property as a boolean.
abstract  double getDoubleValue(String name)
          Gets the value of the specified property as a double.
abstract  long getLongValue(String name)
          Gets the value of the specified property as a long.
abstract  String getStringValue(String name)
          Gets the value of the specified property as a string.
abstract  void setBooleanValue(String name, boolean value)
          Sets the specified property to the given boolean value.
abstract  void setDoubleValue(String name, double value)
          Sets the specified property to the given double value.
abstract  void setLongValue(String name, long value)
          Sets the specified property to the given long value.
abstract  void setStringValue(String name, String value)
          Sets the specified property to the given string value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALUE_LONG

protected static final int VALUE_LONG
See Also:
Constant Field Values

VALUE_BOOLEAN

protected static final int VALUE_BOOLEAN
See Also:
Constant Field Values

VALUE_STRING

protected static final int VALUE_STRING
See Also:
Constant Field Values

VALUE_DOUBLE

protected static final int VALUE_DOUBLE
See Also:
Constant Field Values
Constructor Detail

Config

public Config()
Method Detail

getLongValue

public abstract long getLongValue(String name)
Gets the value of the specified property as a long. It is up to the implementation to decide what to do if the specified property name is null, if the property does not exist, or if the value cannot be represented as a long.

Parameters:
name - the property name
Returns:
the property value as a long.

getBooleanValue

public abstract boolean getBooleanValue(String name)
Gets the value of the specified property as a boolean. It is up to the implementation to decide what to do if the specified property name is null, if the property does not exist, or if the value cannot be represented as a boolean.

Parameters:
name - the property name
Returns:
the property value as a boolean.

getStringValue

public abstract String getStringValue(String name)
Gets the value of the specified property as a string. It is up to the implementation to decide what to do if the specified property name is null, if the property does not exist, or if the value cannot be represented as a string.

Parameters:
name - the property name
Returns:
the property value as a string.

getDoubleValue

public abstract double getDoubleValue(String name)
Gets the value of the specified property as a double. It is up to the implementation to decide what to do if the specified property name is null, if the property does not exist, or if the value cannot be represented as a double.

Parameters:
name - the property name
Returns:
the property value as a double.

setLongValue

public abstract void setLongValue(String name,
                                  long value)
Sets the specified property to the given long value. It is up to the implementation to decide what to do if the specified property name is null, if the property does not already exist, or if the value cannot be stored as a long.

Parameters:
name - the property name
value - set the property to this value

setBooleanValue

public abstract void setBooleanValue(String name,
                                     boolean value)
Sets the specified property to the given boolean value. It is up to the implementation to decide what to do if the specified property name is null, if the property does not already exist, or if the value cannot be stored as a boolean.

Parameters:
name - the property name
value - set the property to this value

setStringValue

public abstract void setStringValue(String name,
                                    String value)
Sets the specified property to the given string value. It is up to the implementation to decide what to do if the specified property name is null, if the property does not already exist, or if the value cannot be stored as a string.

Parameters:
name - the property name
value - set the property to this value

setDoubleValue

public abstract void setDoubleValue(String name,
                                    double value)
Sets the specified property to the given double value. It is up to the implementation to decide what to do if the specified property name is null, if the property does not already exist, or if the value cannot be stored as a double.

Parameters:
name - the property name
value - set the property to this value

PenProfile 2.x

Copyright © 2010 Livescribe Inc. All Rights Reserved.
Confidential and subject to NDA.