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
-
Method Summary
Modifier and TypeMethodDescriptionGets a value from a context.<T> T
Gets a value from a context with a given type to get cast to.Get terminal width.Put an entry into a context.void
setTerminalWidth
(Integer terminalWidth) Set terminal width.stream()
Stream key/value pairs from thisComponentContext
toString()
Gets context values as a map.Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, getOrDefault, keySet, removeEldestEntry, replaceAll, values
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, putAll, putIfAbsent, remove, remove, replace, replace, size
Methods inherited from class java.util.AbstractMap
equals, hashCode
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.shell.component.context.ComponentContext
containsKey
Methods 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:ComponentContext
Gets a value from a context.- Specified by:
get
in interfaceComponentContext<C extends ComponentContext<C>>
- Specified by:
get
in interfaceMap<Object,
Object> - Overrides:
get
in classLinkedHashMap<Object,
Object> - Parameters:
key
- the key- Returns:
- a value
-
get
Description copied from interface:ComponentContext
Gets a value from a context with a given type to get cast to.- Specified by:
get
in 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:ComponentContext
Put an entry into a context. -
stream
Description copied from interface:ComponentContext
Stream key/value pairs from thisComponentContext
- Specified by:
stream
in interfaceComponentContext<C extends ComponentContext<C>>
- Returns:
- a
Stream
of key/value pairs held by this context
-
getTerminalWidth
Description copied from interface:ComponentContext
Get terminal width.- Specified by:
getTerminalWidth
in interfaceComponentContext<C extends ComponentContext<C>>
- Returns:
- a terminal width
-
setTerminalWidth
Description copied from interface:ComponentContext
Set terminal width.- Specified by:
setTerminalWidth
in interfaceComponentContext<C extends ComponentContext<C>>
- Parameters:
terminalWidth
- the width
-
toTemplateModel
Description copied from interface:ComponentContext
Gets 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:
toTemplateModel
in interfaceComponentContext<C extends ComponentContext<C>>
- Returns:
- map of context values
-
toString
- Overrides:
toString
in classAbstractMap<Object,
Object>
-