Package org.codehaus.modello.model
Class BaseElement
java.lang.Object
org.codehaus.modello.model.BaseElement
- Direct Known Subclasses:
CodeSegment
,Model
,ModelField
,ModelType
This is the base class for all elements of the model. The name attribute is immutable because it's used as the key.
- Author:
- Jason van Zyl, Trygve Laugstøl, Emmanuel Venisse
-
Constructor Summary
ConstructorsConstructorDescriptionBaseElement
(boolean nameRequired) BaseElement
(boolean nameRequired, String name) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addMetadata
(Metadata metadata) boolean
protected <T extends Metadata>
TgetMetadata
(Class<T> type, String key) getName()
int
hashCode()
boolean
hasMetadata
(String key) protected boolean
void
setAnnotations
(List<String> annotations) void
setComment
(String comment) void
setDeprecatedVersion
(Version deprecatedVersion) void
setDescription
(String description) void
void
setVersionRange
(VersionRange versionRange) final void
validate()
abstract void
protected void
validateFieldNotEmpty
(String objectName, String fieldName, String value)
-
Constructor Details
-
BaseElement
public BaseElement(boolean nameRequired) -
BaseElement
-
-
Method Details
-
validateElement
- Throws:
ModelValidationException
-
getName
-
setName
-
getDescription
-
setDescription
-
getVersionRange
-
setVersionRange
-
setDeprecatedVersion
-
getDeprecatedVersion
-
getComment
-
setComment
-
hasMetadata
-
addMetadata
-
getMetadata
-
validateFieldNotEmpty
protected void validateFieldNotEmpty(String objectName, String fieldName, String value) throws ModelValidationException - Throws:
ModelValidationException
-
validate
- Throws:
ModelValidationException
-
isEmpty
-
equals
-
hashCode
public int hashCode() -
getAnnotations
- Returns:
- the annotations
-
setAnnotations
- Parameters:
annotations
- the annotations to set
-