Class TypeArguments

java.lang.Object
io.sundr.model.utils.TypeArguments

public class TypeArguments extends Object
  • Field Details

  • Constructor Details

    • TypeArguments

      public TypeArguments()
  • Method Details

    • apply

      public static RichTypeDef apply(ClassRef classRef)
    • apply

      public static RichTypeDef apply(TypeDef definition)
    • getGenericArgumentsMappings

      public static Map<String,TypeRef> getGenericArgumentsMappings(ClassRef ref)
      Given a reference to a generic class, determine a mapping between generic arguments definitions and instantiations.

      For example, given a definition of interface Map<K,V> {...} and a reference Map<String,Integer>, the mapping will be {K -> String, V -> Integer}.

      Raw references, that is, references that do not contain generic arguments (like Map) are accepted and always return an empty result.

      However, if the reference does contain generic arguments, their count must be equal to the definition.

      Parameters:
      ref - The class reference to evaluate. The corresponding definition will be loaded using GetDefinition
    • getGenericArgumentsMappings

      public static Map<String,TypeRef> getGenericArgumentsMappings(ClassRef ref, TypeDef definition)
      Given a reference to a generic class, determine a mapping between generic arguments definitions and instantiations.

      For example, given a definition of interface Map<K,V> {...} and a reference Map<String,Integer>, the mapping will be {K -> String, V -> Integer}.

      Raw references, that is, references that do not contain generic arguments (like Map) are accepted and always return an empty result.

      However, if the reference does contain generic arguments, their count must be equal to the definition.

      Parameters:
      ref - The class reference to evaluate.
      definition - The corresponding definition