Class KlumObjectSupport.Structure<T>

java.lang.Object
com.blackbuild.klum.ast.runtime.KlumObjectSupport.Structure<T>
Type Parameters:
T - the root object type
Enclosing class:
KlumObjectSupport<T>

public static final class KlumObjectSupport.Structure<T> extends Object
Structural support rooted at a completed DSL Object.
  • Method Details

    • getDirectOwners

      public Set<Object> getDirectOwners()
      Returns the non-transitive, non-root owners directly assigned to this object.
    • getSingleOwner

      public Optional<Object> getSingleOwner()
      Returns this object's sole direct owner, if it has one.
      Throws:
      KlumModelException - if this object has more than one distinct direct owner
    • getOwnerHierarchy

      public List<Object> getOwnerHierarchy()
      Returns the direct-owner hierarchy from this object to its composition root.
      Throws:
      KlumSchemaException - if direct owners form a cycle
    • getAncestorOfType

      public <R> Optional<R> getAncestorOfType(Class<R> type)
      Returns the nearest owner-hierarchy member of type, if present.
    • getRelativePath

      public String getRelativePath(Object child)
      Returns the path from this object to the supplied owned descendant.
    • getRelativePath

      public String getRelativePath(Object child, String rootPath)
      Returns the path from this object to the supplied owned descendant, prefixed by rootPath.
    • getFullPath

      public String getFullPath()
      Returns this object's path relative to its composition root.
    • getFullPath

      public String getFullPath(String rootPath)
      Returns this object's path relative to its composition root, prefixed by rootPath.
    • visit

      public <R> void visit(Class<R> type, BiConsumer<String,R> visitor)
      Visits every composed object assignable to type.
    • findAll

      public <R> Map<String,R> findAll(Class<R> type)
      Returns every composed object assignable to type, indexed by its path from this structure root.
    • findAll

      public <R> Map<String,R> findAll(Class<R> type, String rootPath)
      Returns every composed object assignable to type, indexed by paths using rootPath. This overload supports compatibility adapters that retain an existing path prefix.