Class CompoundTypeDescriptor.SlotDescriptor
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.vilTypes.FieldDescriptor
-
- net.ssehub.easy.instantiation.core.model.vilTypes.CompoundTypeDescriptor.SlotDescriptor
-
- All Implemented Interfaces:
IModifierHolder,IMetaField
- Enclosing class:
- CompoundTypeDescriptor
public static class CompoundTypeDescriptor.SlotDescriptor extends FieldDescriptor implements IModifierHolder
A slot field descriptor for compounds.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private Expressionexpressionprivate booleanisConstantprivate java.util.List<IModifier>modifiers
-
Constructor Summary
Constructors Constructor Description SlotDescriptor(CompoundTypeDescriptor declaringType, VariableDeclaration var)Creates a slot descriptor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExpressiongetExpression()Returns the initialization expression.java.lang.StringgetJavaSignature()Returns the java-like signature of this operation.IModifiergetModifier(int index)Returns the specified modifier.intgetModifierCount()Returns the number of modifiers.java.lang.ObjectgetValue(java.lang.Object owner)Returns the actual value of this field.booleanhasModifier(IModifier modifier)Returns whether this variable declaration has a givenmodifier.booleanisConstant()Returns whether this slot is constant or not.booleanisReadOnly()Returns whether the field is read-only.booleanisStatic()Returns whether the field is static.voidsetValue(java.lang.Object owner, java.lang.Object value)Changes the actual value for this field inowner.-
Methods inherited from class net.ssehub.easy.instantiation.core.model.vilTypes.FieldDescriptor
getDeclaringType, getMetaType, getMetaValue, getName, getSignature, getType
-
-
-
-
Field Detail
-
modifiers
private java.util.List<IModifier> modifiers
-
expression
private Expression expression
-
isConstant
private boolean isConstant
-
-
Constructor Detail
-
SlotDescriptor
public SlotDescriptor(CompoundTypeDescriptor declaringType, VariableDeclaration var)
Creates a slot descriptor.- Parameters:
declaringType- the declaring compound typevar- the variable declaration representing the variable
-
-
Method Detail
-
getJavaSignature
public java.lang.String getJavaSignature()
Description copied from interface:IMetaFieldReturns the java-like signature of this operation.- Specified by:
getJavaSignaturein interfaceIMetaField- Returns:
- the java-like Java signature of this operation
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:IMetaFieldReturns whether the field is read-only. Please note that this method provides a "static" information, i.e., it cannot change during script execution. If a field can be modified at all, this method shall returntrueand determine when the value is changed, whether the actual access is permitted. In contrast, if it is known that the field cannot be changed at all, this method shall returnfalse.- Specified by:
isReadOnlyin interfaceIMetaField- Returns:
trueif the field is read-only,falseelse
-
isConstant
public boolean isConstant()
Returns whether this slot is constant or not. By default, a slot is always not constant.- Returns:
- True if this slot is a constant. False otherwise.
-
isStatic
public boolean isStatic()
Description copied from interface:IMetaFieldReturns whether the field is static.- Specified by:
isStaticin interfaceIMetaField- Returns:
trueif the field is static,falseelse
-
getValue
public java.lang.Object getValue(java.lang.Object owner) throws VilExceptionDescription copied from class:FieldDescriptorReturns the actual value of this field.- Specified by:
getValuein classFieldDescriptor- Parameters:
owner- the owning object (ignored, i.e., shall be null, ifIMetaField.isStatic())- Returns:
- the actual value
- Throws:
VilException- in case that retrieving the value fails
-
setValue
public void setValue(java.lang.Object owner, java.lang.Object value) throws VilExceptionDescription copied from class:FieldDescriptorChanges the actual value for this field inowner.- Specified by:
setValuein classFieldDescriptor- Parameters:
owner- the owning object (ignored, i.e., shall be null, ifIMetaField.isStatic())value- the new value- Throws:
VilException- in case that setting the value fails, e.g., as this field isIMetaField.isReadOnly()
-
getModifierCount
public int getModifierCount()
Description copied from interface:IModifierHolderReturns the number of modifiers.- Specified by:
getModifierCountin interfaceIModifierHolder- Returns:
- the number of modifiers
-
getModifier
public IModifier getModifier(int index)
Description copied from interface:IModifierHolderReturns the specified modifier.- Specified by:
getModifierin interfaceIModifierHolder- Parameters:
index- the 0-based index of the modifier to return- Returns:
- the specified modifier
-
hasModifier
public boolean hasModifier(IModifier modifier)
Description copied from interface:IModifierHolderReturns whether this variable declaration has a givenmodifier.- Specified by:
hasModifierin interfaceIModifierHolder- Parameters:
modifier- the modifier to search for- Returns:
trueif this variable declaration has themodifierattached,falseelse
-
getExpression
public Expression getExpression()
Returns the initialization expression.- Returns:
- the initialization expression, may be null if there is none
-
-