uk.ac.vamsas.objects.utils
Class Properties

java.lang.Object
  extended byuk.ac.vamsas.objects.utils.Properties

public class Properties
extends java.lang.Object


Field Summary
static java.lang.String BOOLEANTYPE
           
static java.lang.String FLOATTYPE
           
static java.lang.String INTEGERTYPE
           
static java.lang.String STRINGTYPE
           
 
Constructor Summary
Properties()
           
 
Method Summary
static boolean addOrReplace(java.util.Vector properties, Property newprop)
          add newprop to properties, or update the value of an existing property with the same exact name and type.
static boolean isBoolean(Property p)
          Boolean content test
static boolean isFloat(Property p)
          Float content test
static boolean isInteger(Property p)
          Integer content test
static boolean isString(Property p)
          String content test
static boolean isType(Property p, java.lang.String typeString)
           
static boolean isValid(Property p)
          validate property p against the known type strings and try to parse the content string accordingly
static Property newProperty(java.lang.String name, java.lang.String type, java.lang.String content)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STRINGTYPE

public static final java.lang.String STRINGTYPE
See Also:
Constant Field Values

FLOATTYPE

public static final java.lang.String FLOATTYPE
See Also:
Constant Field Values

INTEGERTYPE

public static final java.lang.String INTEGERTYPE
See Also:
Constant Field Values

BOOLEANTYPE

public static final java.lang.String BOOLEANTYPE
See Also:
Constant Field Values
Constructor Detail

Properties

public Properties()
Method Detail

newProperty

public static Property newProperty(java.lang.String name,
                                   java.lang.String type,
                                   java.lang.String content)

addOrReplace

public static boolean addOrReplace(java.util.Vector properties,
                                   Property newprop)
add newprop to properties, or update the value of an existing property with the same exact name and type. Note - this routine will stop after encounting the first occurance of a Property with the same name and type, no others will be affected.

Parameters:
properties -
newprop -
Returns:
true if property was added or its value updated. false if no change was made.

isValid

public static boolean isValid(Property p)
validate property p against the known type strings and try to parse the content string accordingly

Parameters:
p -
Returns:
true if the content parses as the given type (if it is known) TODO: decide if an isValidType method is also necessary.

isString

public static boolean isString(Property p)
String content test

Parameters:
p -
Returns:
true if the property is a string

isFloat

public static boolean isFloat(Property p)
Float content test

Parameters:
p -
Returns:
true if the property is a string

isInteger

public static boolean isInteger(Property p)
Integer content test

Parameters:
p -
Returns:
true if the property is a string

isBoolean

public static boolean isBoolean(Property p)
Boolean content test

Parameters:
p -
Returns:
true if the property is a string

isType

public static boolean isType(Property p,
                             java.lang.String typeString)
Parameters:
p - the property to test for type
typeString - one of the string constants in this class
Returns:
true if p is of type 'typeString'