Package com.hazelcast.jet
Class Util
- java.lang.Object
-
- com.hazelcast.jet.Util
-
public final class Util extends java.lang.Object
Miscellaneous utility methods useful in DAG building logic.- Since:
- Jet 3.0
-
-
Method Summary
-
-
-
Method Detail
-
entry
public static <K,V> java.util.Map.Entry<K,V> entry(K k, V v)
Returns aMap.Entry
with the given key and value.
-
mapPutEvents
public static <K,V> PredicateEx<EventJournalMapEvent<K,V>> mapPutEvents()
Returns a predicate forSources.mapJournal(java.lang.String, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>>)
andSources.remoteMapJournal(java.lang.String, com.hazelcast.client.config.ClientConfig, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>>)
that passes onlyADDED
andUPDATED
events.
-
cachePutEvents
public static <K,V> PredicateEx<EventJournalCacheEvent<K,V>> cachePutEvents()
Returns a predicate forSources.cacheJournal(java.lang.String, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.cache.EventJournalCacheEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.cache.EventJournalCacheEvent<K, V>>)
andSources.remoteCacheJournal(java.lang.String, com.hazelcast.client.config.ClientConfig, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.cache.EventJournalCacheEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.cache.EventJournalCacheEvent<K, V>>)
that passes onlyCREATED
andUPDATED
events.
-
mapEventToEntry
public static <K,V> FunctionEx<EventJournalMapEvent<K,V>,java.util.Map.Entry<K,V>> mapEventToEntry()
Returns a projection that converts theEventJournalMapEvent
to aMap.Entry
using the event's new value as a value.- See Also:
Sources.mapJournal(java.lang.String, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>>)
,Sources.remoteMapJournal(java.lang.String, com.hazelcast.client.config.ClientConfig, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>>)
-
mapEventNewValue
public static <K,V> FunctionEx<EventJournalMapEvent<K,V>,V> mapEventNewValue()
Returns a projection that extracts the new value from anEventJournalMapEvent
.- See Also:
Sources.mapJournal(java.lang.String, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>>)
,Sources.remoteMapJournal(java.lang.String, com.hazelcast.client.config.ClientConfig, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>>)
-
cacheEventToEntry
public static <K,V> FunctionEx<EventJournalCacheEvent<K,V>,java.util.Map.Entry<K,V>> cacheEventToEntry()
Returns a projection that converts theEventJournalCacheEvent
to aMap.Entry
using the event's new value as a value.- See Also:
Sources.cacheJournal(java.lang.String, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.cache.EventJournalCacheEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.cache.EventJournalCacheEvent<K, V>>)
,Sources.remoteCacheJournal(java.lang.String, com.hazelcast.client.config.ClientConfig, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.cache.EventJournalCacheEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.cache.EventJournalCacheEvent<K, V>>)
-
cacheEventNewValue
public static <K,V> FunctionEx<EventJournalCacheEvent<K,V>,V> cacheEventNewValue()
Returns a projection that extracts the new value from anEventJournalCacheEvent
.- See Also:
Sources.mapJournal(java.lang.String, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>>)
,Sources.remoteMapJournal(java.lang.String, com.hazelcast.client.config.ClientConfig, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>>)
-
idToString
@Nonnull public static java.lang.String idToString(long id)
Converts along
job or execution ID to a string representation. Currently it is an unsigned 16-digit hex number.
-
idFromString
public static long idFromString(java.lang.String str)
Parses the jobId formatted withidToString(long)
.The method is lenient: if the string doesn't match the structure of the ID generated by
idToString
or if the string is null, it will return -1.- Returns:
- the parsed ID or -1 if parsing failed.
-
getFilePathOfClasspathResource
public static java.nio.file.Path getFilePathOfClasspathResource(java.lang.String resourcePath)
Takes the pathname of a classpath resource and returns aPath
that corresponds to it. This works only for resources that represent files or directories on the local file system (i.e., the class loader returns afile:
URL).For example, if you have a project directory
src/main/resources/python
, the files in it will become classpath resources with the"python"
path prefix. CallinggetFilePathOfClasspathResource("python")
will return the full path to the above directory in the project.- Parameters:
resourcePath
- the pathname of the classpath resource- Returns:
- a
Path
pointing to the project directory corresponding to the pathname - Since:
- Jet 4.0
-
-