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 voidaddMetadata(Metadata metadata)booleanequals(Object other)List<String>getAnnotations()StringgetComment()VersiongetDeprecatedVersion()StringgetDescription()protected <T extends Metadata>
TgetMetadata(Class<T> type, String key)StringgetName()VersionRangegetVersionRange()inthashCode()booleanhasMetadata(String key)protected booleanisEmpty(String string)voidsetAnnotations(List<String> annotations)voidsetComment(String comment)voidsetDeprecatedVersion(Version deprecatedVersion)voidsetDescription(String description)voidsetName(String name)voidsetVersionRange(VersionRange versionRange)voidvalidate()abstract voidvalidateElement()protected voidvalidateFieldNotEmpty(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)
-
-