Class RegistryTree
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- java.util.LinkedHashMap<String,Object>
-
- com.composum.sling.core.pckgmgr.regpckg.tree.AbstractNode
-
- com.composum.sling.core.pckgmgr.regpckg.tree.RegistryTree
-
- All Implemented Interfaces:
RegistryItem
,Serializable
,Cloneable
,Map<String,Object>
public class RegistryTree extends AbstractNode
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
merged
-
Fields inherited from class com.composum.sling.core.pckgmgr.regpckg.tree.AbstractNode
KEY_ITEMS, KEY_LOADED, KEY_NAME, KEY_PATH, KEY_STATE, KEY_TEXT, KEY_TYPE
-
-
Constructor Summary
Constructors Constructor Description RegistryTree(boolean merged)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
compactSubTree()
We clear up the rare case that there are two items with the sameTreeItem.getName()
(can happen if there is, e.g., a group that has the same name as a package), which would lead to trouble with tree display since the same id was used twice.RegistryItem
getItem(com.composum.sling.core.BeanContext context, String path)
RegistryItem
getItem(String name)
protected RegistryItem
getItemInternal(com.composum.sling.core.BeanContext context, String path)
void
load(com.composum.sling.core.BeanContext context)
Loads all details of this node from the package(s) and makes sure all children (RegistryItem.getItems()
) are present, though not necessarily loaded.void
loadForItems(com.composum.sling.core.BeanContext context)
Makes sureRegistryItem.getItems()
are present, though not necessarily loaded.void
toTree(com.google.gson.stream.JsonWriter writer, boolean children, boolean showRoot)
-
Methods inherited from class com.composum.sling.core.pckgmgr.regpckg.tree.AbstractNode
combineChildren, compactTree, equals, getItems, getItemsMap, getName, getParent, getPath, getText, getType, hashCode, isLoaded, setLoaded, toJson, toTreeChildren, toTreeProperties, toTreeState
-
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values
-
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
-
Methods inherited from class java.util.AbstractMap
toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
-
-
-
Method Detail
-
getItem
@Nullable public RegistryItem getItem(@Nonnull com.composum.sling.core.BeanContext context, @Nonnull String path) throws IOException
- Throws:
IOException
-
getItemInternal
@Nullable protected RegistryItem getItemInternal(@Nonnull com.composum.sling.core.BeanContext context, @Nonnull String path) throws IOException
- Throws:
IOException
-
load
public void load(@Nonnull com.composum.sling.core.BeanContext context) throws IOException
Description copied from interface:RegistryItem
Loads all details of this node from the package(s) and makes sure all children (RegistryItem.getItems()
) are present, though not necessarily loaded.- Throws:
IOException
-
loadForItems
public void loadForItems(@Nonnull com.composum.sling.core.BeanContext context) throws IOException
Description copied from interface:RegistryItem
Makes sureRegistryItem.getItems()
are present, though not necessarily loaded. might or might not trigger aRegistryItem.load(BeanContext)
if that's necessary for that. (Optimized version ofRegistryItem.load(BeanContext)
if we just need theRegistryItem.getItems()
).- Throws:
IOException
-
toTree
public void toTree(@Nonnull com.google.gson.stream.JsonWriter writer, boolean children, boolean showRoot) throws IOException
- Specified by:
toTree
in interfaceRegistryItem
- Overrides:
toTree
in classAbstractNode
- Throws:
IOException
-
compactSubTree
public void compactSubTree()
Description copied from class:AbstractNode
We clear up the rare case that there are two items with the sameTreeItem.getName()
(can happen if there is, e.g., a group that has the same name as a package), which would lead to trouble with tree display since the same id was used twice. We take what's more specific (that is, not GroupNode) and add the children there.- Specified by:
compactSubTree
in interfaceRegistryItem
- Overrides:
compactSubTree
in classAbstractNode
-
getItem
@Nullable public RegistryItem getItem(@Nonnull String name)
- Specified by:
getItem
in interfaceRegistryItem
- Overrides:
getItem
in classAbstractNode
-
-