Class Utils


  • public class Utils
    extends java.lang.Object
    Some utility methods. Currently it is unsure how much access to pure variable declarations VIL actually needs. Here are some accessor methods for VIL compliant types but, however, the results are actually not cached!
    Author:
    Holger Eichelberger
    • Constructor Detail

      • Utils

        private Utils()
        Prevents external creation.
    • Method Detail

      • getAttributeDeclaration

        public static IvmlDeclaration getAttributeDeclaration​(Configuration configuration,
                                                              java.lang.String name)
        Returns a matching attribute declaration.
        Parameters:
        configuration - the configuration to return the declaration for
        name - the name of the attribute to be returned
        Returns:
        the attribute declaration or null if not found
      • determineReturnType

        protected static TypeDescriptor<?> determineReturnType​(IDatatype type,
                                                               TypeRegistry registry,
                                                               boolean specific)
                                                        throws VilException
        Determines the VIL/VTL return type for the given IVML type.
        Parameters:
        type - the IVML type
        registry - the actual type registry (may be null, result is then IvmlTypes.decisionVariableType()
        specific - resolve for the specific IVML type or for IVML specific dynamic type descriptors
        Returns:
        the return type
        Throws:
        VilException - in case that creating the type fails
      • determineGenerics

        protected static TypeDescriptor<?>[] determineGenerics​(IDatatype type,
                                                               TypeRegistry registry,
                                                               boolean specific)
                                                        throws VilException
        Determines the VIL types for the given generic types.
        Parameters:
        type - the type to take the generic types from
        registry - the actual type registry (may be null, result is then IvmlTypes.decisionVariableType()
        specific - resolve for the specific IVML type or for IVML specific dynamic type descriptors
        Returns:
        the generic types
        Throws:
        VilException - in case that creating a type fails
      • isCompatibleToDecisionVariable

        protected static IMetaOperation.CompatibilityResult isCompatibleToDecisionVariable​(java.lang.Object param)
        Generic implementation of the compatibility method for a parameter of type DecisionVariable.
        Parameters:
        param - the actual parameter
        Returns:
        the compatibility result
      • isCompatibleToDecisionVariable

        protected static IMetaOperation.CompatibilityResult isCompatibleToDecisionVariable​(java.lang.Object[] params)
        Generic implementation of the compatibility method for one parameter of type DecisionVariable.
        Parameters:
        params - the actual parameters
        Returns:
        the compatibility result
      • isCompatible

        protected static IMetaOperation.CompatibilityResult isCompatible​(java.lang.Object[] params,
                                                                         java.lang.Class<?> paramType)
        Generic implementation of the compatibility method for one parameter.
        Parameters:
        params - the actual parameters
        paramType - the expected parameter type
        Returns:
        the compatibility result
      • isCompatible

        protected static IMetaOperation.CompatibilityResult isCompatible​(java.lang.Object param,
                                                                         java.lang.Class<?> paramType)
        Generic implementation of the compatibility method for a parameter.
        Parameters:
        param - the actual parameter
        paramType - the expected parameter type
        Returns:
        the compatibility result
      • addOperation

        protected static void addOperation​(OperationDescriptor operation,
                                           java.util.Map<java.lang.String,​OperationDescriptor> operations)
        Adds a descriptor to the given signature-descriptor map.
        Parameters:
        operation - the operation to be added
        operations - the operations (signature-descriptor) (to be modified as a side effect)
      • addField

        protected static void addField​(FieldDescriptor field,
                                       java.util.Map<java.lang.String,​FieldDescriptor> fields)
        Adds a descriptor to the given signature-descriptor map.
        Parameters:
        field - the field to be added
        fields - the operations (signature-descriptor) (to be modified as a side effect)