Class JobDataMap
- java.lang.Object
-
- org.quartz.utils.DirtyFlagMap<java.lang.String,java.lang.Object>
-
- org.quartz.utils.StringKeyDirtyFlagMap
-
- org.quartz.JobDataMap
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.util.Map<java.lang.String,java.lang.Object>
public class JobDataMap extends StringKeyDirtyFlagMap implements java.io.Serializable
Holds state information forJobinstances.JobDataMapinstances are stored once when theJobis added to a scheduler. They are also re-persisted after every execution of jobs annotated with@PersistJobDataAfterExecution.JobDataMapinstances can also be stored with aTrigger. This can be useful in the case where you have a Job that is stored in the scheduler for regular/repeated use by multiple Triggers, yet with each independent triggering, you want to supply the Job with different data inputs.The
JobExecutionContextpassed to a Job at execution time also contains a convenienceJobDataMapthat is the result of merging the contents of the trigger's JobDataMap (if any) over the Job's JobDataMap (if any).Update since 2.2.4 - We keep an dirty flag for this map so that whenever you modify(add/delete) any of the entries, it will set to "true". However if you create new instance using an existing map with
JobDataMap(Map), then the dirty flag will NOT be set to "true" until you modify the instance.- Author:
- James House
- See Also:
Job,PersistJobDataAfterExecution,Trigger,JobExecutionContext, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description JobDataMap()Create an emptyJobDataMap.JobDataMap(java.util.Map<?,?> map)Create aJobDataMapwith the given data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.BooleangetBooleanFromString(java.lang.String key)Retrieve the identifiedBooleanvalue from theJobDataMap.booleangetBooleanValue(java.lang.String key)Retrieve the identifiedbooleanvalue from theJobDataMap.booleangetBooleanValueFromString(java.lang.String key)Retrieve the identifiedbooleanvalue from theJobDataMap.java.lang.CharactergetCharacterFromString(java.lang.String key)Retrieve the identifiedCharactervalue from theJobDataMap.chargetCharFromString(java.lang.String key)Retrieve the identifiedcharvalue from theJobDataMap.java.lang.DoublegetDoubleFromString(java.lang.String key)Retrieve the identifiedDoublevalue from theJobDataMap.doublegetDoubleValue(java.lang.String key)Retrieve the identifieddoublevalue from theJobDataMap.doublegetDoubleValueFromString(java.lang.String key)Retrieve the identifieddoublevalue from theJobDataMap.java.lang.FloatgetFloatFromString(java.lang.String key)Retrieve the identifiedFloatvalue from theJobDataMap.floatgetFloatValue(java.lang.String key)Retrieve the identifiedfloatvalue from theJobDataMap.floatgetFloatValueFromString(java.lang.String key)Retrieve the identifiedfloatvalue from theJobDataMap.java.lang.IntegergetIntegerFromString(java.lang.String key)Retrieve the identifiedintvalue from theJobDataMap.intgetIntFromString(java.lang.String key)Retrieve the identifiedintvalue from theJobDataMap.intgetIntValue(java.lang.String key)Retrieve the identifiedintvalue from theJobDataMap.java.lang.LonggetLongFromString(java.lang.String key)Retrieve the identifiedLongvalue from theJobDataMap.longgetLongValue(java.lang.String key)Retrieve the identifiedlongvalue from theJobDataMap.longgetLongValueFromString(java.lang.String key)Retrieve the identifiedlongvalue from theJobDataMap.voidputAsString(java.lang.String key, boolean value)Adds the givenbooleanvalue as a string version to theJob's data map.voidputAsString(java.lang.String key, char value)Adds the givencharvalue as a string version to theJob's data map.voidputAsString(java.lang.String key, double value)Adds the givendoublevalue as a string version to theJob's data map.voidputAsString(java.lang.String key, float value)Adds the givenfloatvalue as a string version to theJob's data map.voidputAsString(java.lang.String key, int value)Adds the givenintvalue as a string version to theJob's data map.voidputAsString(java.lang.String key, long value)Adds the givenlongvalue as a string version to theJob's data map.voidputAsString(java.lang.String key, java.lang.Boolean value)Adds the givenBooleanvalue as a string version to theJob's data map.voidputAsString(java.lang.String key, java.lang.Character value)Adds the givenCharactervalue as a string version to theJob's data map.voidputAsString(java.lang.String key, java.lang.Double value)Adds the givenDoublevalue as a string version to theJob's data map.voidputAsString(java.lang.String key, java.lang.Float value)Adds the givenFloatvalue as a string version to theJob's data map.voidputAsString(java.lang.String key, java.lang.Integer value)Adds the givenIntegervalue as a string version to theJob's data map.voidputAsString(java.lang.String key, java.lang.Long value)Adds the givenLongvalue as a string version to theJob's data map.-
Methods inherited from class org.quartz.utils.StringKeyDirtyFlagMap
containsTransientData, equals, getAllowsTransientData, getBoolean, getChar, getDouble, getFloat, getInt, getKeys, getLong, getString, hashCode, put, put, put, put, put, put, put, put, removeTransientData, setAllowsTransientData
-
Methods inherited from class org.quartz.utils.DirtyFlagMap
clear, clearDirtyFlag, clone, containsKey, containsValue, entrySet, get, getWrappedMap, isDirty, isEmpty, keySet, putAll, remove, size, values
-
-
-
-
Method Detail
-
putAsString
public void putAsString(java.lang.String key, boolean value)Adds the given
booleanvalue as a string version to theJob's data map.
-
putAsString
public void putAsString(java.lang.String key, java.lang.Boolean value)Adds the given
Booleanvalue as a string version to theJob's data map.
-
putAsString
public void putAsString(java.lang.String key, char value)Adds the given
charvalue as a string version to theJob's data map.
-
putAsString
public void putAsString(java.lang.String key, java.lang.Character value)Adds the given
Charactervalue as a string version to theJob's data map.
-
putAsString
public void putAsString(java.lang.String key, double value)Adds the given
doublevalue as a string version to theJob's data map.
-
putAsString
public void putAsString(java.lang.String key, java.lang.Double value)Adds the given
Doublevalue as a string version to theJob's data map.
-
putAsString
public void putAsString(java.lang.String key, float value)Adds the given
floatvalue as a string version to theJob's data map.
-
putAsString
public void putAsString(java.lang.String key, java.lang.Float value)Adds the given
Floatvalue as a string version to theJob's data map.
-
putAsString
public void putAsString(java.lang.String key, int value)Adds the given
intvalue as a string version to theJob's data map.
-
putAsString
public void putAsString(java.lang.String key, java.lang.Integer value)Adds the given
Integervalue as a string version to theJob's data map.
-
putAsString
public void putAsString(java.lang.String key, long value)Adds the given
longvalue as a string version to theJob's data map.
-
putAsString
public void putAsString(java.lang.String key, java.lang.Long value)Adds the given
Longvalue as a string version to theJob's data map.
-
getIntFromString
public int getIntFromString(java.lang.String key)
Retrieve the identified
intvalue from theJobDataMap.- Throws:
java.lang.ClassCastException- if the identified object is not a String.
-
getIntValue
public int getIntValue(java.lang.String key)
Retrieve the identified
intvalue from theJobDataMap.- Throws:
java.lang.ClassCastException- if the identified object is not a String or Integer.
-
getIntegerFromString
public java.lang.Integer getIntegerFromString(java.lang.String key)
Retrieve the identified
intvalue from theJobDataMap.- Throws:
java.lang.ClassCastException- if the identified object is not a String.
-
getBooleanValueFromString
public boolean getBooleanValueFromString(java.lang.String key)
Retrieve the identified
booleanvalue from theJobDataMap.- Throws:
java.lang.ClassCastException- if the identified object is not a String.
-
getBooleanValue
public boolean getBooleanValue(java.lang.String key)
Retrieve the identified
booleanvalue from theJobDataMap.- Throws:
java.lang.ClassCastException- if the identified object is not a String or Boolean.
-
getBooleanFromString
public java.lang.Boolean getBooleanFromString(java.lang.String key)
Retrieve the identified
Booleanvalue from theJobDataMap.- Throws:
java.lang.ClassCastException- if the identified object is not a String.
-
getCharFromString
public char getCharFromString(java.lang.String key)
Retrieve the identified
charvalue from theJobDataMap.- 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
Charactervalue from theJobDataMap.- Throws:
java.lang.ClassCastException- if the identified object is not a String.
-
getDoubleValueFromString
public double getDoubleValueFromString(java.lang.String key)
Retrieve the identified
doublevalue from theJobDataMap.- Throws:
java.lang.ClassCastException- if the identified object is not a String.
-
getDoubleValue
public double getDoubleValue(java.lang.String key)
Retrieve the identified
doublevalue from theJobDataMap.- Throws:
java.lang.ClassCastException- if the identified object is not a String or Double.
-
getDoubleFromString
public java.lang.Double getDoubleFromString(java.lang.String key)
Retrieve the identified
Doublevalue from theJobDataMap.- Throws:
java.lang.ClassCastException- if the identified object is not a String.
-
getFloatValueFromString
public float getFloatValueFromString(java.lang.String key)
Retrieve the identified
floatvalue from theJobDataMap.- Throws:
java.lang.ClassCastException- if the identified object is not a String.
-
getFloatValue
public float getFloatValue(java.lang.String key)
Retrieve the identified
floatvalue from theJobDataMap.- Throws:
java.lang.ClassCastException- if the identified object is not a String or Float.
-
getFloatFromString
public java.lang.Float getFloatFromString(java.lang.String key)
Retrieve the identified
Floatvalue from theJobDataMap.- Throws:
java.lang.ClassCastException- if the identified object is not a String.
-
getLongValueFromString
public long getLongValueFromString(java.lang.String key)
Retrieve the identified
longvalue from theJobDataMap.- Throws:
java.lang.ClassCastException- if the identified object is not a String.
-
getLongValue
public long getLongValue(java.lang.String key)
Retrieve the identified
longvalue from theJobDataMap.- Throws:
java.lang.ClassCastException- if the identified object is not a String or Long.
-
getLongFromString
public java.lang.Long getLongFromString(java.lang.String key)
Retrieve the identified
Longvalue from theJobDataMap.- Throws:
java.lang.ClassCastException- if the identified object is not a String.
-
-