org.springframework.batch.core
Class JobParameters

java.lang.Object
  extended by org.springframework.batch.core.JobParameters
All Implemented Interfaces:
Serializable

public class JobParameters
extends Object
implements Serializable

Value object representing runtime parameters to a batch job. Because the parameters have no individual meaning outside of the JobParameters they are contained within, it is a value object rather than an entity. It is also extremely important that a parameters object can be reliably compared to another for equality, in order to determine if one JobParameters object equals another. Furthermore, because these parameters will need to be persisted, it is vital that the types added are restricted. This class is immutable and therefore thread-safe.

Since:
1.0
Author:
Lucas Ward
See Also:
Serialized Form

Constructor Summary
JobParameters()
          Default constructor.
JobParameters(Map stringMap, Map longMap, Map doubleMap, Map dateMap)
          Create a new parameters object based upon the maps for each of the supported data types.
 
Method Summary
 boolean equals(Object obj)
           
 Date getDate(String key)
          Typesafe Getter for the Date represented by the provided key.
 Map getDateParameters()
          Get a map of only Date parameters
 Double getDouble(String key)
          Typesafe Getter for the Long represented by the provided key.
 Map getDoubleParameters()
          Get a map of only Double parameters
 Long getLong(String key)
          Typesafe Getter for the Long represented by the provided key.
 Map getLongParameters()
          Get a map of only Long parameters
 Map getParameters()
          Get a map of all parameters, including string, long, and date.
 String getString(String key)
          Typesafe Getter for the String represented by the provided key.
 Map getStringParameters()
          Get a map of only string parameters.
 int hashCode()
           
 boolean isEmpty()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JobParameters

public JobParameters()
Default constructor. Creates a new empty JobRuntimeParameters. It should be noted that this constructor should only be used if an empty parameters is needed, since JobRuntimeParameters is immutable.


JobParameters

public JobParameters(Map stringMap,
                     Map longMap,
                     Map doubleMap,
                     Map dateMap)
Create a new parameters object based upon the maps for each of the supported data types. See JobParametersBuilder for an easier way to create parameters.

Method Detail

getString

public String getString(String key)
Typesafe Getter for the String represented by the provided key.

Parameters:
key - The key to get a value for
Returns:
The String value

getLong

public Long getLong(String key)
Typesafe Getter for the Long represented by the provided key.

Parameters:
key - The key to get a value for
Returns:
The Long value

getDouble

public Double getDouble(String key)
Typesafe Getter for the Long represented by the provided key.

Parameters:
key - The key to get a value for
Returns:
The Double value

getDate

public Date getDate(String key)
Typesafe Getter for the Date represented by the provided key.

Parameters:
key - The key to get a value for
Returns:
The java.util.Date value

getParameters

public Map getParameters()
Get a map of all parameters, including string, long, and date. It should be noted that a Collections$UnmodifiableMap is returned, ensuring immutability.

Returns:
an unmodifiable map containing all parameters.

getStringParameters

public Map getStringParameters()
Get a map of only string parameters.

Returns:
String parameters.

getLongParameters

public Map getLongParameters()
Get a map of only Long parameters

Returns:
long parameters.

getDoubleParameters

public Map getDoubleParameters()
Get a map of only Double parameters

Returns:
long parameters.

getDateParameters

public Map getDateParameters()
Get a map of only Date parameters

Returns:
date parameters.

isEmpty

public boolean isEmpty()
Returns:
true if the prameters is empty, false otherwise.

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009 SpringSource. All Rights Reserved.