public class ConfigurationTypeHelper extends Object
Constructor and Description |
---|
ConfigurationTypeHelper() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
getClassInstance(String context,
String clazzName,
Class<T> base)
Loads a class in the given classloader context.
|
static <T> T |
getClassInstance(String context,
String clazzName,
Class<T> base,
T defaultInstance)
Loads a class in the given classloader context, suppressing any exceptions, and optionally
providing a default instance to use.
|
static long |
getFixedMemoryAsBytes(String str)
Interprets a string specifying bytes.
|
static double |
getFraction(String str)
Interprets a string specifying a fraction.
|
static long |
getMemoryAsBytes(String str)
Interprets a string specifying a Memory type which is specified as a long integer followed by
an optional B (bytes), K (KB), M (MB), G (GB) or % (percentage).
|
static int |
getNumThreads(String threads)
Get the number of threads from string property.
|
static long |
getTimeInMillis(String str)
Interprets a string specifying a time duration.
|
public static long getFixedMemoryAsBytes(String str)
str
- String valuepublic static long getMemoryAsBytes(String str)
str
- String valuepublic static long getTimeInMillis(String str)
str
- string valuepublic static double getFraction(String str)
str
- string valuepublic static <T> T getClassInstance(String context, String clazzName, Class<T> base, T defaultInstance)
context
- the per-table context, can be nullclazzName
- the name of the class to loadbase
- the type of the classdefaultInstance
- a default instance if the class cannot be loadedpublic static <T> T getClassInstance(String context, String clazzName, Class<T> base) throws ClassNotFoundException, IOException, InstantiationException, IllegalAccessException
context
- the per-table context, can be nullclazzName
- the name of the class to loadbase
- the type of the classClassNotFoundException
IOException
InstantiationException
IllegalAccessException
public static int getNumThreads(String threads)
Copyright © 2011–2019 The Apache Software Foundation. All rights reserved.