Class BlockContextStack
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.AbstractSequentialList<E>
-
- java.util.LinkedList<BlockContext<?>>
-
- org.keycloak.models.map.storage.file.common.BlockContextStack
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<BlockContext<?>>
,Collection<BlockContext<?>>
,Deque<BlockContext<?>>
,List<BlockContext<?>>
,Queue<BlockContext<?>>
public class BlockContextStack extends LinkedList<BlockContext<?>>
A special stack suited for tracking the parser of a block language, and maintaining contextual information for block nesting position in the YAML file.The intention is as follows: Initially, it contains a single
BlockContext
instance which represents the root context of the YAML tree. Every sequence item and mapping value in the YAML file leads to pushing a newBlockContext
onto the stack which is created by the topmostBlockContext.getContext(java.lang.String)
method of the topmostBlockContext
. This context is removed from the stack once parsing of the respective sequence item or mapping pair is finished.- Author:
- hmlnarik
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description BlockContextStack(BlockContext<?> rootElement)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BlockContext<?>
push(String name, Supplier<BlockContext<?>> nullProducer)
Pushes the subcontext to the stack.-
Methods inherited from class java.util.LinkedList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, descendingIterator, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, peekLast, poll, pollFirst, pollLast, pop, push, remove, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, spliterator, toArray, toArray
-
Methods inherited from class java.util.AbstractSequentialList
iterator
-
Methods inherited from class java.util.AbstractList
equals, hashCode, listIterator, removeRange, subList
-
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, replaceAll, retainAll, sort, subList
-
-
-
-
Constructor Detail
-
BlockContextStack
public BlockContextStack(BlockContext<?> rootElement)
-
-
Method Detail
-
push
public BlockContext<?> push(String name, Supplier<BlockContext<?>> nullProducer)
Pushes the subcontext to the stack.The subcontext is created by calling
BlockContext.getContext(java.lang.String)
method. If this method returnsnull
, the control reverts to producing the subcontext usingnullProducer
which must return a validBlockContext
object (it must not return {@code null).- Parameters:
name
-nullProducer
-- Returns:
-
-