Class FieldDescriptor

    • Constructor Detail

      • FieldDescriptor

        protected FieldDescriptor​(TypeDescriptor<?> declaringType,
                                  java.lang.String name,
                                  TypeDescriptor<?> fieldType)
        Creates a field descriptor.
        Parameters:
        declaringType - the declaring type
        name - the name of the field
        fieldType - 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 VilException
        Returns the actual value of this field.
        Parameters:
        owner - the owning object (ignored, i.e., shall be null, if IMetaField.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 VilException
        Changes the actual value for this field in owner.
        Parameters:
        owner - the owning object (ignored, i.e., shall be null, if IMetaField.isStatic())
        value - the new value
        Throws:
        VilException - in case that setting the value fails, e.g., as this field is IMetaField.isReadOnly()
      • getName

        public java.lang.String getName()
        Description copied from interface: IMetaField
        Returns the name of the method.
        Specified by:
        getName in interface IMetaField
        Returns:
        the name of the method
      • getSignature

        public java.lang.String getSignature()
        Description copied from interface: IMetaField
        Returns the signature of the method (in terms of VIL types where possible).
        Specified by:
        getSignature in interface IMetaField
        Returns:
        the signature of the method
      • 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 if IMetaField.isStatic()). If not null, this class must return a valid value in getMetaValue(Object).
        Returns:
        null
      • getMetaValue

        public java.lang.Object getMetaValue​(java.lang.Object owner)
                                      throws VilException
        Returns the value corresponding to getMetaType().
        Parameters:
        owner - the owning object
        Returns:
        the actual value
        Throws:
        VilException - in case that retrieving the value fails