org.quartz
Class JobDataMap

java.lang.Object
  extended byorg.quartz.utils.DirtyFlagMap
      extended byorg.quartz.JobDataMap
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class JobDataMap
extends DirtyFlagMap
implements java.io.Serializable

Holds state information for Job instances.

JobDataMap instances are stored once when the Job is added to a scheduler. They are also re-persisted after every execution of StatefulJob instances.

Author:
James House
See Also:
Job, StatefulJob, Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Constructor Summary
JobDataMap()
           Create an empty JobDataMap.
JobDataMap(java.util.Map map)
           Create a JobDataMap with the given data.
 
Method Summary
 boolean containsTransientData()
           
 boolean getAllowsTransientData()
           
 boolean getBoolean(java.lang.String key)
           Retrieve the identified boolean value from the JobDataMap.
 java.lang.Boolean getBooleanFromString(java.lang.String key)
           Retrieve the identified Boolean value from the JobDataMap.
 boolean getBooleanValueFromString(java.lang.String key)
           Retrieve the identified boolean value from the JobDataMap.
 char getChar(java.lang.String key)
           Retrieve the identified char value from the JobDataMap.
 java.lang.Character getCharacterFromString(java.lang.String key)
           Retrieve the identified Character value from the JobDataMap.
 char getCharFromString(java.lang.String key)
           Retrieve the identified char value from the JobDataMap.
 double getDouble(java.lang.String key)
           Retrieve the identified double value from the JobDataMap.
 java.lang.Double getDoubleFromString(java.lang.String key)
           Retrieve the identified Double value from the JobDataMap.
 double getDoubleValueFromString(java.lang.String key)
           Retrieve the identified double value from the JobDataMap.
 float getFloat(java.lang.String key)
           Retrieve the identified float value from the JobDataMap.
 java.lang.Float getFloatFromString(java.lang.String key)
           Retrieve the identified Float value from the JobDataMap.
 float getFloatValueFromString(java.lang.String key)
           Retrieve the identified float value from the JobDataMap.
 int getInt(java.lang.String key)
           Retrieve the identified int value from the JobDataMap.
 java.lang.Integer getIntegerFromString(java.lang.String key)
           Retrieve the identified int value from the JobDataMap.
 int getIntFromString(java.lang.String key)
           Retrieve the identified int value from the JobDataMap.
 java.lang.String[] getKeys()
           
 long getLong(java.lang.String key)
           Retrieve the identified long value from the JobDataMap.
 java.lang.Long getLongFromString(java.lang.String key)
           Retrieve the identified Long value from the JobDataMap.
 long getLongValueFromString(java.lang.String key)
           Retrieve the identified long value from the JobDataMap.
 java.lang.String getString(java.lang.String key)
           Retrieve the identified String value from the JobDataMap.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           Adds the given Serializable object value to the JobDataMap.
 void put(java.lang.String key, boolean value)
           Adds the given boolean value to the Job's data map.
 void put(java.lang.String key, char value)
           Adds the given char value to the Job's data map.
 void put(java.lang.String key, double value)
           Adds the given double value to the Job's data map.
 void put(java.lang.String key, float value)
           Adds the given float value to the Job's data map.
 void put(java.lang.String key, int value)
           Adds the given int value to the Job's data map.
 void put(java.lang.String key, long value)
           Adds the given long value to the Job's data map.
 void put(java.lang.String key, java.lang.String value)
           Adds the given String value to the Job's data map.
 void putAll(java.util.Map map)
           Adds the name-value pairs in the given Map to the JobDataMap.
 void putAsString(java.lang.String key, boolean value)
           Adds the given boolean value as a string version to the Job's data map.
 void putAsString(java.lang.String key, java.lang.Boolean value)
           Adds the given Boolean value as a string version to the Job's data map.
 void putAsString(java.lang.String key, char value)
           Adds the given char value as a string version to the Job's data map.
 void putAsString(java.lang.String key, java.lang.Character value)
           Adds the given Character value as a string version to the Job's data map.
 void putAsString(java.lang.String key, double value)
           Adds the given double value as a string version to the Job's data map.
 void putAsString(java.lang.String key, java.lang.Double value)
           Adds the given Double value as a string version to the Job's data map.
 void putAsString(java.lang.String key, float value)
           Adds the given float value as a string version to the Job's data map.
 void putAsString(java.lang.String key, java.lang.Float value)
           Adds the given Float value as a string version to the Job's data map.
 void putAsString(java.lang.String key, int value)
           Adds the given int value as a string version to the Job's data map.
 void putAsString(java.lang.String key, java.lang.Integer value)
           Adds the given Integer value as a string version to the Job's data map.
 void putAsString(java.lang.String key, long value)
           Adds the given long value as a string version to the Job's data map.
 void putAsString(java.lang.String key, java.lang.Long value)
           Adds the given Long value as a string version to the Job's data map.
 void removeTransientData()
           Nulls-out any data values that are non-Serializable.
 void setAllowsTransientData(boolean allowsTransientData)
           Tell the JobDataMap that it should allow non- Serializable data.
 
