Package org.codehaus.modello.model
Class BaseElement
- java.lang.Object
-
- org.codehaus.modello.model.BaseElement
-
- Direct Known Subclasses:
CodeSegment
,Model
,ModelField
,ModelType
public abstract class BaseElement extends Object
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
Constructors Constructor Description BaseElement(boolean nameRequired)
BaseElement(boolean nameRequired, String name)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addMetadata(Metadata metadata)
boolean
equals(Object other)
List<String>
getAnnotations()
String
getComment()
Version
getDeprecatedVersion()
String
getDescription()
protected <T extends Metadata>
TgetMetadata(Class<T> type, String key)
String
getName()
VersionRange
getVersionRange()
int
hashCode()
boolean
hasMetadata(String key)
protected boolean
isEmpty(String string)
void
setAnnotations(List<String> annotations)
void
setComment(String comment)
void
setDeprecatedVersion(Version deprecatedVersion)
void
setDescription(String description)
void
setName(String name)
void
setVersionRange(VersionRange versionRange)
void
validate()
abstract void
validateElement()
protected void
validateFieldNotEmpty(String objectName, String fieldName, String value)
-
-
-
Constructor Detail
-
BaseElement
public BaseElement(boolean nameRequired)
-
BaseElement
public BaseElement(boolean nameRequired, String name)
-
-
Method Detail
-
validateElement
public abstract void validateElement() throws ModelValidationException
- Throws:
ModelValidationException
-
getName
public String getName()
-
setName
public void setName(String name)
-
getDescription
public String getDescription()
-
setDescription
public void setDescription(String description)
-
getVersionRange
public VersionRange getVersionRange()
-
setVersionRange
public void setVersionRange(VersionRange versionRange)
-
setDeprecatedVersion
public void setDeprecatedVersion(Version deprecatedVersion)
-
getDeprecatedVersion
public Version getDeprecatedVersion()
-
getComment
public String getComment()
-
setComment
public void setComment(String comment)
-
hasMetadata
public boolean hasMetadata(String key)
-
addMetadata
public void addMetadata(Metadata metadata)
-
validateFieldNotEmpty
protected void validateFieldNotEmpty(String objectName, String fieldName, String value) throws ModelValidationException
- Throws:
ModelValidationException
-
validate
public final void validate() throws ModelValidationException
- Throws:
ModelValidationException
-
isEmpty
protected boolean isEmpty(String string)
-
-