Class FieldDescriptor
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.vilTypes.FieldDescriptor
-
- All Implemented Interfaces:
IMetaField
- Direct Known Subclasses:
AbstractIvmlFieldDescriptor,CompoundTypeDescriptor.SlotDescriptor,ReflectionFieldDescriptor
public abstract class FieldDescriptor extends java.lang.Object implements IMetaField
Implements an abstract field descriptor.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private TypeDescriptor<?>declaringTypeprivate TypeDescriptor<?>fieldTypeprivate java.lang.Stringname
-
Constructor Summary
Constructors Modifier Constructor Description protectedFieldDescriptor(TypeDescriptor<?> declaringType, java.lang.String name, TypeDescriptor<?> fieldType)Creates a field descriptor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description TypeDescriptor<?>getDeclaringType()Returns the declaring type.TypeDescriptor<?>getMetaType()Returns the type to resolve operations on the field itself, e.g., whether the underlying decision variable is defined.java.lang.ObjectgetMetaValue(java.lang.Object owner)Returns the value corresponding togetMetaType().java.lang.StringgetName()Returns the name of the method.java.lang.StringgetSignature()Returns the signature of the method (in terms of VIL types where possible).TypeDescriptor<?>getType()Returns the type of this attribute.abstract java.lang.ObjectgetValue(java.lang.Object owner)Returns the actual value of this field.abstract voidsetValue(java.lang.Object owner, java.lang.Object value)Changes the actual value for this field inowner.-
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.core.model.vilTypes.IMetaField
getJavaSignature, isReadOnly, isStatic
-
-
-
-
Field Detail
-
name
private java.lang.String name
-
fieldType
private TypeDescriptor<?> fieldType
-
declaringType
private TypeDescriptor<?> declaringType
-
-
Constructor Detail
-
FieldDescriptor
protected FieldDescriptor(TypeDescriptor<?> declaringType, java.lang.String name, TypeDescriptor<?> fieldType)
Creates a field descriptor.- Parameters:
declaringType- the declaring typename- the name of the fieldfieldType- the type of the field
-
-
Method Detail
-
getDeclaringType
public TypeDescriptor<?> getDeclaringType()
Returns the declaring type.- Returns:
- the declaring type (may be null in case of a wrapped external Java method)
-
getValue
public abstract java.lang.Object getValue(java.lang.Object owner) throws VilExceptionReturns the actual value of this field.- 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 abstract void setValue(java.lang.Object owner, java.lang.Object value) throws VilExceptionChanges the actual value for this field inowner.- 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()
-
getName
public java.lang.String getName()
Description copied from interface:IMetaFieldReturns the name of the method.- Specified by:
getNamein interfaceIMetaField- Returns:
- the name of the method
-
getSignature
public java.lang.String getSignature()
Description copied from interface:IMetaFieldReturns the signature of the method (in terms of VIL types where possible).- Specified by:
getSignaturein interfaceIMetaField- Returns:
- the signature of the method
-
getType
public TypeDescriptor<?> getType()
Description copied from interface:IMetaFieldReturns the type of this attribute.- Specified by:
getTypein interfaceIMetaField- Returns:
- the type
-
getMetaType
public TypeDescriptor<?> getMetaType()
Returns the type to resolve operations on the field itself, e.g., whether the underlying decision variable is defined. A field must not return a type (null, in particular ifIMetaField.isStatic()). If not null, this class must return a valid value ingetMetaValue(Object).- Returns:
- null
-
getMetaValue
public java.lang.Object getMetaValue(java.lang.Object owner) throws VilExceptionReturns the value corresponding togetMetaType().- Parameters:
owner- the owning object- Returns:
- the actual value
- Throws:
VilException- in case that retrieving the value fails
-
-