Methods inherited from class org.quartz.utils.DirtyFlagMap
clear, clearDirtyFlag, clone, containsKey, containsValue, entrySet, equals, get, getWrappedMap, isDirty, isEmpty, keySet, remove, size, values
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
hashCode
 

Constructor Detail

JobDataMap

public JobDataMap()

Create an empty JobDataMap.


JobDataMap

public JobDataMap(java.util.Map map)

Create a JobDataMap with the given data.

Method Detail

setAllowsTransientData

public void setAllowsTransientData(boolean allowsTransientData)

Tell the JobDataMap that it should allow non- Serializable data.

If the JobDataMap does contain non- Serializable objects, and it belongs to a non-volatile Job that is stored in a JobStore that supports persistence, then those elements will be nulled-out during persistence.


getAllowsTransientData

public boolean getAllowsTransientData()

containsTransientData

public boolean containsTransientData()

removeTransientData

public void removeTransientData()

Nulls-out any data values that are non-Serializable.


putAll

public void putAll(java.util.Map map)

Adds the name-value pairs in the given Map to the JobDataMap.

All keys must be Strings, and all values must be Serializable.

Specified by:
putAll in interface java.util.Map
Overrides:
putAll in class DirtyFlagMap

put

public void put(java.lang.String key,
                int value)

Adds the given int value to the Job's data map.


put

public void put(java.lang.String key,
                long value)

Adds the given long value to the Job's data map.


put

public void put(java.lang.String key,
                float value)

Adds the given float value to the Job's data map.


put

public void put(java.lang.String key,
                double value)

Adds the given double value to the Job's data map.


put

public void put(java.lang.String key,
                boolean value)

Adds the given boolean value to the Job's data map.


put

public void put(java.lang.String key,
                char value)

Adds the given char value to the Job's data map.


put

public void put(java.lang.String key,
                java.lang.String value)

Adds the given String value to the Job's data map.


putAsString

public void putAsString(java.lang.String key,
                        boolean value)

Adds the given boolean value as a string version to the Job's data map.


putAsString

public void putAsString(java.lang.String key,
                        java.lang.Boolean value)

Adds the given Boolean value as a string version to the Job's data map.


putAsString

public void putAsString(java.lang.String key,
                        char value)

Adds the given char value as a string version to the Job's data map.


putAsString

public void putAsString(java.lang.String key,
                        java.lang.Character value)

Adds the given Character value as a string version to the Job's data map.


putAsString

public void putAsString(java.lang.String key,
                        double value)

Adds the given double value as a string version to the Job's data map.


putAsString

public void putAsString(java.lang.String key,
                        java.lang.Double value)

Adds the given Double value as a string version to the Job's data map.


putAsString

public void putAsString(java.lang.String key,
                        float value)

Adds the given float value as a string version to the Job's data map.


putAsString

public void putAsString(java.lang.String key,
                        java.lang.Float value)

Adds the given Float value as a string version to the Job's data map.


putAsString

public void putAsString(java.lang.String key,
                        int value)

Adds the given int value as a string version to the Job's data map.


putAsString

public void putAsString(java.lang.String key,
                        java.lang.Integer value)

Adds the given Integer value as a string version to the Job's data map.


putAsString

