com.novell.admin.ns
Class StringStrategy

java.lang.Object
  |
  +--com.novell.admin.ns.StringStrategy
All Implemented Interfaces:
Strategy, ValueStrategy

public abstract class StringStrategy
extends java.lang.Object
implements ValueStrategy

Abstract class which may be extended for syntax strategies that use String as the value type.

Methods in this class and any subclasses are not intended to be used directly by an application. These methods are intended to be use by ValueComponent and syntax classes.


Constructor Summary
StringStrategy()
           
 
Method Summary
 boolean canCreateValue(java.lang.Object obj)
          Checks to see if a Value could be created from some object.
 long compare(ValueComponent obj1, ValueComponent obj2)
          Compares one StringValue to another for sorting.
 ValueComponent createValueComponent()
          Creates a StringValue using an empty string as the default.
 ValueComponent createValueComponent(java.lang.Object obj)
          Creates a StringValue from an Object.
 boolean equals(ValueComponent obj1, ValueComponent obj2)
          Tests to see one ValueComponent is equal to another.
protected  boolean equalsIgnoreCase(ValueComponent obj1, ValueComponent obj2)
          Performs an ignore-case equals test for two StringValue components.
 boolean isLegalString(java.lang.String s)
          Checks to see if a string contains only legal characters.
 boolean isWithinBounds(ValueComponent comp, long lowerBound, long upperBound)
          Tests to see a ValueComponent is within bounds.
protected  boolean stringIsValid(java.lang.String validChars, java.lang.String s)
          Checks to see if a String contains only valid characters.
 java.lang.String toString(ValueComponent obj)
          Converts a ValueComponent to a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringStrategy

public StringStrategy()
Method Detail

equals

public boolean equals(ValueComponent obj1,
                      ValueComponent obj2)
Tests to see one ValueComponent is equal to another.
Parameters:
obj1 - First ValueComponent which must be a StringValue.
obj2 - Second ValueComponent which should be a StringValue.
Returns:
True if the two StringValues are identical, false otherwise.

equalsIgnoreCase

protected final boolean equalsIgnoreCase(ValueComponent obj1,
                                         ValueComponent obj2)
Performs an ignore-case equals test for two StringValue components.
Parameters:
obj1 - First StringValue.
obj2 - Second StringValue.
Returns:
True if the two StringValues are equal, false otherwise.

compare

public long compare(ValueComponent obj1,
                    ValueComponent obj2)
Compares one StringValue to another for sorting.
Parameters:
obj1 - First value component which must be a StringValue.
obj2 - Second value component which must be a StringValue.
Returns:
0 if equal, greater than 1 for obj1>obj2 or less than 1 for obj1

toString

public java.lang.String toString(ValueComponent obj)
Converts a ValueComponent to a string.
Parameters:
obj - ValueComponent to convert.
Returns:
The string representation of this ValueComponent.

canCreateValue

public boolean canCreateValue(java.lang.Object obj)
Checks to see if a Value could be created from some object.
Specified by:
canCreateValue in interface ValueStrategy
Parameters:
obj - The object to test against.
Returns:
True if 'obj' could be used to construct a Value, false otherwise.

createValueComponent

public ValueComponent createValueComponent(java.lang.Object obj)
                                    throws ComponentCreationException
Creates a StringValue from an Object.
Parameters:
obj - Object used to create the Value.
Returns:
Newly created Value.
Throws:
ComponentCreationException - if Object can't be used to create the Value.

createValueComponent

public ValueComponent createValueComponent()
Creates a StringValue using an empty string as the default.
Returns:
A newly created StringValue.

isLegalString

public boolean isLegalString(java.lang.String s)
Checks to see if a string contains only legal characters.
Parameters:
s - The String to check.
Returns:
True.

isWithinBounds

public boolean isWithinBounds(ValueComponent comp,
                              long lowerBound,
                              long upperBound)
Tests to see a ValueComponent is within bounds.
Parameters:
comp - The component to test.
lowerBound - The lower bound for the test.
upperBound - The upper bound for the test.
Returns:
true is the ValueComponent is within lowerBound and upperBound, false otherwise.

stringIsValid

protected boolean stringIsValid(java.lang.String validChars,
                                java.lang.String s)
Checks to see if a String contains only valid characters.
Parameters:
validChars - A String containing all valid characters.
s - The String to check.
Returns:
true if 's' only contains characters found in 'validChars'.


API Documentation Copyright © 1998-2003 Novell, Inc. All rights reserved.
NDS is a registered trademark of Novell, Inc. in the United States and other countries.
Generated December 17 2003 1746.