ccc.api.types
Class ResourceName

java.lang.Object
  extended by ccc.api.types.ResourceName
All Implemented Interfaces:
java.io.Serializable

public final class ResourceName
extends java.lang.Object
implements java.io.Serializable

Represents a valid resource name in CCC. A valid name must contain one or more characters. Characters must be members of the group [a-zA-Z_0-9]. See the following links for further details on URL encoding: http://en.wikipedia.org/wiki/Percent-encoding http://i-technica.com/whitestuff/urlencodechart.html

Author:
Civic Computing Ltd
See Also:
Serialized Form

Field Summary
static java.lang.String VALID_CHARACTERS
          VALID_CHARACTERS : String.
 
Constructor Summary
ResourceName(java.lang.String stringRepresentation)
          Constructor.
 
Method Summary
 boolean equals(java.lang.Object obj)
          
static ResourceName escape(java.lang.String invalidCharacters)
          Escape a string to provide a valid ResourceName.
 int hashCode()
          
static boolean isValid(java.lang.String value)
          Confirm the specified string is a valid resource name.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

VALID_CHARACTERS

public static final java.lang.String VALID_CHARACTERS
VALID_CHARACTERS : String.

See Also:
Constant Field Values
Constructor Detail

ResourceName

public ResourceName(java.lang.String stringRepresentation)
Constructor. TODO: Make private; add static factory method that handles NULL.

Parameters:
stringRepresentation - The representation of this name - as a string.
Method Detail

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object

escape

public static ResourceName escape(java.lang.String invalidCharacters)
Escape a string to provide a valid ResourceName.

Parameters:
invalidCharacters - A string that may contain invalid characters.
Returns:
A resource name representing the string, where all invalid characters have been escaped to '_'.

isValid

public static boolean isValid(java.lang.String value)
Confirm the specified string is a valid resource name.

Parameters:
value - The potential resource name.
Returns:
True if the string is valid, false otherwise.


Copyright © 2010. All Rights Reserved.