public void putAsString(java.lang.String key,
                        long value)

Adds the given long value as a string version to the Job's data map.


putAsString

public void putAsString(java.lang.String key,
                        java.lang.Long value)

Adds the given Long value as a string version to the Job's data map.


put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)

Adds the given Serializable object value to the JobDataMap.

Specified by:
put in interface java.util.Map
Overrides:
put in class DirtyFlagMap

getInt

public int getInt(java.lang.String key)

Retrieve the identified int value from the JobDataMap.

Throws:
java.lang.ClassCastException - if the identified object is not an Integer.

getLong

public long getLong(java.lang.String key)

Retrieve the identified long value from the JobDataMap.

Throws:
java.lang.ClassCastException - if the identified object is not a Long.

getFloat

public float getFloat(java.lang.String key)

Retrieve the identified float value from the JobDataMap.

Throws:
java.lang.ClassCastException - if the identified object is not a Float.

getDouble

public double getDouble(java.lang.String key)

Retrieve the identified double value from the JobDataMap.

Throws:
java.lang.ClassCastException - if the identified object is not a Double.

getBoolean

public boolean getBoolean(java.lang.String key)

Retrieve the identified boolean value from the JobDataMap.

Throws:
java.lang.ClassCastException - if the identified object is not a Boolean.

getChar

public char getChar(java.lang.String key)

Retrieve the identified char value from the JobDataMap.

Throws:
java.lang.ClassCastException - if the identified object is not a Character.

getString

public java.lang.String getString(java.lang.String key)

Retrieve the identified String value from the JobDataMap.

Throws:
java.lang.ClassCastException - if the identified object is not a String.

getIntFromString

public int getIntFromString(java.lang.String key)

Retrieve the identified int value from the JobDataMap.

Throws:
java.lang.ClassCastException - if the identified object is not a String.

getIntegerFromString

public java.lang.Integer getIntegerFromString(java.lang.String key)

Retrieve the identified int value from the JobDataMap.

Throws:
java.lang.ClassCastException - if the identified object is not a String.

getBooleanValueFromString

public boolean getBooleanValueFromString(java.lang.String key)

Retrieve the identified boolean value from the JobDataMap.

Throws:
java.lang.ClassCastException - if the identified object is not a String.

getBooleanFromString

public java.lang.Boolean getBooleanFromString(java.lang.String key)

Retrieve the identified Boolean value from the JobDataMap.

Throws:
java.lang.ClassCastException - if the identified object is not a String.

getCharFromString

public char getCharFromString(java.lang.String key)

Retrieve the identified char value from the JobDataMap.

Throws:
java.lang.ClassCastException - if the identified object is not a String.

getCharacterFromString

public java.lang.Character getCharacterFromString(java.lang.String key)

Retrieve the identified Character value from the JobDataMap.

Throws:
java.lang.ClassCastException - if the identified object is not a String.

getDoubleValueFromString

public double getDoubleValueFromString(java.lang.String key)

Retrieve the identified double value from the JobDataMap.

Throws:
java.lang.ClassCastException - if the identified object is not a String.

getDoubleFromString

public java.lang.Double getDoubleFromString(java.lang.String key)

Retrieve the identified Double value from the JobDataMap.

Throws:
java.lang.ClassCastException - if the identified object is not a String.

getFloatValueFromString

public float getFloatValueFromString(java.lang.String key)

Retrieve the identified float value from the JobDataMap.

Throws:
java.lang.ClassCastException - if the identified object is not a String.

getFloatFromString

public java.lang.Float getFloatFromString(java.lang.String key)

Retrieve the identified Float value from the JobDataMap.

Throws:
java.lang.ClassCastException - if the identified object is not a String.

getLongValueFromString

public long getLongValueFromString(java.lang.String key)

Retrieve the identified long value from the JobDataMap.

Throws:
java.lang.ClassCastException - if the identified object is not a String.

getLongFromString

public java.lang.Long getLongFromString(java.lang.String key)

Retrieve the identified Long value from the JobDataMap.

Throws:
java.lang.ClassCastException - if the identified object is not a String.

getKeys

public java.lang.String[] getKeys()

Quartz Project Page