use of io.sundr.model.repo.DefinitionRepository in project sundrio by sundrio.
the class BuilderUtils method hasDefaultConstructor.
/**
* Checks if there is a default constructor available.
*
* @param item The clazz to check.
* @return True if default constructor is found, false otherwise.
*/
public static boolean hasDefaultConstructor(TypeRef item) {
DefinitionRepository repository = DefinitionRepository.getRepository();
TypeDef def = repository.getDefinition(item);
if (def == null && item instanceof ClassRef) {
def = GetDefinition.of((ClassRef) item);
}
return hasDefaultConstructor(def);
}
use of io.sundr.model.repo.DefinitionRepository in project sundrio by sundrio.
the class Types method isAbstract.
/**
* Checks a {@link TypeRef} is of an abstract type.
*
* @param typeRef The type to check.
* @return True if its an abstract type.
*/
public static boolean isAbstract(TypeRef typeRef) {
DefinitionRepository repository = DefinitionRepository.getRepository();
TypeDef def = repository.getDefinition(typeRef);
if (def == null && typeRef instanceof ClassRef) {
def = ((ClassRef) typeRef).map(GetDefinition.FUNCTION);
}
return def != null ? def.isAbstract() : false;
}
use of io.sundr.model.repo.DefinitionRepository in project sundrio by sundrio.
the class Types method isConcrete.
/**
* Checks if {@link TypeRef} is of an concrete
*
* @param typeRef The type to check.
* @return True if its an concrete type.
*/
public static boolean isConcrete(TypeRef typeRef) {
DefinitionRepository repository = DefinitionRepository.getRepository();
TypeDef def = repository.getDefinition(typeRef);
if (def == null && typeRef instanceof ClassRef) {
def = ((ClassRef) typeRef).map(GetDefinition.FUNCTION);
}
return def != null ? !def.isAbstract() && !def.isInterface() : false;
}
Aggregations