Package org.jeasy.batch.core.util
Class Utils
- java.lang.Object
-
- org.jeasy.batch.core.util.Utils
-
public abstract class Utils extends java.lang.Object
Utilities class.- Author:
- Mahmoud Ben Hassine ([email protected])
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
FILE_SEPARATOR
static java.lang.String
JAVA_IO_TMPDIR
static java.lang.String
LINE_SEPARATOR
static java.lang.String
NOT_APPLICABLE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkArgument(boolean assertion, java.lang.String message)
static void
checkNotNull(java.lang.Object argument, java.lang.String argumentName)
static <P> java.util.List<P>
extractPayloads(java.util.List<? extends Record<P>> records)
Extract the payload form each record.static java.lang.String
formatDuration(java.time.Duration duration)
static java.lang.String
formatErrorThreshold(long errorThreshold)
static java.lang.String
formatTime(java.time.LocalDateTime time)
static java.lang.Class<?>
getGenericTypeNameFromTypeConverter(TypeConverter<?,?> typeConverter, int genericTypeIndex)
This method is used to get the generic parameter type (source or target) from aTypeConverter
.static java.util.Map<java.lang.String,java.lang.reflect.Method>
getGetters(java.lang.Class<?> type)
-
-
-
Field Detail
-
LINE_SEPARATOR
public static final java.lang.String LINE_SEPARATOR
-
FILE_SEPARATOR
public static final java.lang.String FILE_SEPARATOR
-
JAVA_IO_TMPDIR
public static final java.lang.String JAVA_IO_TMPDIR
-
NOT_APPLICABLE
public static final java.lang.String NOT_APPLICABLE
- See Also:
- Constant Field Values
-
-
Method Detail
-
checkNotNull
public static void checkNotNull(java.lang.Object argument, java.lang.String argumentName)
-
checkArgument
public static void checkArgument(boolean assertion, java.lang.String message)
-
getGetters
public static java.util.Map<java.lang.String,java.lang.reflect.Method> getGetters(java.lang.Class<?> type) throws java.beans.IntrospectionException
- Throws:
java.beans.IntrospectionException
-
formatTime
public static java.lang.String formatTime(java.time.LocalDateTime time)
-
formatDuration
public static java.lang.String formatDuration(java.time.Duration duration)
-
formatErrorThreshold
public static java.lang.String formatErrorThreshold(long errorThreshold)
-
extractPayloads
public static <P> java.util.List<P> extractPayloads(java.util.List<? extends Record<P>> records)
Extract the payload form each record.- Type Parameters:
P
- the type of payload- Parameters:
records
- the list of records- Returns:
- the list of payloads
-
getGenericTypeNameFromTypeConverter
public static java.lang.Class<?> getGenericTypeNameFromTypeConverter(TypeConverter<?,?> typeConverter, int genericTypeIndex) throws java.lang.Exception
This method is used to get the generic parameter type (source or target) from aTypeConverter
. This is used in:- ObjectMapper: when registering TypeConverter from String to ? (for parsing)
- BeanFieldExtractor: when registering TypeConverter from ? to String (for formatting)
- Parameters:
typeConverter
- to introspectgenericTypeIndex
- 0 or 1 depending on what we are looking for (source or target type)- Returns:
- The class name of the generic parameter type
- Throws:
java.lang.Exception
- when unable to get generic parameter type
-
-