de.smartics.properties.api.core.domain
Class PropertyKey

Package class diagram package PropertyKey
java.lang.Object
  extended by de.smartics.properties.api.core.domain.PropertyKey
All Implemented Interfaces:
Serializable, Comparable< PropertyKey>

public final class PropertyKey
     
     
extends Object
implements Serializable, Comparable< PropertyKey>

Defines a property key information. A property key uniquely identifies a property. It contains a name that is scoped by the name of the property set. That is, the name is only unique within its property set. To create the fully qualified property key, call toString().

See Also:
Serialized Form

Constructor Summary
PropertyKey(String name)
          Convenience constructor without a property set name.
PropertyKey(String propertySet, String name)
          Default constructor.
 
Method Summary
 int compareTo(PropertyKey o)
           
static PropertyKey create(String qualifiedName)
          Creates an instance for the given qualified name.
static PropertyKey create(String qualifiedName, char separator)
          Creates an instance for the given qualified name.
static PropertyKey create(String propertySet, String name)
          Creates an instance for the given set and name.
 boolean equals(Object object)
           
 String getName()
          Returns the name of the property.
 String getPropertySet()
          Returns the name of the set the property belongs to.
 int hashCode()
           
 String toString()
          Returns the string representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PropertyKey

public PropertyKey(String name)
            throws IllegalArgumentException
Convenience constructor without a property set name.

Parameters:
name - the name of the property.
Throws:
IllegalArgumentException - if name is blank.

PropertyKey

public PropertyKey(String propertySet,
                   String name)
            throws IllegalArgumentException
Default constructor.

Parameters:
propertySet - the name of the set the property belongs to.
name - the name of the property.
Throws:
IllegalArgumentException - if propertySet is blank but not null or if name is blank.
Method Detail

create

public static PropertyKey create(String qualifiedName)
Creates an instance for the given qualified name.

The qualified name consists of two part that are separated by a 'at' ( @) sign. The first part is the name of the property set, the second part the name of the property.

Example:

my-set@my.property.name

The last 'at' sign is significant for the separation. That is, the property set name may contain any number of 'at' signs. An 'at' sign at the end of the qualified name is ignored.

Parameters:
qualifiedName - a name optionally prefixed with a property set name separated by a 'at' ( @) sign.
Returns:
the created instance.

create

public static PropertyKey create(String qualifiedName,
                                 char separator)
                          throws de.smartics.util.lang.BlankArgumentException
Creates an instance for the given qualified name.

Parameters:
qualifiedName - a name optionally prefixed with a property set name separated by the last occurrence (excluding the very end) of the separator.
separator - the separator to use if for some reason the default is not appropriate.
Returns:
the created instance.
Throws:
de.smartics.util.lang.BlankArgumentException - if qualifiedName is blank.

create

public static PropertyKey create(String propertySet,
                                 String name)
                          throws IllegalArgumentException
Creates an instance for the given set and name.

Parameters:
propertySet - the name of the set the property belongs to.
name - the name of the property.
Returns:
the created instance.
Throws:
IllegalArgumentException - if propertySet is blank but not null or if name is blank.

getPropertySet

public String getPropertySet()
Returns the name of the set the property belongs to. This is the scope within the name is unique. It may be null (which indicates that the scope is global), but is must not be blank.

Returns:
the name of the set the property belongs to.

getName

public String getName()
Returns the name of the property.

This value must not be null.

Returns:
the name of the property.

compareTo

public int compareTo(PropertyKey o)
Specified by:
compareTo in interface Comparable<PropertyKey>

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object object)
Overrides:
equals in class Object

toString

public String toString()
Returns the string representation of the object.

Overrides:
toString in class Object
Returns:
the string representation of the object.


Copyright © 2012-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.