public class Osgl extends Object implements Serializable
Osgl is the umbrella namespace aggregates core utilities of OSGL toolkit:
Osgl.F namespaceMore about function interface
Under Osgl, there are six function interfaces defined, from Osgl.Func0
to Osgl.Func5, where the last digit means the number of parameters the function
is applied to. For example, the apply method of Func0 takes
no parameter while that of Func2 takes two parameters. All these function
interfaces are defined with generic type parameters, corresponding to the type of all
parameters and that of the return value. For procedure (a function that does not return anything),
the user application could use Void as the return value type, and return
null in the apply method implementation.
For each function interface, OSGL provide a base class, from Osgl.F0 to
Osgl.F5. Within the base class, OSGL implement several utility methods, including
Osgl.Break instanceUsually user application should define their function implementation by extending the base class in order to benefit from the utility methods; however in certain cases, e.g. a function implementation already extends another base class, user implementation cannot extends the base function class, OSGL provides easy way to convert user's implementation to corresponding base class implementation, here is one example of how to do it:
void foo(Osgl.Func2<Integer, String> f) {
F2<Integer, String> newF = Osgl.f2(f);
newF.chain(...);
...
}
Dumb functions, for certain case where a dumb function is needed, OSGL defines dumb function instances for
each function interface, say, from Osgl.F0 to Osgl.F5. Note the name of the dumb function
instance is the same as the name of the base function class. But they belong to different concept, class and
instance, so there is no conflict in the code. For each dumb function instance, a corresponding type safe
version is provided, Osgl.f0() to Osgl.f5(), this is the same case of
java.util.Collections.EMPTY_LIST and java.util.Collections.emptyList()
Utility methods
| Modifier and Type | Class and Description |
|---|---|
static interface |
Osgl.Bijection<X,Y>
|
static class |
Osgl.Break
A Break is used to shortcut a sequence of function executions
|
static class |
Osgl.Comparator<T>
Adapt JDK Comparator (since 1.2) to Functional programming.
|
static class |
Osgl.Conf
Namespace to configure or extend OSGL _ utilities
|
static class |
Osgl.F
The namespace to aggregate predefined core functions
|
static class |
Osgl.F0<R>
Default implementation for
Osgl.Func0. |
static class |
Osgl.F1<P1,R>
Base implementation of
Osgl.Function function. |
static class |
Osgl.F2<P1,P2,R>
Base implementation of
Osgl.Func2 function. |
static class |
Osgl.F3<P1,P2,P3,R>
Base implementation of
Osgl.Func3 function. |
static class |
Osgl.F4<P1,P2,P3,P4,R>
Base implementation of
Osgl.Func4 function. |
static class |
Osgl.F5<P1,P2,P3,P4,P5,R>
Base implementation of
Osgl.Func5 function. |
static class |
Osgl.Factory<T>
The class adapt traditional Factory to Function
|
static interface |
Osgl.Func0<R>
Define a function that apply to no parameter (strictly this is not a function)
|
static interface |
Osgl.Func1<P1,R>
Alias of
Osgl.Function |
static interface |
Osgl.Func2<P1,P2,R>
Define a function structure that accept two parameter
|
static interface |
Osgl.Func3<P1,P2,P3,R>
Define a function structure that accept three parameter
|
static interface |
Osgl.Func4<P1,P2,P3,P4,R>
Define a function structure that accept four parameter
|
static interface |
Osgl.Func5<P1,P2,P3,P4,P5,R>
Define a function structure that accept five parameter
|
static class |
Osgl.FuncBase
The base for all Fx function class implemention
|
static interface |
Osgl.Function<T,U>
Define a function structure that accept one parameter.
|
static class |
Osgl.IndexedVisitor<K,T>
An
IndexedVisitor provide a tool to iterate through a Map or indexed list
by passing the key/index and the value to the function. |
static class |
Osgl.Meta<T> |
static interface |
Osgl.MultiplicableFunction<P1,R>
A
Osgl.Function function that support Osgl.MultiplicableFunction.times(int) operation |
static class |
Osgl.None<T> |
static class |
Osgl.Operator<T> |
static class |
Osgl.Option<T>
Defines an option of element
T. |
static class |
Osgl.Predicate<T>
Predicate is a predefined Function<Boolean, T> typed
function with a set of utilities dealing with boolean operations. |
static class |
Osgl.Processor<T>
Define a processor function which applied to one parameter and return the parameter instance after
processing on the parameter
|
static class |
Osgl.Some<T> |
static class |
Osgl.T2<A,B> |
static class |
Osgl.T3<A,B,C> |
static class |
Osgl.T4<A,B,C,D> |
static class |
Osgl.T5<A,B,C,D,E> |
static class |
Osgl.Transformer<FROM,TO>
A Transformer is literally a kind of
Osgl.F1 function |
static class |
Osgl.Tuple<A,B> |
static class |
Osgl.V1<P1> |
static class |
Osgl.V2<P1,P2> |
static class |
Osgl.V3<P1,P2,P3> |
static class |
Osgl.V4<P1,P2,P3,P4> |
static class |
Osgl.V5<P1,P2,P3,P4,P5> |
static class |
Osgl.Val<T> |
static class |
Osgl.Var<T> |
static class |
Osgl.Visitor<T>
Define a visitor (known as Consumer in java 8) function which applied to one parameter and without return type
|
| Modifier and Type | Field and Description |
|---|---|
static Osgl.Break |
BREAK
A predefined Break instance without payload
|
static Osgl.Conf |
conf |
static Osgl.F0 |
F0
A dumb function for
Osgl.Func0 that does nothing and return null |
static Osgl.F1 |
F1
A dumb
Osgl.Function implementation that does nothing and return null |
static Osgl.F2 |
F2
A dumb
Osgl.Func2 implementation that does nothing and return null |
static Osgl.F3 |
F3
A dumb
Osgl.Func3 implementation that does nothing and return null |
static Osgl.F4 |
F4
A dumb
Osgl.Func4 implementation that does nothing and return null |
static Osgl.F5 |
F5
A dumb
Osgl.Func5 implementation that does nothing and return null |
static Osgl |
INSTANCE |
static boolean |
IS_64 |
static boolean |
IS_SERVER |
static int |
JAVA_VERSION |
static Osgl.None |
NONE |
static OS |
OS |
static PropertyHandlerFactory |
propertyHandlerFactory |
| Modifier | Constructor and Description |
|---|---|
protected |
Osgl() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
anyNull(Object o,
Object... oa)
Check if any objects in the parameter list is null
|
static <T extends Enum<T>> |
asEnum(Class<T> enumClass,
String name)
Return an enum value from code
|
static <T extends Enum<T>> |
asEnum(Class<T> enumClass,
String name,
boolean caseSensitive)
Return an enum value from code
|
static Boolean[] |
asObject(boolean[] pa) |
static Byte[] |
asObject(byte[] pa) |
static Character[] |
asObject(char[] pa) |
static Double[] |
asObject(double[] pa) |
static Float[] |
asObject(float[] pa) |
static Integer[] |
asObject(int[] pa) |
static Long[] |
asObject(long[] pa) |
static Short[] |
asObject(short[] pa) |
static boolean[] |
asPrimitive(Boolean[] oa) |
static byte[] |
asPrimitive(Byte[] oa) |
static char[] |
asPrimitive(Character[] oa) |
static double[] |
asPrimitive(Double[] oa) |
static float[] |
asPrimitive(Float[] oa) |
static int[] |
asPrimitive(Integer[] oa) |
static long[] |
asPrimitive(Long[] oa) |
static short[] |
asPrimitive(Short[] oa) |
static <T> Future<T> |
async(Osgl.F0<T> callback,
int milliseconds)
Execute callback asynchronously after delay specified
|
static boolean |
bool(BigDecimal v)
Do bool evaluation on a BigDecimal value
|
static boolean |
bool(BigInteger v)
Do bool evaluation on a BigInteger value
|
static boolean |
bool(boolean v) |
static boolean |
bool(byte v)
Do bool evaluation on a byte value
|
static boolean |
bool(char v)
Do bool evaluation on a char value
|
static boolean |
bool(Collection<?> c)
Do bool evaluation on a collection.
|
static boolean |
bool(double v)
Do bool evaluation on a double value
|
static boolean |
bool(File v)
Do bool evaluation on a File instance.
|
static boolean |
bool(float v)
Do bool evaluation on a float value
|
static boolean |
bool(int v)
Do bool evaluation on a int value
|
static boolean |
bool(long v)
Do bool evaluation on a long value
|
static boolean |
bool(Object v)
Evaluate an object's bool value.
|
static boolean |
bool(Osgl.Func0<?> v)
Do bool evaluation on an
Osgl.Func0 instance. |
static boolean |
bool(String s)
Do bool evaluation on a String.
|
static <T> Osgl.Break |
breakOut(T e)
A utility method to throw out a Break with payload
|
static <T> T |
cast(Object o) |
static <T> Osgl.Option<T> |
cast(Object o,
Class<T> c)
Cast an object to a type.
|
static <T> Class<T> |
classForName(String className) |
static <T> Class<T> |
classForName(String className,
ClassLoader classLoader) |
static <T> Osgl.Comparator<T> |
comparator(Comparator<? super T> c)
Adapt a jdk
Comparator into osgl Comparator |
static <T> Osgl.Comparator<T> |
comparator(Osgl.Func2<? super T,? super T,Integer> f)
Adapt a general
Osgl.Func2 function with (T, T, Integer) type into Comparator |
static boolean[] |
concat(boolean[] a1,
boolean[] a2) |
static boolean[] |
concat(boolean[] a1,
boolean[] a2,
boolean[]... rest) |
static byte[] |
concat(byte[] a1,
byte[] a2) |
static byte[] |
concat(byte[] a1,
byte[] a2,
byte[]... rest) |
static char[] |
concat(char[] a1,
char[] a2) |
static char[] |
concat(char[] a1,
char[] a2,
char[]... rest) |
static double[] |
concat(double[] a1,
double[] a2) |
static double[] |
concat(double[] a1,
double[] a2,
double[]... rest) |
static float[] |
concat(float[] a1,
float[] a2) |
static float[] |
concat(float[] a1,
float[] a2,
float[]... rest) |
static int[] |
concat(int[] a1,
int[] a2) |
static int[] |
concat(int[] a1,
int[] a2,
int[]... rest) |
static long[] |
concat(long[] a1,
long[] a2) |
static long[] |
concat(long[] a1,
long[] a2,
long[]... rest) |
static short[] |
concat(short[] a1,
short[] a2) |
static short[] |
concat(short[] a1,
short[] a2,
short[]... rest) |
static <T> T[] |
concat(T[] a,
T t) |
static <T> T[] |
concat(T[] a1,
T[] a2) |
static <T> T[] |
concat(T[] a1,
T[] a2,
T[]... rest) |
static <T> Const<T> |
constant() |
static <T> Const<T> |
constant(T t) |
static <T> ContextLocal<T> |
contextLocal() |
static <T> ContextLocal<T> |
contextLocal(ContextLocal.InitialValueProvider<T> ivp) |
static <T> T |
deserialize(byte[] ba) |
static <T> T |
deserialize(byte[] ba,
Class<T> c) |
static void |
echo(String msg,
Object... args) |
static <T> T |
ensureGet(T t1,
List<T> defs) |
static <T> T |
ensureGet(T t1,
Osgl.F0<T> def1) |
static <T> T |
ensureGet(T t1,
T def1) |
static <T> T |
ensureGet(T t1,
T def1,
T def2) |
static <T> T |
ensureGet(T t1,
T def1,
T def2,
T def3) |
static boolean |
eq(boolean a,
boolean b)
Check if two
boolean value equals to each other |
static boolean |
eq(byte a,
byte b)
Check if two
byte value equals to each other |
static boolean |
eq(char a,
char b)
Check if two
char value equals to each other |
static boolean |
eq(double a,
double b)
Check if two
double value equals to each other |
static boolean |
eq(float a,
float b)
Check if two
float value equals to each other |
static boolean |
eq(int a,
int b)
Check if two
int value equals to each other |
static boolean |
eq(long a,
long b)
Check if two
long value equals to each other |
static boolean |
eq(Object a,
Object b)
Check if two object is equals to each other.
|
static boolean |
eq(short a,
short b)
Check if two
short value equals to each other |
static boolean |
eq2(Object a,
Object b)
Check if two objects are equals to each other.
|
boolean |
equals(Object obj) |
static void |
error(String msg,
Object... args) |
static Map<String,Object> |
evaluate(Annotation anno)
Evaluate Annotation properties
|
static <T> Osgl.F0<T> |
f0()
Return a dumb function for
Osgl.Func0. |
static <R> Osgl.F0<R> |
f0(Osgl.Func0<? extends R> f0)
Convert a general
Osgl.Func0 typed function to Osgl.F0 type |
static <P1,R> Osgl.F1<P1,R> |
f1()
The type-safe version of
F1 |
static <X,Y> Osgl.F1<X,Y> |
f1(Osgl.Bijection<X,Y> f1) |
static <P1,R> Osgl.F1<P1,R> |
f1(Osgl.Function<? super P1,? extends R> f1)
Convert a general
Osgl.Function function into a Osgl.F1 typed
function |
static <P1,P2,R> Osgl.F2<P1,P2,R> |
f2()
The type-safe version of
F2 |
static <P1,P2,R> Osgl.F2<P1,P2,R> |
f2(Osgl.Func2<? super P1,? super P2,? extends R> f2)
Convert a general
Osgl.Func2 function into a Osgl.F2 typed
function |
static <P1,P2,P3,R> |
f3()
The type-safe version of
F3 |
static <P1,P2,P3,R> |
f3(Osgl.Func3<? super P1,? super P2,? super P3,? extends R> f3)
Convert a general
Osgl.Func3 function into a Osgl.F3 typed
function |
static <P1,P2,P3,P4,R> |
f4()
The type-safe version of
F4 |
static <P1,P2,P3,P4,R> |
f4(Osgl.Func4<? super P1,? super P2,? super P3,? super P4,? extends R> f4)
Convert a general
Osgl.Func4 function into a Osgl.F4 typed
function |
static <P1,P2,P3,P4,P5,R> |
f5()
The type-safe version of
F5 |
static <P1,P2,P3,P4,P5,R> |
f5(Osgl.Func5<? super P1,? super P2,? super P3,? super P4,? super P5,? extends R> f5)
Convert a general
Osgl.Func5 function into a Osgl.F5 typed
function |
static <T> Osgl.Factory<T> |
factory(Osgl.Func0<T> func) |
static Field |
fieldOf(Class<?> c,
String name)
Returns non-static field of a class by name.
|
static Field |
fieldOf(Class<?> c,
String name,
boolean noStatic)
Returns field of a class by name.
|
static Field |
fieldOf(Class<?> c,
String name,
Class<?> rootClass,
boolean noStatic)
Returns field of a class by name.
|
static List<Field> |
fieldsOf(Class<?> c)
Returns all fields of a class and all super classes.
|
static List<Field> |
fieldsOf(Class<?> c,
boolean noStatic)
Returns all fields of a class and all super classes.
|
static List<Field> |
fieldsOf(Class<?> c,
Class<?> rootClass,
boolean noStatic)
Returns all fields of a class and all super classes until root class.
|
static List<Field> |
fieldsOf(Class<?> c,
Class<?> rootClass,
Osgl.Function<Field,Boolean> filter)
Returns all fields of a class and all super classes until root class.
|
static List<Field> |
fieldsOf(Class<?> c,
Osgl.Function<Class<?>,Boolean> classFilter,
Osgl.Function<Field,Boolean> fieldFilter) |
static List<Field> |
fieldsOf(Class<?> c,
Osgl.Function<Field,Boolean> filter)
Returns all fields of a class and all super classes.
|
static void |
fill(boolean element,
boolean[] array) |
static void |
fill(byte element,
byte[] array) |
static void |
fill(char element,
char[] array) |
static void |
fill(double element,
double[] array) |
static void |
fill(float element,
float[] array) |
static void |
fill(int element,
int[] array) |
static void |
fill(long element,
long[] array) |
static void |
fill(short element,
short[] array) |
static <T> void |
fill(T element,
T[] array) |
static String |
fmt(String tmpl,
Object... args)
Alias of
S.fmt(String, Object...) |
static <T> Osgl.Predicate<T> |
generalPredicate(Osgl.Function<? super T,?> f)
Convert a general
Function<T, ?> typed function to
Predicate<T> function. |
static Method |
getMethod(Class c,
String methodName,
Class... argTypes)
Returns
Method by name and argument type |
static Method |
getMethod(Class c,
String methodName,
Object... pa)
Returns
Method by name and parameter value |
static <T> T |
getProperty(CacheService cache,
Object entity,
String property) |
static <T> T |
getProperty(Object entity,
String property) |
static <T> Osgl.Visitor<T> |
guardedVisitor(Osgl.Function<? super T,Boolean> predicate,
Osgl.Function<? super T,?> visitor)
Return a composed visitor function that only applies when the guard predicate test returns
true |
int |
hashCode() |
static int |
hc(boolean o) |
static int |
hc(boolean[] oa) |
static int |
hc(byte o) |
static int |
hc(byte[] oa) |
static int |
hc(char o) |
static int |
hc(char[] oa) |
static int |
hc(double o) |
static int |
hc(double[] oa)
Calculate hashcode of double array specified
|
static int |
hc(float o) |
static int |
hc(float[] oa) |
static int |
hc(int o) |
static int |
hc(int[] oa) |
static int |
hc(long o) |
static int |
hc(long[] oa) |
static int |
hc(Object o)
Calculate hashcode of objects specified
|
static int |
hc(Object o1,
Object o2)
Calculate hashcode of objects specified
|
static int |
hc(Object o1,
Object o2,
Object o3)
Calculate hashcode of objects specified
|
static int |
hc(Object o1,
Object o2,
Object o3,
Object o4)
Calculate hashcode of objects specified
|
static int |
hc(Object o1,
Object o2,
Object o3,
Object o4,
Object o5)
Calculate hashcode of objects specified
|
static int |
hc(Object o1,
Object o2,
Object o3,
Object o4,
Object o5,
Object... args)
Calculate hashcode of objects specified
|
static int |
hc(short o) |
static int |
hc(short[] oa) |
static <T> T |
ifNullThen(T t1,
Osgl.F0<T> def1) |
static <T> T |
ifNullThen(T t1,
T def1) |
static <K,T> Osgl.IndexedVisitor<K,T> |
indexGuardedVisitor(Osgl.Function<? super K,Boolean> guard,
Osgl.Visitor<? super T> visitor) |
static <T,R> R |
invokeStatic(Class<T> c,
String methodName,
Object... pa)
Invoke a static method by name and parameters
|
static <R> R |
invokeStatic(Method method,
Object... pa)
Invoke a static method.
|
static <T,R> R |
invokeStatic(Osgl.Var<Method> methodBag,
Class<T> c,
String methodName,
Object... pa)
Invoke a static method by name and parameters.
|
static <T,R> R |
invokeVirtual(Osgl.Var<Method> methodBag,
T o,
String methodName,
Object... pa)
Invoke a virtual method by instance, method name and arguments.
|
static <T,R> R |
invokeVirtual(T o,
Method method,
Object... pa)
Invoke a virtual
method. |
static <T,R> R |
invokeVirtual(T o,
String methodName,
Object... pa)
Invoke a virtual method by instance, method name and arguments.
|
static boolean |
isNull(Object o)
Check if an object is
null or NONE |
static boolean |
isSimpleType(Class<?> c)
Check if a give class `c` is a simple type.
|
static int |
iterableHashCode(Iterable<?> it) |
static <T> T |
materialize(byte[] ba) |
static <T> T |
materialize(byte[] ba,
Class<T> c) |
static <T> Osgl.Meta<T> |
meta(T t) |
static long |
ms()
Return
current time millis |
static boolean |
ne(Object a,
Object b)
Check if two objects are equals to each other.
|
static boolean[] |
newArray(boolean[] model) |
static boolean[] |
newArray(boolean[] model,
int size) |
static byte[] |
newArray(byte[] model) |
static byte[] |
newArray(byte[] model,
int size) |
static char[] |
newArray(char[] model) |
static char[] |
newArray(char[] model,
int size) |
static double[] |
newArray(double[] model) |
static double[] |
newArray(double[] model,
int size) |
static float[] |
newArray(float[] model) |
static float[] |
newArray(float[] model,
int size) |
static int[] |
newArray(int[] model) |
static int[] |
newArray(int[] model,
int size) |
static long[] |
newArray(long[] model) |
static long[] |
newArray(long[] model,
int size) |
static short[] |
newArray(short[] model) |
static short[] |
newArray(short[] model,
int size) |
static <T> T[] |
newArray(T[] model)
Create an new array with specified array type and length
|
static <T> T[] |
newArray(T[] model,
int size)
Create an new array with specified type and length
|
static <T> T |
newInstance(Class<T> c) |
static <T> T |
newInstance(Class<T> c,
Object p1,
Object p2,
Object p3,
Object p4,
Object p5,
Object... pa) |
static <T,P1> T |
newInstance(Class<T> c,
P1 p1) |
static <T,P1,P2> T |
newInstance(Class<T> c,
P1 p1,
P2 p2) |
static <T,P1,P2,P3> |
newInstance(Class<T> c,
P1 p1,
P2 p2,
P3 p3) |
static <T,P1,P2,P3,P4> |
newInstance(Class<T> c,
P1 p1,
P2 p2,
P3 p3,
P4 p4) |
static <T,P1,P2,P3,P4,P5> |
newInstance(Class<T> c,
P1 p1,
P2 p2,
P3 p3,
P4 p4,
P5 p5) |
static <T> T |
newInstance(String className) |
static <T> T |
newInstance(String className,
ClassLoader cl) |
static void |
nil()
An empty method.
|
static <T> Osgl.None<T> |
none() |
static boolean |
noneNull(Object o,
Object... oa) |
static boolean |
not(BigDecimal v)
Returns negative of
bool(BigDecimal) |
static boolean |
not(BigInteger v)
Returns negative of
bool(BigInteger) |
static boolean |
not(boolean v)
Returns negative of a boolean value
|
static boolean |
not(byte v)
Returns negative of
bool(byte) |
static boolean |
not(char v)
Returns negative of
bool(char) |
static boolean |
not(Collection<?> c)
Returns negative of
bool(java.util.Collection) |
static boolean |
not(double v)
Returns negative of
bool(double) |
static boolean |
not(File file)
Returns negative of
bool(File) |
static boolean |
not(float v)
Returns negative of
bool(float) |
static boolean |
not(int v)
Returns negative of
bool(int) |
static boolean |
not(long v)
Returns negative of
bool(long) |
static boolean |
not(Object o)
Returns negative of
bool(java.lang.Object) |
static boolean |
not(Osgl.Func0<?> f)
Returns negative of
bool(Osgl.Func0) |
static boolean |
not(String s)
Returns negative of
bool(java.lang.String) |
static <T> T |
notNull(T o) |
static <T> T |
NPE(T o) |
static long |
ns()
Return
current nano time |
static <T> Osgl.Predicate<T> |
predicate(Osgl.Function<? super T,Boolean> f)
Convert a
Function<T, Boolean> typed function to
Predicate<T> function. |
static Class |
primitiveTypeOf(Class c) |
static <T> T |
random(C.Range<T> range) |
static <T> T |
random(List<T> list) |
static <T> T |
random(T[] ta) |
static <T> T |
random(T t1,
T... ta) |
static String |
randomStr() |
static String |
randomStr(int len) |
static boolean[] |
reverse(boolean[] a) |
static byte[] |
reverse(byte[] a) |
static char[] |
reverse(char[] a) |
static double[] |
reverse(double[] a) |
static float[] |
reverse(float[] a) |
static int[] |
reverse(int[] a) |
static long[] |
reverse(long[] a) |
static Object[] |
reverse(Object[] a) |
static short[] |
reverse(short[] a) |
static <T> Osgl.Option<Class<T>> |
safeClassForName(String className) |
static <T> Osgl.Option<Class<T>> |
safeClassForName(String className,
ClassLoader classLoader) |
static <T> Osgl.Option<T> |
safeNewInstance(String className) |
static <T> int |
search(T element,
T... elements)
Search an element in a array
|
static <T> byte[] |
serialize(T obj) |
static <T,F> T |
setField(String fieldName,
T obj,
F val)
Set an object field value using reflection.
|
static void |
setProperty(CacheService cache,
Object entity,
Object val,
String property) |
static void |
setProperty(Object entity,
Object val,
String property) |
static <T> Osgl.Option<T> |
some(T a) |
static <A,B> Osgl.T2<A,B> |
T2(A a,
B b) |
static <A,B,C> Osgl.T3<A,B,C> |
T3(A a,
B b,
C c) |
static <A,B,C,D> Osgl.T4<A,B,C,D> |
T4(A a,
B b,
C c,
D d) |
static <A,B,C,D,E> |
T5(A a,
B b,
C c,
D d,
E e) |
static <T> T |
times(Osgl.Function<T,T> func,
T initVal,
int n) |
String |
toString() |
static String |
toString(Object o)
Returns String representation of an object instance.
|
static String |
toString2(Object o) |
static long |
ts()
Return current time stamp in nano seconds.
|
static <P1,P2> Osgl.Tuple<P1,P2> |
Tuple(P1 a,
P2 b) |
static <T> Osgl.Val<T> |
val(T t) |
static <T> Osgl.Var<T> |
var() |
static <T> Osgl.Var<T> |
var(T t) |
static <T> Osgl.Visitor<T> |
visitor(Osgl.Function<? super T,?> f)
Convert a
Function<? super T, Void> function into a Osgl.Visitor |
static Class |
wrapperClassOf(Class c) |
public static final Osgl INSTANCE
public static final Osgl.F0 F0
Osgl.Func0 that does nothing and return nullf0()public static final Osgl.F1 F1
Osgl.Function implementation that does nothing and return nullf1()public static final Osgl.F2 F2
Osgl.Func2 implementation that does nothing and return nullf2()public static final Osgl.F3 F3
Osgl.Func3 implementation that does nothing and return nullf3()public static final Osgl.F4 F4
Osgl.Func4 implementation that does nothing and return nullf4()public static final Osgl.F5 F5
Osgl.Func5 implementation that does nothing and return nullf5()public static final Osgl.Break BREAK
public static final Osgl.None NONE
public static PropertyHandlerFactory propertyHandlerFactory
public static final Osgl.Conf conf
public static final int JAVA_VERSION
public static final boolean IS_SERVER
public static final boolean IS_64
public static final OS OS
public static <T> Osgl.Factory<T> factory(Osgl.Func0<T> func)
public static <T> Osgl.F0<T> f0()
Osgl.Func0. This is the type-safe version of F0T - a generic type that matches whatever type required by the context of applying the functionnullpublic static <R> Osgl.F0<R> f0(Osgl.Func0<? extends R> f0)
Osgl.Func0 typed function to Osgl.F0 typeR - the generic type of the return value when applying function f0f0 - a function of type Osgl.Func0 that returns type R valueOsgl.F0 type that is equaivlent to function f0public static <P1,R> Osgl.F1<P1,R> f1()
F1P1 - the argument typeR - the return value typeF1public static <P1,R> Osgl.F1<P1,R> f1(Osgl.Function<? super P1,? extends R> f1)
Osgl.Function function into a Osgl.F1 typed
functionP1 - the argument typeR - the return value typef1 - the function that consumes P1 and produce RRpublic static <X,Y> Osgl.F1<X,Y> f1(Osgl.Bijection<X,Y> f1)
public static <P1,P2,R> Osgl.F2<P1,P2,R> f2()
F2P1 - the type of the first param the new function applied toP2 - the type of the second param the new function applied toR - the type of new function application resultF2public static <P1,P2,R> Osgl.F2<P1,P2,R> f2(Osgl.Func2<? super P1,? super P2,? extends R> f2)
Osgl.Func2 function into a Osgl.F2 typed
functionP1 - the type of the first param the new function applied toP2 - the type of the second param the new function applied toR - the type of new function application resultf2 - the function that takes two arguments and return type RF2 instance corresponding to the specified Func2 instancepublic static <P1,P2,P3,R> Osgl.F3<P1,P2,P3,R> f3()
F3P1 - the type of first parameter this function applied toP2 - the type of second parameter this function applied toP3 - the type of thrid parameter this function applied toR - the type of the return value when this function applied to the parameter(s)F3public static <P1,P2,P3,R> Osgl.F3<P1,P2,P3,R> f3(Osgl.Func3<? super P1,? super P2,? super P3,? extends R> f3)
Osgl.Func3 function into a Osgl.F3 typed
functionP1 - type of argument 1P2 - type of argument 2P3 - type of argument 3R - return typef3 - the general function with three paramsF3 typed instance which is equivalent to f3public static <P1,P2,P3,P4,R> Osgl.F4<P1,P2,P3,P4,R> f4()
F4P1 - type of first argumentP2 - type of second argumentP3 - type of third argumentP4 - type of fourth argumentR - type of return valueF4 functionpublic static <P1,P2,P3,P4,R> Osgl.F4<P1,P2,P3,P4,R> f4(Osgl.Func4<? super P1,? super P2,? super P3,? super P4,? extends R> f4)
Osgl.Func4 function into a Osgl.F4 typed
functionP1 - type of first argumentP2 - type of second argumentP3 - type of third argumentP4 - type of fourth argumentR - type of return valuef4 - the function to be convertedOsgl.F4 type that is equivalent to function f4public static <P1,P2,P3,P4,P5,R> Osgl.F5<P1,P2,P3,P4,P5,R> f5()
F5P1 - type of first argumentP2 - type of second argumentP3 - type of third argumentP4 - type of fourth argumentP5 - type of fifth argumentR - type of return valueF5 functionpublic static <P1,P2,P3,P4,P5,R> Osgl.F5<P1,P2,P3,P4,P5,R> f5(Osgl.Func5<? super P1,? super P2,? super P3,? super P4,? super P5,? extends R> f5)
Osgl.Func5 function into a Osgl.F5 typed
functionP1 - type of first argumentP2 - type of second argumentP3 - type of third argumentP4 - type of fourth argumentP5 - type of fifth argumentR - type of return valuef5 - the function to be convertedOsgl.F5 type that is equivalent to function f5public static <T> Osgl.Comparator<T> comparator(Osgl.Func2<? super T,? super T,Integer> f)
Osgl.Func2 function with (T, T, Integer) type into ComparatorT - the type of the parameterf - The function takes two params (the same type) and returns integerComparator instance backed by function fpublic static <T> Osgl.Comparator<T> comparator(Comparator<? super T> c)
Comparator into osgl ComparatorT - the element type the comparator comparesc - the jdk compatorComparator instance backed by comparator cpublic static <T> Osgl.Predicate<T> predicate(Osgl.Function<? super T,Boolean> f)
Function<T, Boolean> typed function to
Predicate<T> function.
If the function specified is already a Osgl.Predicate, then
the function itself is returned
T - the argument typef - the function to be convertedOsgl.Predicate type that is equivalent to function fpublic static <T> Osgl.Predicate<T> generalPredicate(Osgl.Function<? super T,?> f)
Function<T, ?> typed function to
Predicate<T> function. When the predicate function
returned apply to a param, it will first apply the specified f1 to the
param, and they call bool(java.lang.Object) to evaluate the boolean
value of the return object of the application.
If the function specified is already a Osgl.Predicate, then
the function itself is returned
T - the argument typef - the functionOsgl.Predicate type that is equivalent to the function fpublic static <T> Osgl.Visitor<T> visitor(Osgl.Function<? super T,?> f)
Function<? super T, Void> function into a Osgl.VisitorT - the argument typef - the function to be castOsgl.Visitor type function that is equal with the function fpublic static <T> Osgl.Visitor<T> guardedVisitor(Osgl.Function<? super T,Boolean> predicate, Osgl.Function<? super T,?> visitor)
trueT - the type of the element be tested and visitedpredicate - the predicate to test the element been visitedvisitor - the function that visit(accept) the element if the guard tested the element successfullypublic static <T> Osgl.Break breakOut(T e)
T - the type of the payloade - the payload objectpublic static <K,T> Osgl.IndexedVisitor<K,T> indexGuardedVisitor(Osgl.Function<? super K,Boolean> guard, Osgl.Visitor<? super T> visitor)
public static <P1,P2> Osgl.Tuple<P1,P2> Tuple(P1 a, P2 b)
public static <A,B> Osgl.T2<A,B> T2(A a, B b)
public static <A,B,C> Osgl.T3<A,B,C> T3(A a, B b, C c)
public static <A,B,C,D> Osgl.T4<A,B,C,D> T4(A a, B b, C c, D d)
public static <A,B,C,D,E> Osgl.T5<A,B,C,D,E> T5(A a, B b, C c, D d, E e)
public static <T> Osgl.Option<T> some(T a)
public static <T> Osgl.None<T> none()
public static <T> Osgl.Var<T> var(T t)
public static <T> Osgl.Var<T> var()
public static <T> Osgl.Val<T> val(T t)
public static <T> Const<T> constant(T t)
public static <T> Const<T> constant()
public static boolean eq(Object a, Object b)
a - the first objectb - the second objecttrue if a equals to bne(Object, Object)public static boolean eq2(Object a, Object b)
a - the first objectb - the second objecttrue if the first object equals to the second objectpublic static boolean eq(boolean a,
boolean b)
boolean value equals to each othera - boolean ab - boolean btrue if a == bpublic static boolean eq(byte a,
byte b)
byte value equals to each othera - byte ab - byte btrue if a == bpublic static boolean eq(char a,
char b)
char value equals to each othera - char ab - char btrue if a == bpublic static boolean eq(short a,
short b)
short value equals to each othera - short ab - short btrue if a == bpublic static boolean eq(int a,
int b)
int value equals to each othera - int ab - int btrue if a == bpublic static boolean eq(float a,
float b)
float value equals to each othera - float ab - float btrue if a == bpublic static boolean eq(long a,
long b)
long value equals to each othera - long ab - long btrue if a == bpublic static boolean eq(double a,
double b)
double value equals to each othera - double ab - double btrue if a == bpublic static boolean ne(Object a, Object b)
a - the first objectb - the second objectfalse if a equals to beq(Object, Object)public static boolean bool(Object v)
| case | bool value |
|---|---|
null | false |
NONE | false |
| String | S.notEmpty(v) |
| Collection | !v.isEmpty() |
| Array | length of the array > 0 |
| Byte | v != 0 |
| Char | v != 0 |
| Integer | v != 0 |
| Long | v != 0L |
| Float | Math.abs(v) > Float.MIN_NORMAL |
| Double | Math.abs(v) > Double.MIN_NORMAL |
| BigInteger | !BigInteger.ZERO.equals(v) |
| BigDecimal | !BigDecimal.ZERO.equals(v) |
| File | v.exists() |
Osgl.Func0 | bool(v.apply()) |
| Other types | true |
v - the value to be evaluatedtrue if v evaluate to true, false otherwisepublic static boolean bool(boolean v)
public static boolean bool(String s)
s - the string to be evaluatedtrue if s is not emptyS.empty(String)public static boolean bool(Collection<?> c)
c - the collection to be evaluatedtrue if the collection is not emptyCollection.isEmpty()public static boolean bool(byte v)
v - the value to be evaluatedtrue if the value != 0public static boolean bool(char v)
v - the value to be evaluatedtrue if the value != 0public static boolean bool(int v)
v - the value to be evaluatedtrue if the value != 0public static boolean bool(long v)
v - the value to be evaluatedtrue if the value != 0public static boolean bool(float v)
v - the value to be evaluatedtrue if Math.abs(v) > Float.MIN_NORMALpublic static boolean bool(double v)
v - the value to be evaluatedtrue if Math.abs(v) > Double.MIN_NORMALpublic static boolean bool(BigDecimal v)
v - the value to be evaluatedtrue if !BigDecimal.ZERO.equals(v)public static boolean bool(BigInteger v)
v - the value to be evaluatedtrue if !BigInteger.ZERO.equals(v)public static boolean bool(File v)
v - the file to be evaluatedtrue if v.exists()public static boolean bool(Osgl.Func0<?> v)
Osgl.Func0 instance. This will call
the Osgl.Func0.apply() method and continue to
do bool evaluation on the return valuev - the function to be evaluatedbool(v.apply())public static boolean not(Object o)
bool(java.lang.Object)o - the object to be evaluated!(bool(o))public static boolean not(boolean v)
v - the value to be evaluated!vpublic static boolean not(String s)
bool(java.lang.String)s - the String to be evaluated!(bool(s))bool(String)public static boolean not(Collection<?> c)
bool(java.util.Collection)c - the Collection to be evaluated!(bool(c))bool(java.util.Collection)public static boolean not(byte v)
bool(byte)v - the byte to be evaluated!(bool(v))public static boolean not(char v)
bool(char)v - the char to be evaluated!(bool(v))public static boolean not(int v)
bool(int)v - the int to be evaluated!(bool(v))public static boolean not(long v)
bool(long)v - the long to be evaluated!(bool(v))public static boolean not(float v)
bool(float)v - the float to be evaluated!(bool(v))public static boolean not(double v)
bool(double)v - the double to be evaluated!(bool(v))public static boolean not(BigDecimal v)
bool(BigDecimal)v - the value to be evaluated!(bool(v))public static boolean not(BigInteger v)
bool(BigInteger)v - the value to be evaluated!(bool(v))public static boolean not(File file)
bool(File)file - the file to be evaluated!(bool(file))public static boolean not(Osgl.Func0<?> f)
bool(Osgl.Func0)f - the function to be evaluated!(bool(f))public static boolean isNull(Object o)
null or NONEo - the object to testtrue if o is null or NONEpublic static boolean anyNull(Object o, Object... oa)
o - the first object to be checkedoa - the array of objects to be checkedtrue if any one of the argument is nullpublic static String toString(Object o)
null or Osgl.NONE, then an empty string is returnedo - the object which will be converted into a stringpublic static String fmt(String tmpl, Object... args)
S.fmt(String, Object...)tmpl - the format templateargs - the format argumentspublic static int iterableHashCode(Iterable<?> it)
public static int hc(boolean o)
public static int hc(boolean[] oa)
public static int hc(short o)
public static int hc(short[] oa)
public static int hc(byte o)
public static int hc(byte[] oa)
public static int hc(char o)
public static int hc(char[] oa)
public static int hc(int o)
public static int hc(int[] oa)
public static int hc(float o)
public static int hc(float[] oa)
public static int hc(long o)
public static int hc(long[] oa)
public static int hc(double o)
public static int hc(double[] oa)
oa - the double arraypublic static int hc(Object o)
o - object on which hash code to be calculatedpublic static int hc(Object o1, Object o2)
o1 - object 1o2 - object 2public static int hc(Object o1, Object o2, Object o3)
o1 - object 1o2 - object 2o3 - object 3public static int hc(Object o1, Object o2, Object o3, Object o4)
o1 - object 1o2 - object 2o3 - object 3o4 - object 4public static int hc(Object o1, Object o2, Object o3, Object o4, Object o5)
o1 - object 1o2 - object 2o3 - object 3o4 - object 4o5 - object 5public static int hc(Object o1, Object o2, Object o3, Object o4, Object o5, Object... args)
o1 - object 1o2 - object 2o3 - object 3o4 - object 4o5 - object 5args - other objectspublic static long ms()
current time millispublic static long ns()
current nano timepublic static long ts()
ns()public static void nil()
public static <T extends Enum<T>> T asEnum(Class<T> enumClass, String name)
T - the generic enum typeenumClass - the enum classname - the name of the enum value. `name` is case insensitivepublic static <T extends Enum<T>> T asEnum(Class<T> enumClass, String name, boolean caseSensitive)
T - the generic enum typeenumClass - the enum classname - the name of the enum value. `name` is case insensitivecaseSensitive - specify whether it should do case sensitive lookup or case insensitive lookuppublic static <T> int search(T element,
T... elements)
T - the typeelement - the element to be locatedelements - the array of element to be searched-1 if not foundpublic static <T> T ifNullThen(T t1,
T def1)
public static <T> T ensureGet(T t1,
T def1)
public static <T> T ifNullThen(T t1,
Osgl.F0<T> def1)
public static <T> T ensureGet(T t1,
Osgl.F0<T> def1)
public static <T> T ensureGet(T t1,
T def1,
T def2)
public static <T> T ensureGet(T t1,
T def1,
T def2,
T def3)
public static <T> T ensureGet(T t1,
List<T> defs)
public static <T> T times(Osgl.Function<T,T> func, T initVal, int n)
public static <T> Osgl.Meta<T> meta(T t)
public static <T> Osgl.Option<T> cast(Object o, Class<T> c)
Osgl.Option describing the casted value if
it can be casted to the type specified, otherwise returns NONE.T - the type of the result option valueo - the object to be castedc - specify the type to be casted toOption describing the typed value or NONE
if it cannot be castedpublic static <T> T cast(Object o)
public static <T> T notNull(T o)
public static <T,F> T setField(String fieldName, T obj, F val)
T - the type of the objectF - the type of the field valuefieldName - the name of the field to be setobj - the object on which the value will be setval - the value to be set to the fieldpublic static boolean isSimpleType(Class<?> c)
c - the class to be checkedpublic static <T> Class<T> classForName(String className, ClassLoader classLoader)
public static <T> Osgl.Option<Class<T>> safeClassForName(String className)
public static <T> Osgl.Option<Class<T>> safeClassForName(String className, ClassLoader classLoader)
public static <T> T newInstance(String className)
public static <T> T newInstance(String className, ClassLoader cl)
public static <T> Osgl.Option<T> safeNewInstance(String className)
public static <T> T newInstance(Class<T> c)
public static <T,P1> T newInstance(Class<T> c, P1 p1)
public static <T,P1,P2> T newInstance(Class<T> c, P1 p1, P2 p2)
public static <T,P1,P2,P3> T newInstance(Class<T> c, P1 p1, P2 p2, P3 p3)
public static <T,P1,P2,P3,P4> T newInstance(Class<T> c, P1 p1, P2 p2, P3 p3, P4 p4)
public static <T,P1,P2,P3,P4,P5> T newInstance(Class<T> c, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
public static <T> T newInstance(Class<T> c, Object p1, Object p2, Object p3, Object p4, Object p5, Object... pa)
public static Field fieldOf(Class<?> c, String name)
c - the classname - the name of the fieldpublic static Field fieldOf(Class<?> c, String name, boolean noStatic)
c - the classname - the name of the fieldnoStatic - specify if static fields shall be includedpublic static Field fieldOf(Class<?> c, String name, Class<?> rootClass, boolean noStatic)
c - the classname - the name of the fieldrootClass - the class that stops of the recurive operation. Default is Object.classnoStatic - specify if static fields shall be includedpublic static List<Field> fieldsOf(Class<?> c)
AccessibleObject.setAccessible(boolean) with value `true`c - the classpublic static List<Field> fieldsOf(Class<?> c, Osgl.Function<Field,Boolean> filter)
AccessibleObject.setAccessible(boolean) with value `true`c - the classfilter - specify which field will be put into the list if not `null`public static List<Field> fieldsOf(Class<?> c, boolean noStatic)
AccessibleObject.setAccessible(boolean) with value `true`c - the classnoStatic - specify if static fields shall be included. Default: `true`public static List<Field> fieldsOf(Class<?> c, Class<?> rootClass, boolean noStatic)
AccessibleObject.setAccessible(boolean) with value `true`c - the classrootClass - the class that stops the recursive operationnoStatic - specify if static fields should be includedpublic static List<Field> fieldsOf(Class<?> c, Class<?> rootClass, Osgl.Function<Field,Boolean> filter)
AccessibleObject.setAccessible(boolean) with value `true`c - the classrootClass - the class that stops the recursive lookupfilter - specify what field should be put into the list if not `null`public static List<Field> fieldsOf(Class<?> c, Osgl.Function<Class<?>,Boolean> classFilter, Osgl.Function<Field,Boolean> fieldFilter)
public static <T,R> R invokeStatic(Class<T> c, String methodName, Object... pa)
T - the generic type of the classR - the generic type of the return resultc - the classmethodName - the method namepa - the parameterspublic static <T,R> R invokeStatic(Osgl.Var<Method> methodBag, Class<T> c, String methodName, Object... pa)
T - the generic type of classR - the generic type of return instancemethodBag - the method bagc - the classmethodName - the method namepa - the parameterspublic static <R> R invokeStatic(Method method, Object... pa)
R - the generic type of the return resultmethod - the methodpa - the arguments to invoke the methodpublic static <T,R> R invokeVirtual(Osgl.Var<Method> methodBag, T o, String methodName, Object... pa)
T - generic type of the instance objectR - generic type of the return resultmethodBag - A function to cache the method found by name and argumentso - the instance on which the virtual method will be invokedmethodName - the method namepa - the argumentspublic static <T,R> R invokeVirtual(T o,
String methodName,
Object... pa)
T - generic type of the instance objectR - generic type of the return resulto - the instance on which the virtual method will be invokedmethodName - the method namepa - the argumentspublic static <T,R> R invokeVirtual(T o,
Method method,
Object... pa)
method. This method will convert all checked exception
to corresponding runtime exceptionT - generic type of the instanceR - generic type of the resulto - the instance on which the method will be invokedmethod - the methodpa - the argumentspublic static Method getMethod(Class c, String methodName, Object... pa)
Method by name and parameter valuec - the classmethodName - the method namepa - the parameter used to invoke the methodpublic static Method getMethod(Class c, String methodName, Class... argTypes)
Method by name and argument typec - the classmethodName - the method nameargTypes - the argument typespublic static <T> T getProperty(CacheService cache, Object entity, String property)
public static void setProperty(CacheService cache, Object entity, Object val, String property)
public static <T> byte[] serialize(T obj)
public static <T> T materialize(byte[] ba,
Class<T> c)
public static <T> T deserialize(byte[] ba,
Class<T> c)
public static <T> T materialize(byte[] ba)
public static <T> T deserialize(byte[] ba)
public static <T> T[] newArray(T[] model)
T - the array component typemodel - the model arraypublic static <T> T[] newArray(T[] model,
int size)
T - the component typemodel - the model arraysize - the new array lengthpublic static int[] newArray(int[] model)
public static int[] newArray(int[] model,
int size)
public static byte[] newArray(byte[] model)
public static byte[] newArray(byte[] model,
int size)
public static char[] newArray(char[] model)
public static char[] newArray(char[] model,
int size)
public static short[] newArray(short[] model)
public static short[] newArray(short[] model,
int size)
public static long[] newArray(long[] model)
public static long[] newArray(long[] model,
int size)
public static float[] newArray(float[] model)
public static float[] newArray(float[] model,
int size)
public static double[] newArray(double[] model)
public static double[] newArray(double[] model,
int size)
public static boolean[] newArray(boolean[] model)
public static boolean[] newArray(boolean[] model,
int size)
public static <T> T[] concat(T[] a,
T t)
public static <T> T[] concat(T[] a1,
T[] a2)
public static <T> T[] concat(T[] a1,
T[] a2,
T[]... rest)
public static int[] concat(int[] a1,
int[] a2)
public static int[] concat(int[] a1,
int[] a2,
int[]... rest)
public static boolean[] concat(boolean[] a1,
boolean[] a2)
public static boolean[] concat(boolean[] a1,
boolean[] a2,
boolean[]... rest)
public static byte[] concat(byte[] a1,
byte[] a2)
public static byte[] concat(byte[] a1,
byte[] a2,
byte[]... rest)
public static short[] concat(short[] a1,
short[] a2)
public static short[] concat(short[] a1,
short[] a2,
short[]... rest)
public static char[] concat(char[] a1,
char[] a2)
public static char[] concat(char[] a1,
char[] a2,
char[]... rest)
public static long[] concat(long[] a1,
long[] a2)
public static long[] concat(long[] a1,
long[] a2,
long[]... rest)
public static float[] concat(float[] a1,
float[] a2)
public static float[] concat(float[] a1,
float[] a2,
float[]... rest)
public static double[] concat(double[] a1,
double[] a2)
public static double[] concat(double[] a1,
double[] a2,
double[]... rest)
public static void fill(boolean element,
boolean[] array)
public static void fill(byte element,
byte[] array)
public static void fill(char element,
char[] array)
public static void fill(short element,
short[] array)
public static void fill(int element,
int[] array)
public static void fill(float element,
float[] array)
public static void fill(long element,
long[] array)
public static void fill(double element,
double[] array)
public static <T> void fill(T element,
T[] array)
public static boolean[] reverse(boolean[] a)
public static byte[] reverse(byte[] a)
public static char[] reverse(char[] a)
public static short[] reverse(short[] a)
public static int[] reverse(int[] a)
public static float[] reverse(float[] a)
public static long[] reverse(long[] a)
public static double[] reverse(double[] a)
public static boolean[] asPrimitive(Boolean[] oa)
public static Boolean[] asObject(boolean[] pa)
public static byte[] asPrimitive(Byte[] oa)
public static Byte[] asObject(byte[] pa)
public static char[] asPrimitive(Character[] oa)
public static Character[] asObject(char[] pa)
public static short[] asPrimitive(Short[] oa)
public static Short[] asObject(short[] pa)
public static int[] asPrimitive(Integer[] oa)
public static Integer[] asObject(int[] pa)
public static long[] asPrimitive(Long[] oa)
public static Long[] asObject(long[] pa)
public static float[] asPrimitive(Float[] oa)
public static Float[] asObject(float[] pa)
public static double[] asPrimitive(Double[] oa)
public static Double[] asObject(double[] pa)
public static <T> T random(T t1,
T... ta)
public static <T> T random(T[] ta)
public static <T> T random(List<T> list)
public static <T> T random(C.Range<T> range)
public static String randomStr()
public static String randomStr(int len)
public static <T> T NPE(T o)
public static <T> Future<T> async(Osgl.F0<T> callback, int milliseconds)
T - return typecallback - the callback function to be executedmilliseconds - the delaypublic static <T> ContextLocal<T> contextLocal()
public static <T> ContextLocal<T> contextLocal(ContextLocal.InitialValueProvider<T> ivp)
public static Map<String,Object> evaluate(Annotation anno)
anno - the annotation instanceCopyright © 2017. All Rights Reserved.