com.atlassian.scheduler.core.util
Class ParameterMapSerializer
java.lang.Object
com.atlassian.scheduler.core.util.ParameterMapSerializer
public class ParameterMapSerializer
- extends Object
Utility for serializing the parameters map to a byte[] and restoring it to its
original form.
- Since:
- v1.0
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ParameterMapSerializer
public ParameterMapSerializer()
serializeParameters
@Nullable
public static byte[] serializeParameters(@Nullable
Map<String,Serializable> parameters)
throws SchedulerServiceException
- Serializes the parameters to a byte array. It is highly recommended that
SchedulerService
implementations use this serialization to make it possible to
AbstractJobDetailsFactory.buildJobDetails(JobId,Object,RunMode) reconstruct}
the JobDetails even when the JobRunner for it has not been registered.
Otherwise, it will be difficult to recover any information about the job at all.
- Parameters:
parameters - the parameters map to serialize; may be null as shorthand for an empty map
- Returns:
- the serialized parameters map, or
null if parameters was either null or empty
- Throws:
SchedulerServiceException - if the parameters map cannot be serialized, presumably
because it contains an object that cannot be serialized
deserializeParameters
@Nonnull
public static Map<String,Serializable> deserializeParameters(@Nonnull
ClassLoader classLoader,
@Nullable
byte[] parameters)
throws ClassNotFoundException,
IOException
- Deserializes the parameters map from a byte array using the provided
ClassLoader.
- Parameters:
classLoader - the class loader to use for resolving classesparameters - the parameters to be deserialized; may be null, which results in an
empty map
- Returns:
- the deserialized parameters
- Throws:
ClassNotFoundException - if ClassLoaderAwareObjectInputStream does
IOException - if ClassLoaderAwareObjectInputStream does
Copyright © 2014 Atlassian. All Rights Reserved.