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 booleanmerged-
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 voidcompactSubTree()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.RegistryItemgetItem(BeanContext context, String path)RegistryItemgetItem(String name)protected RegistryItemgetItemInternal(BeanContext context, String path)voidload(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.voidloadForItems(BeanContext context)Makes sureRegistryItem.getItems()are present, though not necessarily loaded.voidtoTree(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 BeanContext context, @Nonnull String path) throws IOException
- Throws:
IOException
-
getItemInternal
@Nullable protected RegistryItem getItemInternal(@Nonnull BeanContext context, @Nonnull String path) throws IOException
- Throws:
IOException
-
load
public void load(@Nonnull BeanContext context) throws IOException
Description copied from interface:RegistryItemLoads 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 BeanContext context) throws IOException
Description copied from interface:RegistryItemMakes 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:
toTreein interfaceRegistryItem- Overrides:
toTreein classAbstractNode- Throws:
IOException
-
compactSubTree
public void compactSubTree()
Description copied from class:AbstractNodeWe 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:
compactSubTreein interfaceRegistryItem- Overrides:
compactSubTreein classAbstractNode
-
getItem
@Nullable public RegistryItem getItem(@Nonnull String name)
- Specified by:
getItemin interfaceRegistryItem- Overrides:
getItemin classAbstractNode
-
-