Package io.sundr.model.repo
Class DefinitionRepository
- java.lang.Object
-
- io.sundr.model.repo.DefinitionRepository
-
public class DefinitionRepository extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDefinitionRepository.WithRepo
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()static DefinitionRepositorycreateRepository()Create a new instance of the repository, without messing with the singletonio.sundr.model.TypeDefgetDefinition(io.sundr.model.TypeRef type)io.sundr.model.TypeDefgetDefinition(String fullyQualifiedName)io.sundr.model.TypeDefgetDefinition(String fullyQualifiedName, boolean computeIfSupplied)Collection<io.sundr.model.TypeDef>getDefinitions()Set<io.sundr.model.TypeDef>getDefinitions(io.sundr.model.AttributeKey<Boolean>... attributeKeys)Set<io.sundr.model.TypeDef>getDefinitions(String... flags)Map<String,String>getReferenceMap()static DefinitionRepositorygetRepository()Get or create a DefinitionRepository.booleanhasDefinition(String fullyQualifiedName)io.sundr.model.TypeDefregister(io.sundr.model.TypeDef definition)io.sundr.model.TypeDefregister(io.sundr.model.TypeDef definition, io.sundr.model.AttributeKey<Boolean>... flags)io.sundr.model.TypeDefregister(io.sundr.model.TypeDef definition, String... flags)voidregisterIfAbsent(io.sundr.model.TypeDef definition)voidregisterIfAbsent(String fqcn, Supplier<io.sundr.model.TypeDef> supplier)voidupdateReferenceMap()static DefinitionRepository.WithRepowithNewRepository()static DefinitionRepository.WithRepowithRepository(DefinitionRepository repository)
-
-
-
Method Detail
-
getRepository
public static final DefinitionRepository getRepository()
Get or create a DefinitionRepository. This is a traditional Singleton getInstance() method with a twist ... Along with the static final instance that is used by common singletons this also uses a scoped instance. The scoped instance is something that may be used in the context of aFunctionor aCallable. So, when this method is used from within a call to Definition.withRepository(repo).call(...) it will return the value of repo instead of the Singleton intance. The same goes for Definition.withNewRepository(repo -> { ... }).- Returns:
- the scoped instance if called from within withRepo/withNewRepo lambda, or the singleton instance otherwise.
-
createRepository
public static DefinitionRepository createRepository()
Create a new instance of the repository, without messing with the singleton- Returns:
- a new instance
-
withRepository
public static DefinitionRepository.WithRepo withRepository(DefinitionRepository repository)
-
withNewRepository
public static DefinitionRepository.WithRepo withNewRepository()
-
registerIfAbsent
public void registerIfAbsent(String fqcn, Supplier<io.sundr.model.TypeDef> supplier)
-
registerIfAbsent
public void registerIfAbsent(io.sundr.model.TypeDef definition)
-
register
public io.sundr.model.TypeDef register(io.sundr.model.TypeDef definition)
-
register
public io.sundr.model.TypeDef register(io.sundr.model.TypeDef definition, String... flags)
-
register
public io.sundr.model.TypeDef register(io.sundr.model.TypeDef definition, io.sundr.model.AttributeKey<Boolean>... flags)
-
getDefinitions
public Set<io.sundr.model.TypeDef> getDefinitions(io.sundr.model.AttributeKey<Boolean>... attributeKeys)
-
hasDefinition
public boolean hasDefinition(String fullyQualifiedName)
-
getDefinition
public io.sundr.model.TypeDef getDefinition(String fullyQualifiedName)
-
getDefinition
public io.sundr.model.TypeDef getDefinition(String fullyQualifiedName, boolean computeIfSupplied)
-
getDefinition
public io.sundr.model.TypeDef getDefinition(io.sundr.model.TypeRef type)
-
getDefinitions
public Collection<io.sundr.model.TypeDef> getDefinitions()
-
updateReferenceMap
public void updateReferenceMap()
-
clear
public void clear()
-
-