Package org.apache.logging.log4j
Class ThreadContext.EmptyThreadContextStack
- java.lang.Object
-
- java.util.AbstractCollection<java.lang.String>
-
- org.apache.logging.log4j.ThreadContext.EmptyThreadContextStack
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Iterable<java.lang.String>,java.util.Collection<java.lang.String>,ThreadContextStack,ThreadContext.ContextStack
- Enclosing class:
- ThreadContext
private static class ThreadContext.EmptyThreadContextStack extends java.util.AbstractCollection<java.lang.String> implements ThreadContextStack
An empty read-only ThreadContextStack.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Iterator<java.lang.String>EMPTY_ITERATORprivate static longserialVersionUID
-
Constructor Summary
Constructors Modifier Constructor Description privateEmptyThreadContextStack()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(java.lang.String e)booleanaddAll(java.util.Collection<? extends java.lang.String> c)java.util.List<java.lang.String>asList()Returns all the elements in the stack in a List.booleancontainsAll(java.util.Collection<?> c)ThreadContext.ContextStackcopy()Returns a copy of the ContextStack.booleanequals(java.lang.Object o)intgetDepth()Returns the number of elements in the stack.ThreadContext.ContextStackgetImmutableStackOrNull()Returns a ContextStack with the same contents as this ContextStack ornull.inthashCode()java.util.Iterator<java.lang.String>iterator()java.lang.Stringpeek()Returns the element at the top of the stack without removing it or null if the stack is empty.java.lang.Stringpop()Returns the element at the top of the stack.voidpush(java.lang.String message)Pushes an element onto the stack.booleanremoveAll(java.util.Collection<?> c)booleanretainAll(java.util.Collection<?> c)intsize()<T> T[]toArray(T[] a)voidtrim(int depth)Trims elements from the end of the stack.-
Methods inherited from class java.util.AbstractCollection
clear, contains, isEmpty, remove, toArray, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
EMPTY_ITERATOR
private static final java.util.Iterator<java.lang.String> EMPTY_ITERATOR
-
-
Method Detail
-
pop
public java.lang.String pop()
Description copied from interface:ThreadContext.ContextStackReturns the element at the top of the stack.- Specified by:
popin interfaceThreadContext.ContextStack- Returns:
- The element at the top of the stack.
-
peek
public java.lang.String peek()
Description copied from interface:ThreadContext.ContextStackReturns the element at the top of the stack without removing it or null if the stack is empty.- Specified by:
peekin interfaceThreadContext.ContextStack- Returns:
- the element at the top of the stack or null if the stack is empty.
-
push
public void push(java.lang.String message)
Description copied from interface:ThreadContext.ContextStackPushes an element onto the stack.- Specified by:
pushin interfaceThreadContext.ContextStack- Parameters:
message- The element to add.
-
getDepth
public int getDepth()
Description copied from interface:ThreadContext.ContextStackReturns the number of elements in the stack.- Specified by:
getDepthin interfaceThreadContext.ContextStack- Returns:
- the number of elements in the stack.
-
asList
public java.util.List<java.lang.String> asList()
Description copied from interface:ThreadContext.ContextStackReturns all the elements in the stack in a List.- Specified by:
asListin interfaceThreadContext.ContextStack- Returns:
- all the elements in the stack in a List.
-
trim
public void trim(int depth)
Description copied from interface:ThreadContext.ContextStackTrims elements from the end of the stack.- Specified by:
trimin interfaceThreadContext.ContextStack- Parameters:
depth- The maximum number of items in the stack to keep.
-
equals
public boolean equals(java.lang.Object o)
- Specified by:
equalsin interfacejava.util.Collection<java.lang.String>- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfacejava.util.Collection<java.lang.String>- Overrides:
hashCodein classjava.lang.Object
-
copy
public ThreadContext.ContextStack copy()
Description copied from interface:ThreadContext.ContextStackReturns a copy of the ContextStack.- Specified by:
copyin interfaceThreadContext.ContextStack- Returns:
- a copy of the ContextStack.
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArrayin interfacejava.util.Collection<java.lang.String>- Overrides:
toArrayin classjava.util.AbstractCollection<java.lang.String>
-
add
public boolean add(java.lang.String e)
- Specified by:
addin interfacejava.util.Collection<java.lang.String>- Overrides:
addin classjava.util.AbstractCollection<java.lang.String>
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
- Specified by:
containsAllin interfacejava.util.Collection<java.lang.String>- Overrides:
containsAllin classjava.util.AbstractCollection<java.lang.String>
-
addAll
public boolean addAll(java.util.Collection<? extends java.lang.String> c)
- Specified by:
addAllin interfacejava.util.Collection<java.lang.String>- Overrides:
addAllin classjava.util.AbstractCollection<java.lang.String>
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
- Specified by:
removeAllin interfacejava.util.Collection<java.lang.String>- Overrides:
removeAllin classjava.util.AbstractCollection<java.lang.String>
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
- Specified by:
retainAllin interfacejava.util.Collection<java.lang.String>- Overrides:
retainAllin classjava.util.AbstractCollection<java.lang.String>
-
iterator
public java.util.Iterator<java.lang.String> iterator()
- Specified by:
iteratorin interfacejava.util.Collection<java.lang.String>- Specified by:
iteratorin interfacejava.lang.Iterable<java.lang.String>- Specified by:
iteratorin classjava.util.AbstractCollection<java.lang.String>
-
size
public int size()
- Specified by:
sizein interfacejava.util.Collection<java.lang.String>- Specified by:
sizein classjava.util.AbstractCollection<java.lang.String>
-
getImmutableStackOrNull
public ThreadContext.ContextStack getImmutableStackOrNull()
Description copied from interface:ThreadContext.ContextStackReturns a ContextStack with the same contents as this ContextStack ornull. Attempts to modify the returned stack may or may not throw an exception, but will not affect the contents of this ContextStack.- Specified by:
getImmutableStackOrNullin interfaceThreadContext.ContextStack- Returns:
- a ContextStack with the same contents as this ContextStack or
null.
-
-