public abstract class AbstractEntity extends java.lang.Object implements EntityStateMachine
Modifier and Type | Field and Description |
---|---|
protected MutableBodyDescriptor |
body |
protected MimeEntityConfig |
config |
protected int |
endState |
protected org.apache.commons.logging.Log |
log |
protected BodyDescriptor |
parent |
protected int |
startState |
protected int |
state |
Modifier and Type | Method and Description |
---|---|
protected void |
debug(Event event)
Logs (at debug) an indicative message based on the given event
and the current state of the system.
|
BodyDescriptor |
getBodyDescriptor()
Gets a descriptor for the current entity.
|
protected abstract LineReaderInputStream |
getDataStream() |
Field |
getField()
This method is valid, if
getState() returns EntityStates.T_FIELD . |
protected abstract int |
getLineNumber()
Returns the current line number or
-1 if line number
information is not available. |
int |
getState()
Return the current state of the entity.
|
protected java.lang.String |
message(Event event)
Creates an indicative message suitable for display
based on the given event and the current state of the system.
|
protected void |
monitor(Event event)
Monitors the given event.
|
protected MutableBodyDescriptor |
newBodyDescriptor(BodyDescriptor pParent)
Creates a new instance of
BodyDescriptor . |
protected boolean |
parseField() |
static java.lang.String |
stateToString(int state)
Renders a state as a string suitable for logging.
|
java.lang.String |
toString() |
protected void |
warn(Event event)
Logs (at warn) an indicative message based on the given event
and the current state of the system.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
advance, getContentStream, setRecursionMode
protected final org.apache.commons.logging.Log log
protected final BodyDescriptor parent
protected final int startState
protected final int endState
protected final MimeEntityConfig config
protected final MutableBodyDescriptor body
protected int state
public int getState()
EntityStateMachine
getState
in interface EntityStateMachine
EntityStates
protected MutableBodyDescriptor newBodyDescriptor(BodyDescriptor pParent)
BodyDescriptor
. Subclasses may override
this in order to create body descriptors, that provide more specific
information.protected abstract int getLineNumber()
-1
if line number
information is not available.protected abstract LineReaderInputStream getDataStream()
protected boolean parseField() throws MimeException, java.io.IOException
MimeException
java.io.IOException
public BodyDescriptor getBodyDescriptor()
Gets a descriptor for the current entity.
This method is valid if getState()
returns:
getBodyDescriptor
in interface EntityStateMachine
BodyDescriptor
, not nullspublic Field getField()
getState()
returns EntityStates.T_FIELD
.getField
in interface EntityStateMachine
java.lang.IllegalStateException
- getState()
returns another
value than EntityStates.T_FIELD
.protected void monitor(Event event) throws MimeException, java.io.IOException
event
- Event
, not nullMimeException
- subclasses may elect to throw this exception upon
invalid contentjava.io.IOException
- subclasses may elect to throw this exceptionprotected java.lang.String message(Event event)
event
- Event
, not nullprotected void warn(Event event)
event
- Event
, not nullprotected void debug(Event event)
event
- Event
, not nullpublic java.lang.String toString()
toString
in class java.lang.Object
public static final java.lang.String stateToString(int state)
state
- Copyright © 2004-2012. All Rights Reserved.