com.ibm.commerce.rules
Class RuleServiceKey

java.lang.Object
  |
  +--com.ibm.commerce.rules.RuleServiceKey
All Implemented Interfaces:
java.lang.Comparable

public class RuleServiceKey
extends java.lang.Object
implements java.lang.Comparable

Encapsulates the properties which define a unique key for a rule service. A rule service belongs to a store.

See Also:
Comparable

Field Summary
static java.lang.String COPYRIGHT
           
 
Constructor Summary
protected RuleServiceKey()
           
  RuleServiceKey(java.lang.String name, java.lang.Number storeId)
          Creates a rule service key with the specified service name and store ID.
 
Method Summary
 int compareTo(java.lang.Object o)
           
 int compareTo(RuleServiceKey rhs)
          Rule service keys are ordered first by store ID, then by name.
static RuleServiceKey create(java.lang.String s)
          Creates a rule service key from the specified string representation, unless parsing fails.
 boolean equals(java.lang.Object o)
          Rule service keys are equal iff all properties are equal.
 boolean equals(RuleServiceKey rhs)
          Rule service keys are equal iff all properties are equal.
 java.lang.String getName()
           
 java.lang.Number getStoreId()
           
 int hashCode()
           
protected static RuleServiceKey parse(java.lang.String s)
          Parses a string representation of a rule service key, returning the corresponding key if the parsing works.
protected  void setName(java.lang.String newName)
           
protected  void setStoreId(java.lang.Number newStoreId)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
Constructor Detail

RuleServiceKey

protected RuleServiceKey()

RuleServiceKey

public RuleServiceKey(java.lang.String name,
                      java.lang.Number storeId)
Creates a rule service key with the specified service name and store ID.
Method Detail

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable
See Also:
Comparable

compareTo

public int compareTo(RuleServiceKey rhs)
Rule service keys are ordered first by store ID, then by name.
Parameters:
rhs - A rule service key.
Returns:
int

create

public static RuleServiceKey create(java.lang.String s)
                             throws InvalidRuleServiceKeyException
Creates a rule service key from the specified string representation, unless parsing fails.
See Also:
parse(String)

equals

public boolean equals(java.lang.Object o)
Rule service keys are equal iff all properties are equal.
Overrides:
equals in class java.lang.Object
Parameters:
rhs - A rule service key.
Returns:
boolean

equals

public boolean equals(RuleServiceKey rhs)
Rule service keys are equal iff all properties are equal.
Parameters:
rhs - A rule service key.
Returns:
boolean

getName

public java.lang.String getName()

getStoreId

public java.lang.Number getStoreId()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

parse

protected static RuleServiceKey parse(java.lang.String s)
                               throws java.text.ParseException
Parses a string representation of a rule service key, returning the corresponding key if the parsing works.
Parameters:
s - A string representation of a rule service key. Expected to be of the form "serviceName[storeId]". For example, "myService[1]". Neither the service name nor the store ID may be empty. For example, "[2]" and "myService[]" are invalid. Also, the store ID must be a number. For example, "myService[myStore]" is invalid.
Throws:
InvalidRuleServiceKeyException - Indicates that the string representation was invalid.

setName

protected void setName(java.lang.String newName)

setStoreId

protected void setStoreId(java.lang.Number newStoreId)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object