Class BuilderUtils

java.lang.Object
io.sundr.builder.internal.utils.BuilderUtils

public class BuilderUtils extends Object
  • Method Details

    • canBeBuilt

      public static boolean canBeBuilt(io.sundr.model.TypeRef typeRef)
    • canBeBuilt

      public static boolean canBeBuilt(io.sundr.model.TypeDef typeDef)
    • isRegisteredAsBuildable

      public static boolean isRegisteredAsBuildable(io.sundr.model.TypeRef typeRef)
    • isBuildable

      public static boolean isBuildable(io.sundr.model.TypeRef typeRef)
    • isRegisteredAsBuildable

      public static boolean isRegisteredAsBuildable(io.sundr.model.TypeDef typeDef)
    • isBuildable

      public static boolean isBuildable(io.sundr.model.TypeDef typeDef)
    • isBuildable

      public static boolean isBuildable(io.sundr.model.ClassRef ref)
      Checks if ClassRef is buildable.
      Parameters:
      ref - The reference.
      Returns:
      True if buildable repository contains the ref or builder for the reference is present.
    • isOrHasBuildableDescendants

      public static boolean isOrHasBuildableDescendants(io.sundr.model.Property property)
    • findBuildableReferences

      public static List<io.sundr.model.ClassRef> findBuildableReferences(io.sundr.model.ClassRef ref)
      Returns all references of a ClassRef that are considered buildable.
      Parameters:
      ref - The reference.
      Returns:
      The list with all detected references.
    • findBuildableSuperClassRef

      public static io.sundr.model.ClassRef findBuildableSuperClassRef(io.sundr.model.TypeDef clazz)
    • findBuildableSuperClass

      public static io.sundr.model.TypeDef findBuildableSuperClass(io.sundr.model.TypeDef clazz)
    • findBuildableConstructor

      public static io.sundr.model.Method findBuildableConstructor(io.sundr.model.TypeDef clazz)
    • methodHasArgument

      public static boolean methodHasArgument(io.sundr.model.Method method, io.sundr.model.Property property)
      Checks if method has a specific argument.
      Parameters:
      method - The method.
      property - The argument.
      Returns:
      True if matching argument if found.
    • hasBuildableConstructorWithArgument

      public static boolean hasBuildableConstructorWithArgument(io.sundr.model.TypeDef clazz, io.sundr.model.Property property)
    • hasDefaultConstructor

      public static boolean hasDefaultConstructor(io.sundr.model.TypeRef item)
      Checks if there is a default constructor available.
      Parameters:
      item - The clazz to check.
      Returns:
      True if default constructor is found, false otherwise.
    • hasDefaultConstructor

      public static boolean hasDefaultConstructor(io.sundr.model.TypeDef item)
      Checks if there is a default constructor available.
      Parameters:
      item - The clazz to check.
      Returns:
      True if default constructor is found, false otherwise.
    • getInlineableConstructors

      public static Set<io.sundr.model.Method> getInlineableConstructors(io.sundr.model.Property property)
    • isInlineable

      public static boolean isInlineable(io.sundr.model.Method method)
    • getInlineType

      public static io.sundr.model.TypeDef getInlineType(BuilderContext context, Inline inline)
    • getInlineReturnType

      public static io.sundr.model.TypeDef getInlineReturnType(BuilderContext context, Inline inline, io.sundr.model.TypeDef fallback)
    • getBuildableReferences

      public static Set<TypeElement> getBuildableReferences(BuilderContext context, Buildable buildable)
    • getBuildableReferences

      public static Set<TypeElement> getBuildableReferences(BuilderContext context, ExternalBuildables buildable)
    • getNextGeneric

      public static io.sundr.model.TypeParamDef getNextGeneric(io.sundr.model.TypeDef type, io.sundr.model.TypeParamDef... excluded)
    • getNextGeneric

      public static io.sundr.model.TypeParamRef getNextGeneric(io.sundr.model.ClassRef type, io.sundr.model.TypeParamRef... excluded)
    • appendNewGenericArgument

      public static List<io.sundr.model.TypeRef> appendNewGenericArgument(io.sundr.model.ClassRef type, io.sundr.model.TypeParamRef... excluded)
    • appendNewWildcardArgument

      public static List<io.sundr.model.TypeRef> appendNewWildcardArgument(io.sundr.model.ClassRef type)
    • getNextGeneric

      public static io.sundr.model.TypeParamDef getNextGeneric(io.sundr.model.TypeDef type, Collection excluded)
    • getNextGeneric

      public static io.sundr.model.TypeParamRef getNextGeneric(io.sundr.model.ClassRef classRef, Collection<io.sundr.model.TypeParamRef> excluded)
    • allGenericsOf

      public static Set<String> allGenericsOf(io.sundr.model.TypeDef clazz)
    • allGenericsOf

      public static Set<String> allGenericsOf(io.sundr.model.TypeRef type)
    • allGenericsOf

      public static Collection<String> allGenericsOf(io.sundr.model.Property property)
    • allGenericsOf

      public static Collection<String> allGenericsOf(io.sundr.model.Method method)
    • qualifyPropertyName

      public static String qualifyPropertyName(io.sundr.model.Property property, io.sundr.model.TypeRef typeRef, io.sundr.model.TypeDef originType)
      Create a qualified name for the given property - if it is not a descendant, then just the capitalized name will be used.
      Parameters:
      property - The property.
      typeRef - The type reference.
      originType - The origin type.
      Returns:
      The qualified property name.
    • qualifyPropertyName

      public static String qualifyPropertyName(io.sundr.model.Property property, io.sundr.model.TypeRef typeRef, io.sundr.model.TypeDef originType, boolean useSingular)
      Create a qualified name for the given property. If useSingular is true the root property name will be changed to the singular form.
      Parameters:
      property - The property.
      typeRef - The type reference.
      originType - The origin type. param useSingular Flag to use singular form
      Returns:
      The qualified property name.
    • fullyQualifiedNameDiff

      public static String fullyQualifiedNameDiff(io.sundr.model.TypeRef typeRef, io.sundr.model.TypeDef originType)
    • arrayAsList

      public static io.sundr.model.Property arrayAsList(io.sundr.model.Property property)
    • buildableField

      public static io.sundr.model.Property buildableField(io.sundr.model.Property property)
    • populateEnclosedBuildables

      public static void populateEnclosedBuildables(io.sundr.model.TypeDef typeDef, Map<String,io.sundr.model.ClassRef> result)
    • enclosedBuildables

      public static Map<String,io.sundr.model.ClassRef> enclosedBuildables(io.sundr.model.TypeDef typeDef)
      Get all the enclosingTypes.
      Parameters:
      typeDef - the typeDef that we check for enclosed buildables.
      Returns:
      all the enclosingTypes.
    • toString

      public static List<io.sundr.model.Statement> toString(String name, Collection<io.sundr.model.Property> properties)
    • ifNotNullToStringStatements

      public static List<io.sundr.model.Statement> ifNotNullToStringStatements(io.sundr.model.Property property, boolean hasNext)
    • ifNotNullToString

      @Deprecated public static String ifNotNullToString(io.sundr.model.Property property, boolean hasNext)
      Deprecated.
    • toHashCode

      public static List<io.sundr.model.Statement> toHashCode(Collection<io.sundr.model.Property> properties)
    • toEquals

      public static List<io.sundr.model.Statement> toEquals(io.sundr.model.Nameable nameable, Collection<io.sundr.model.Property> properties)