C
- the supported constraint typepublic abstract class AbstractDefinition<C> extends Object implements Definition<C>
Modifier and Type | Field and Description |
---|---|
protected QName |
name
The qualified definition name
|
Constructor and Description |
---|
AbstractDefinition(QName name)
Creates a new definition with the given name.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Definition<?> other) |
boolean |
equals(Object obj)
Two definitions are equal if their name is equal (namespace and local
part)
|
<T extends C> |
getConstraint(Class<T> constraintType)
Get the constraint with the given constraint type.
Should usually not be called while creating the model, exceptions can be getting mutable constraints where this is intended. |
String |
getDescription()
Get the definition description
|
String |
getDisplayName()
Returns the local part of the qualified name.
|
String |
getIdentifier()
Get the definitions identifier
|
protected <T extends C> |
getInheritedConstraint(Class<T> constraintType)
Get the inherited constraint of the given constraint type.
This implementation returns null , as inheritance is not
supported generally for definitions. |
URI |
getLocation()
Get the location
|
QName |
getName()
Get the definition's qualified name
|
boolean |
hasConstraint(Class<? extends C> constraintType)
Determines if the constraint with the given type is set explicitly for
the definition.
|
int |
hashCode() |
void |
setConstraint(C constraint)
Set a constraint on the definition
|
void |
setConstraintIfNotSet(C constraint)
Set a constraint on the definition if none of the same type has been set
yet.
|
void |
setDescription(String description)
Set the definition description
|
void |
setLocation(URI location)
Set the definition location
|
String |
toString() |
protected final QName name
public AbstractDefinition(QName name)
name
- the qualified definition namepublic <T extends C> T getConstraint(Class<T> constraintType)
Definition
getConstraint
in interface Definition<C>
T
- the constraint typeconstraintType
- the constraint type, see Constraint
Definition.getConstraint(Class)
protected <T extends C> T getInheritedConstraint(Class<T> constraintType)
null
, as inheritance is not
supported generally for definitions.constraintType
- the constraint typenull
if there is none or
inheritance is not allowedpublic boolean hasConstraint(Class<? extends C> constraintType)
constraintType
- the constraint typepublic void setConstraint(C constraint)
constraint
- the constraint to setpublic void setConstraintIfNotSet(C constraint)
constraint
- the constraint to setpublic void setDescription(String description)
description
- the description to setpublic void setLocation(URI location)
location
- the location to setpublic URI getLocation()
Locatable
getLocation
in interface Locatable
null
Locatable.getLocation()
public String getDisplayName()
getDisplayName
in interface Definition<C>
Definition.getDisplayName()
public QName getName()
Definition
getName
in interface Definition<C>
Definition.getName()
public String getDescription()
Definition
getDescription
in interface Definition<C>
null
Definition.getDescription()
public int hashCode()
hashCode
in class Object
Object.hashCode()
public boolean equals(Object obj)
equals
in class Object
Object.equals(Object)
public int compareTo(Definition<?> other)
compareTo
in interface Comparable<Definition<?>>
Comparable.compareTo(Object)
public String getIdentifier()
Definition
getIdentifier
in interface Definition<C>
Definition.getIdentifier()
public String toString()
toString
in class Object
Object.toString()
Build 2013-10-07_11-27-38
Revision 99b27713a799a59a21b0b166eaaea8aaefbf125a