Class Def

    • Constructor Detail

      • Def

        Def()
        Constructor for serialization.
      • Def

        public Def​(java.lang.String name,
                   VariableDeclaration[] param,
                   ITemplateElement[] body,
                   TypeDescriptor<?> specifiedType,
                   Template parent)
        Creates a new sub-template ('def').
        Parameters:
        name - the name of the template
        param - the parameter of the template (may be null)
        body - the body elements (may be null)
        parent - the declaring template
        specifiedType - the specified type (may be null if none is given)
    • Method Detail

      • isProtected

        public boolean isProtected()
        Returns whether this Def is protected in visibility.
        Returns:
        true if it is protected, false else
      • setProtected

        public void setProtected​(boolean isProtected)
        Changes whether this Def is protected in visibility.
        Parameters:
        isProtected - true if it is protected, false else
      • getName

        public java.lang.String getName()
        Returns the name of this template.
        Specified by:
        getName in interface IMetaOperation
        Returns:
        the name
      • getSpecifiedType

        public TypeDescriptor<?> getSpecifiedType()
        The specified type. For the actual type see inferType().
        Returns:
        the specified type, may be null if none is given
      • getParameterType

        public IMetaType getParameterType​(int index)
        Description copied from interface: IMetaOperation
        Returns the specified parameter type.
        Specified by:
        getParameterType in interface IMetaOperation
        Parameters:
        index - the index of the parameter to return
        Returns:
        the specified parameter type
      • getJavaSignature

        public java.lang.String getJavaSignature()
        Description copied from interface: IMetaOperation
        Returns the java-like signature of this operation.
        Specified by:
        getJavaSignature in interface IMetaOperation
        Returns:
        the java-like Java signature of this operation
      • getSignature

        public java.lang.String getSignature()
        Description copied from interface: IMetaOperation
        Returns the signature of the method (in terms of VIL types where possible).
        Specified by:
        getSignature in interface IMetaOperation
        Returns:
        the signature of the method
      • acceptsNamedParameters

        public boolean acceptsNamedParameters()
        Description copied from interface: IMetaOperation
        Returns whether the operation accepts named parameters.
        Specified by:
        acceptsNamedParameters in interface IMetaOperation
        Returns:
        true if it accepts named parameters, false else
      • checkEmptyContainerIntializerCompliance

        private boolean checkEmptyContainerIntializerCompliance​(TypeDescriptor<?> result,
                                                                TypeDescriptor<?> specifiedType)
        Checks the given inferred result type and the specified result type specifiedType for type compliance against direct return of an empty container initializer.
        Parameters:
        result - the inferred result type
        specifiedType - the specified result type
        Returns:
        true for compliance, false else
      • isFirstParameterOperand

        public boolean isFirstParameterOperand()
        Description copied from interface: IMetaOperation
        Returns whether the first parameter is the operand.
        Specified by:
        isFirstParameterOperand in interface IMetaOperation
        Returns:
        true if the first parameter is the operand, false else
      • isStatic

        public boolean isStatic()
        Description copied from interface: IMetaOperation
        Returns whether this operation is static.
        Specified by:
        isStatic in interface IMetaOperation
        Returns:
        true if it is static, false else
      • getDeclaringType

        public IMetaType getDeclaringType()
        Description copied from interface: IMetaOperation
        Returns the declaring type.
        Specified by:
        getDeclaringType in interface IMetaOperation
        Returns:
        the declaring type (may be null in case of a wrapped external Java method)
      • isPlaceholder

        public boolean isPlaceholder()
        Description copied from interface: IMetaOperation
        Returns whether this operation is valid or whether it is a placeholder operation in case that the original operation cannot be resolved but the script shall remain executable.
        Specified by:
        isPlaceholder in interface IMetaOperation
        Returns:
        true if this operation is a placeholder, false else
      • getStringValue

        public java.lang.String getStringValue​(IStringValueProvider.StringComparator comparator)
        Description copied from interface: IStringValueProvider
        Returns the string value of this object.
        Specified by:
        getStringValue in interface IStringValueProvider
        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
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • setParent

        protected void setParent​(ILanguageElement parent)
        Description copied from class: AbstractTemplateElement
        Changes the parent. Please override if children must be adjusted according. Shall be called only once per instance, but there is no limitation.
        Overrides:
        setParent in class TemplateBlock
        Parameters:
        parent - the parent
      • isCompatible

        public IMetaOperation.CompatibilityResult isCompatible​(java.lang.Class<?> retType,
                                                               java.lang.Object... params)
        Description copied from interface: IMetaOperation
        Returns whether the operation represented by this instance is compatible to the given return type and parameters. This method does not consider possible unnamed parameter rather than the underlying Java parameter.
        Specified by:
        isCompatible in interface IMetaOperation
        Parameters:
        retType - the return type (may be null in order to ignore this parameter)
        params - the parameters (may be null if there are none, may be classes)
        Returns:
        an instance of IMetaOperation.CompatibilityResult denoting the actual compatibility level
      • isConstructor

        public boolean isConstructor()
        Description copied from interface: IMetaOperation
        Returns whether this operation represents a constructor. Basically, for VIL a constructor is a public static method named "create" which returns an instance of the underlying type. Declared constructors are used for internal purposes.
        Specified by:
        isConstructor in interface IMetaOperation
        Returns:
        true if this operation is a "constructor", false else