com.jstatcom.engine
Class ConfigKeys

java.lang.Object
  extended by com.jstatcom.engine.ConfigKeys
Direct Known Subclasses:
GaussConfigKeys, GRTEConfigKeys, MatlabConfigKeys, MLabConfigKeys, OxConfigKeys, StubMlabConfigKeys

public abstract class ConfigKeys
extends java.lang.Object

This class contains an enumeration of constants that define different types of information needed for a certain engine to run, for example the location of the executable, the temporary directory, etc. This class needs to be subclassed to define the necessary constants for a certain engine.

It implements the typesave enum pattern (Joshua Bloch, "Effective Java", Item 21) . If you compare ConfigKeys, always use the == operator.

Author:
Markus Kraetzig

Constructor Summary
ConfigKeys(java.lang.String name)
          Creates a new config key.
 
Method Summary
abstract  java.lang.String defaultVal()
          Gets the default value for this config key.
 boolean equals(java.lang.Object o)
          Override prevention method to enforce a.equals(b) if and only if a==b.
static java.util.Map<java.lang.String,ConfigKeys> getAllKeys(java.lang.Class c)
          Gets a map of all public keys defined in class c.
 int hashCode()
          Override prevention method invokes super method.
abstract  java.lang.String isValid(java.lang.String value)
          Gets whether value is valid for this.
 java.lang.String name()
          Gets the name of this.
 java.lang.String toString()
          Gets a string representation.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConfigKeys

public ConfigKeys(java.lang.String name)
Creates a new config key.

Parameters:
name - the identifier of the new key
Throws:
java.lang.IllegalArgumentException - if (name == null)
Method Detail

defaultVal

public abstract java.lang.String defaultVal()
Gets the default value for this config key. If no reasonable defaul exists for that setting, this method should return an empty string.

Returns:
string with default setting or "" if no reasonable default exists

equals

public final boolean equals(java.lang.Object o)
Override prevention method to enforce a.equals(b) if and only if a==b.

Overrides:
equals in class java.lang.Object
Parameters:
o - object to compare with
Returns:
true if equal, false otherwise

getAllKeys

public static java.util.Map<java.lang.String,ConfigKeys> getAllKeys(java.lang.Class c)
Gets a map of all public keys defined in class c. All key objects are stored with its name as the respective key.

Returns:
the config keys map
Throws:
java.lang.IllegalArgumentException - if (c.getSuperclass() != ConfigKeys.class) or if (c == null)

hashCode

public final int hashCode()
Override prevention method invokes super method.

Overrides:
hashCode in class java.lang.Object
Returns:
hash code

isValid

public abstract java.lang.String isValid(java.lang.String value)
Gets whether value is valid for this.

Parameters:
value - a string value for this key
Returns:
null if valid, an error string if not valid

name

public final java.lang.String name()
Gets the name of this.

Returns:
the name of the key

toString

public final java.lang.String toString()
Gets a string representation.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this