mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-03 21:57:44 +00:00
2a644437fb
No sticker packs are available for use yet, but we now have the latent ability to send and receive.
24 lines
756 B
Java
24 lines
756 B
Java
package org.thoughtcrime.securesms.jobmanager;
|
|
|
|
import android.support.annotation.NonNull;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
class JobInstantiator {
|
|
|
|
private final Map<String, Job.Factory> jobFactories;
|
|
|
|
JobInstantiator(@NonNull Map<String, Job.Factory> jobFactories) {
|
|
this.jobFactories = new HashMap<>(jobFactories);
|
|
}
|
|
|
|
public @NonNull Job instantiate(@NonNull String jobFactoryKey, @NonNull Job.Parameters parameters, @NonNull Data data) {
|
|
if (jobFactories.containsKey(jobFactoryKey)) {
|
|
return jobFactories.get(jobFactoryKey).create(parameters, data);
|
|
} else {
|
|
throw new IllegalStateException("Tried to instantiate a job with key '" + jobFactoryKey + "', but no matching factory was found.");
|
|
}
|
|
}
|
|
}
|