org.apache.logging.log4j
Interface ThreadContext.ContextStack

All Superinterfaces:
Serializable
All Known Implementing Classes:
ThreadContext.ImmutableStack
Enclosing class:
ThreadContext

public static interface ThreadContext.ContextStack
extends Serializable

The ThreadContext Stack interface.


Method Summary
 List<String> asList()
          Returns all the elements in the stack in a List.
 void clear()
          Clears all elements from the stack.
 ThreadContext.ContextStack copy()
          Returns a copy of the ContextStack.
 int getDepth()
          Returns the number of elements in the stack.
 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 message)
          Add an element to the stack.
 void trim(int depth)
          Trims elements from the end of the stack.
 

Method Detail

clear

void clear()
Clears all elements from the stack.


pop

String pop()
Returns the element at the top of the stack.

Returns:
The element at the top of the stack.
Throws:
NoSuchElementException - if the stack is empty.

peek

String peek()
Returns the element at the top of the stack without removing it or null if the stack is empty.

Returns:
the element at the top of the stack or null if the stack is empty.

push

void push(String message)
Add an element to the stack.

Parameters:
message - The element to add.

getDepth

int getDepth()
Returns the number of elements in the stack.

Returns:
the number of elements in the stack.

asList

List<String> asList()
Returns all the elements in the stack in a List.

Returns:
all the elements in the stack in a List.

trim

void trim(int depth)
Trims elements from the end of the stack.

Parameters:
depth - The maximum number of items in the stack to keep.

copy

ThreadContext.ContextStack copy()
Returns a copy of the ContextStack.

Returns:
a copy of the ContextStack.


Copyright © 1999-2013 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.