Class JavaAttribute
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.artifactModel.FragmentArtifact
-
- net.ssehub.easy.instantiation.java.artifacts.JavaFragmentArtifact
-
- net.ssehub.easy.instantiation.java.artifacts.JavaParentFragmentArtifact
-
- net.ssehub.easy.instantiation.java.artifacts.JavaAttribute
-
- All Implemented Interfaces:
IArtifact,IStringValueProvider,IVilType,IJavaParent
public class JavaAttribute extends JavaParentFragmentArtifact
Represents a Java attribute.- Author:
- Holger Eichelberger, Sass
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider
IStringValueProvider.StringComparator
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringattributeNameprivate org.eclipse.jdt.core.dom.FieldDeclarationfieldDeclarationprivate static EASyLoggerFactory.EASyLoggerlogger
-
Constructor Summary
Constructors Constructor Description JavaAttribute(org.eclipse.jdt.core.dom.FieldDeclaration node, java.lang.String name, IJavaParent parent)Default Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(IArtifactVisitor visitor)Visits this artifact (and dependent on the visitor also contained artifacts and fragments) using the given visitor.Set<JavaAnnotation>annotations()Returns the annotations of this attribute.voiddelete()Deletes this artifact.ArtifactModelgetArtifactModel()Returns theArtifactModel.BinarygetBinary()Returns the binary representation of the contents of this artifact for manipulation.(package private) org.eclipse.jdt.core.dom.FieldDeclarationgetFieldDeclaration()Getter for the FieldDeclaration of the Attribute.java.lang.StringgetName()Returns the name of this artifact.java.lang.StringgetStringValue(IStringValueProvider.StringComparator comparator)Returns the string value of this object.TextgetText()Returns the textual representation of the contents of this artifact for manipulation.voidmakeConstant()Makes an attribute constant.voidmakeVariable()Makes a constant attribute variable.voidrename(java.lang.String name)Renames this artifact.voidsetValue(java.lang.Object value)Defines the (initial) value of this attribute.private booleantestIfModifierExists(org.eclipse.jdt.core.dom.Modifier.ModifierKeyword keyword, java.util.List<org.eclipse.jdt.core.dom.IExtendedModifier> modifierList)Test if a modifier keyword is already present.-
Methods inherited from class net.ssehub.easy.instantiation.java.artifacts.JavaParentFragmentArtifact
annotations, deleteChild, notifyChildChanged
-
Methods inherited from class net.ssehub.easy.instantiation.java.artifacts.JavaFragmentArtifact
getNameSafe, getParent, notifyChanged, store, update
-
Methods inherited from class net.ssehub.easy.instantiation.core.model.artifactModel.FragmentArtifact
exists, lastModification
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.ssehub.easy.instantiation.java.artifacts.IJavaParent
store
-
-
-
-
Field Detail
-
logger
private static EASyLoggerFactory.EASyLogger logger
-
fieldDeclaration
private org.eclipse.jdt.core.dom.FieldDeclaration fieldDeclaration
-
attributeName
private java.lang.String attributeName
-
-
Constructor Detail
-
JavaAttribute
public JavaAttribute(org.eclipse.jdt.core.dom.FieldDeclaration node, java.lang.String name, IJavaParent parent)Default Constructor.- Parameters:
node- The FieldDeclaration nodename- The name of the attribute.parent- the parent artifact or fragment
-
-
Method Detail
-
delete
public void delete() throws VilExceptionDescription copied from interface:IArtifactDeletes this artifact.- Specified by:
deletein interfaceIArtifact- Overrides:
deletein classJavaFragmentArtifact- Throws:
VilException- in case of serious problems so that this operation cannot continue
-
getName
public java.lang.String getName() throws VilExceptionDescription copied from interface:IArtifactReturns the name of this artifact.- Returns:
- the name of this artifact
- Throws:
VilException- in case of serious problems so that this operation cannot continue
-
rename
public void rename(java.lang.String name) throws VilExceptionDescription copied from interface:IArtifactRenames this artifact.- Parameters:
name- the new name of this artifact- Throws:
VilException- in case of serious problems so that this operation cannot continue
-
getText
public Text getText() throws VilException
Description copied from interface:IArtifactReturns the textual representation of the contents of this artifact for manipulation. In case of binary artifacts, the returned object may be empty.- Returns:
- the textual representation of the contents
- Throws:
VilException- in case of obtaining the representation causes serious problems
-
getBinary
public Binary getBinary() throws VilException
Description copied from interface:IArtifactReturns the binary representation of the contents of this artifact for manipulation.- Returns:
- the binary representation of the contents
- Throws:
VilException- in case of obtaining the representation causes serious problems
-
accept
public void accept(IArtifactVisitor visitor)
Description copied from interface:IArtifactVisits this artifact (and dependent on the visitor also contained artifacts and fragments) using the given visitor.- Parameters:
visitor- the visitor used for visiting this artifact
-
annotations
public Set<JavaAnnotation> annotations()
Returns the annotations of this attribute.- Returns:
- An ArraySet with all annotations
-
setValue
public void setValue(java.lang.Object value)
Defines the (initial) value of this attribute.- Parameters:
value- the value of this attribute
-
makeConstant
public void makeConstant()
Makes an attribute constant.
-
testIfModifierExists
private boolean testIfModifierExists(org.eclipse.jdt.core.dom.Modifier.ModifierKeyword keyword, java.util.List<org.eclipse.jdt.core.dom.IExtendedModifier> modifierList)Test if a modifier keyword is already present.- Parameters:
keyword- The modifier keywordmodifierList- Live ordered list with modifiers.- Returns:
- true if keyword is present
-
makeVariable
public void makeVariable()
Makes a constant attribute variable.
-
getFieldDeclaration
org.eclipse.jdt.core.dom.FieldDeclaration getFieldDeclaration()
Getter for the FieldDeclaration of the Attribute.- Returns:
- Returns the FieldDeclaration of the Attribute.
-
getStringValue
public java.lang.String getStringValue(IStringValueProvider.StringComparator comparator)
Description copied from interface:IStringValueProviderReturns the string value of this object.- Parameters:
comparator- if the sequence of elements, e.g., in case of collections, shall be ordered according to the comparator, null if the original sequence shall be returned- Returns:
- the string value
-
getArtifactModel
public ArtifactModel getArtifactModel()
Description copied from interface:IJavaParentReturns theArtifactModel.- Returns:
- artifactmodel
-
-