Class BaseComponentContext<C extends ComponentContext<C>>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<Object,Object>
org.springframework.shell.component.context.BaseComponentContext<C>
- All Implemented Interfaces:
Serializable,Cloneable,Map<Object,,Object> ComponentContext<C>
- Direct Known Subclasses:
AbstractSelectorComponent.BaseSelectorComponentContext,AbstractTextComponent.BaseTextComponentContext
public class BaseComponentContext<C extends ComponentContext<C>>
extends LinkedHashMap<Object,Object>
implements ComponentContext<C>
Base implementation of a
ComponentContext.- See Also:
-
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> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets a value from a context.<T> TGets a value from a context with a given type to get cast to.Put an entry into a context.stream()Stream key/value pairs from thisComponentContextGets context values as a map.Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, getOrDefault, keySet, removeEldestEntry, replaceAll, valuesMethods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from class java.util.AbstractMap
equals, hashCode, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.shell.component.context.ComponentContext
containsKeyMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, putAll, putIfAbsent, remove, remove, replace, replace, size
-
Constructor Details
-
BaseComponentContext
public BaseComponentContext()
-
-
Method Details
-
get
Description copied from interface:ComponentContextGets a value from a context.- Specified by:
getin interfaceComponentContext<C extends ComponentContext<C>>- Specified by:
getin interfaceMap<Object,Object> - Overrides:
getin classLinkedHashMap<Object,Object> - Parameters:
key- the key- Returns:
- a value
-
get
Description copied from interface:ComponentContextGets a value from a context with a given type to get cast to.- Specified by:
getin interfaceComponentContext<C extends ComponentContext<C>>- Type Parameters:
T- the type of context- Parameters:
key- the keytype- the class type- Returns:
- a value
-
put
Description copied from interface:ComponentContextPut an entry into a context. -
stream
Description copied from interface:ComponentContextStream key/value pairs from thisComponentContext- Specified by:
streamin interfaceComponentContext<C extends ComponentContext<C>>- Returns:
- a
Streamof key/value pairs held by this context
-
toTemplateModel
Description copied from interface:ComponentContextGets context values as a map. Every context implementation can do their own model as essentially what matter is a one coming out from a last child which is one most likely to feed into a template engine.- Specified by:
toTemplateModelin interfaceComponentContext<C extends ComponentContext<C>>- Returns:
- map of context values
-