Package io.sundr.builder.internal.utils
Class BuilderUtils
java.lang.Object
io.sundr.builder.internal.utils.BuilderUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic Collection<String>allGenericsOf(io.sundr.model.Method method) static Collection<String>allGenericsOf(io.sundr.model.Property property) allGenericsOf(io.sundr.model.TypeDef clazz) allGenericsOf(io.sundr.model.TypeRef type) static List<io.sundr.model.TypeRef>appendNewGenericArgument(io.sundr.model.ClassRef type, io.sundr.model.TypeParamRef... excluded) static List<io.sundr.model.TypeRef>appendNewWildcardArgument(io.sundr.model.ClassRef type) static io.sundr.model.PropertyarrayAsList(io.sundr.model.Property property) static io.sundr.model.PropertybuildableField(io.sundr.model.Property property) static booleancanBeBuilt(io.sundr.model.TypeDef typeDef) static booleancanBeBuilt(io.sundr.model.TypeRef typeRef) enclosedBuildables(io.sundr.model.TypeDef typeDef) Get all the enclosingTypes.static io.sundr.model.MethodfindBuildableConstructor(io.sundr.model.TypeDef clazz) static List<io.sundr.model.ClassRef>findBuildableReferences(io.sundr.model.ClassRef ref) Returns all references of aClassRefthat are considered buildable.static io.sundr.model.TypeDeffindBuildableSuperClass(io.sundr.model.TypeDef clazz) static io.sundr.model.ClassReffindBuildableSuperClassRef(io.sundr.model.TypeDef clazz) static StringfullyQualifiedNameDiff(io.sundr.model.TypeRef typeRef, io.sundr.model.TypeDef originType) static Set<TypeElement>getBuildableReferences(BuilderContext context, Buildable buildable) static Set<TypeElement>getBuildableReferences(BuilderContext context, ExternalBuildables buildable) static Set<io.sundr.model.Method>getInlineableConstructors(io.sundr.model.Property property) static io.sundr.model.TypeDefgetInlineReturnType(BuilderContext context, Inline inline, io.sundr.model.TypeDef fallback) static io.sundr.model.TypeDefgetInlineType(BuilderContext context, Inline inline) static io.sundr.model.TypeParamRefgetNextGeneric(io.sundr.model.ClassRef type, io.sundr.model.TypeParamRef... excluded) static io.sundr.model.TypeParamRefgetNextGeneric(io.sundr.model.ClassRef classRef, Collection<io.sundr.model.TypeParamRef> excluded) static io.sundr.model.TypeParamDefgetNextGeneric(io.sundr.model.TypeDef type, io.sundr.model.TypeParamDef... excluded) static io.sundr.model.TypeParamDefgetNextGeneric(io.sundr.model.TypeDef type, Collection excluded) static booleanhasBuildableConstructorWithArgument(io.sundr.model.TypeDef clazz, io.sundr.model.Property property) static booleanhasDefaultConstructor(io.sundr.model.TypeDef item) Checks if there is a default constructor available.static booleanhasDefaultConstructor(io.sundr.model.TypeRef item) Checks if there is a default constructor available.static StringifNotNullToString(io.sundr.model.Property property, boolean hasNext) Deprecated.static List<io.sundr.model.Statement>ifNotNullToStringStatements(io.sundr.model.Property property, boolean hasNext) static booleanisBuildable(io.sundr.model.ClassRef ref) Checks ifClassRefis buildable.static booleanisBuildable(io.sundr.model.TypeDef typeDef) static booleanisBuildable(io.sundr.model.TypeRef typeRef) static booleanisInlineable(io.sundr.model.Method method) static booleanisOrHasBuildableDescendants(io.sundr.model.Property property) static booleanisRegisteredAsBuildable(io.sundr.model.TypeDef typeDef) static booleanisRegisteredAsBuildable(io.sundr.model.TypeRef typeRef) static booleanmethodHasArgument(io.sundr.model.Method method, io.sundr.model.Property property) Checks if method has a specific argument.static voidpopulateEnclosedBuildables(io.sundr.model.TypeDef typeDef, Map<String, io.sundr.model.ClassRef> result) static StringqualifyPropertyName(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.static StringqualifyPropertyName(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.static List<io.sundr.model.Statement>toEquals(io.sundr.model.Nameable nameable, Collection<io.sundr.model.Property> properties) static List<io.sundr.model.Statement>toHashCode(Collection<io.sundr.model.Property> properties) static List<io.sundr.model.Statement>toString(String name, Collection<io.sundr.model.Property> properties)
-
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 ifClassRefis 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
Returns all references of aClassRefthat 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
-
getInlineReturnType
public static io.sundr.model.TypeDef getInlineReturnType(BuilderContext context, Inline inline, io.sundr.model.TypeDef fallback) -
getBuildableReferences
-
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
-
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
-
allGenericsOf
-
allGenericsOf
-
allGenericsOf
-
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
-
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)
-