public class MutableThreadContextStack extends Objectimplements ThreadContextStack
| Constructor and Description |
|---|
MutableThreadContextStack()
Constructs an empty MutableThreadContextStack.
|
MutableThreadContextStack(List
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(String
|
boolean |
addAll(Collection
|
List |
asList()
Returns all the elements in the stack in a List.
|
void |
clear()
|
boolean |
contains(Object
|
boolean |
containsAll(Collection
|
ThreadContextStack |
copy()
Returns a copy of the ContextStack.
|
boolean |
equals(Object
|
void |
freeze()
"Freezes" this context stack so it becomes immutable: all mutator methods will throw an exception from now on.
|
int |
getDepth()
Returns the number of elements in the stack.
|
ThreadContext |
getImmutableStackOrNull()
Returns a ContextStack with the same contents as this ContextStack or
null.
|
int |
hashCode()
|
boolean |
isEmpty()
|
boolean |
isFrozen()
|
Iterator |
iterator()
|
String |
peek()
Returns the element at the top of the stack without removing it or null if the stack is empty.
|
String |
pop()
Returns the element at the top of the stack.
|
void |
push(String
Pushes an element onto the stack.
|
boolean |
remove(Object
|
boolean |
removeAll(Collection
|
boolean |
retainAll(Collection
|
int |
size()
|
Object |
toArray()
|
<T> T[] |
toArray(T[] ts)
|
String |
toString()
|
void |
trim(int depth)
Trims elements from the end of the stack.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitparallelStream, removeIf, spliterator, streampublic MutableThreadContextStack()
public Stringpop()
ThreadContext.ContextStack
pop in interface
ThreadContext.ContextStack
public Stringpeek()
ThreadContext.ContextStack
peek in interface
ThreadContext.ContextStack
public void push(Stringmessage)
ThreadContext.ContextStack
push in interface
ThreadContext.ContextStack
message - The element to add.
public int getDepth()
ThreadContext.ContextStack
getDepth in interface
ThreadContext.ContextStack
public List<String > asList()
ThreadContext.ContextStack
asList in interface
ThreadContext.ContextStack
public void trim(int depth)
ThreadContext.ContextStack
trim in interface
ThreadContext.ContextStack
depth - The maximum number of items in the stack to keep.
public ThreadContextStackcopy()
ThreadContext.ContextStack
copy in interface
ThreadContext.ContextStack
public void clear()
public int size()
public boolean isEmpty()
public boolean contains(Objecto)
public Object[] toArray()
public <T> T[] toArray(T[] ts)
public boolean add(Strings)
public boolean remove(Objecto)
public boolean containsAll(Collection<?> objects)
public boolean addAll(Collection<? extends String > strings)
public boolean removeAll(Collection<?> objects)
public boolean retainAll(Collection<?> objects)
public StringtoString()
public int hashCode()
public boolean equals(Objectobj)
public ThreadContext.ContextStack getImmutableStackOrNull()
ThreadContext.ContextStack
null. Attempts to modify the returned stack may or may not throw an exception, but will not affect the contents of this ContextStack.
getImmutableStackOrNull in interface
ThreadContext.ContextStack
null.
public void freeze()
public boolean isFrozen()