Class DefinitionRepository

java.lang.Object
io.sundr.model.repo.DefinitionRepository

public class DefinitionRepository extends Object
  • Method Details

    • 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 a Function or a Callable. 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<TypeDef> supplier)
    • registerIfAbsent

      public void registerIfAbsent(TypeDef definition)
    • register

      public TypeDef register(TypeDef definition)
    • register

      public TypeDef register(TypeDef definition, String... flags)
    • register

      public TypeDef register(TypeDef definition, AttributeKey<Boolean>... flags)
    • getDefinitions

      public Set<TypeDef> getDefinitions(String... flags)
    • getDefinitions

      public Set<TypeDef> getDefinitions(AttributeKey<Boolean>... attributeKeys)
    • hasDefinition

      public boolean hasDefinition(String fullyQualifiedName)
    • getDefinition

      public TypeDef getDefinition(String fullyQualifiedName)
    • getDefinition

      public TypeDef getDefinition(String fullyQualifiedName, boolean computeIfSupplied)
    • getDefinition

      public TypeDef getDefinition(TypeRef type)
    • getDefinitions

      public Collection<TypeDef> getDefinitions()
    • updateReferenceMap

      public void updateReferenceMap()
    • getReferenceMap

      public Map<String,String> getReferenceMap()
    • clear

      public void clear()