类 BasicService
java.lang.Object
pkg.exoad.poprock.core.BasicService
Basic Service - Some very rudementary functions that can be used for some Java related
stuffs:
- Reflection helper functions
- Basic Null Safety
- Object equality
- 作者:
- Jack Meng
-
字段概要
-
构造器概要
-
方法概要
修饰符和类型方法说明static boolean
anyPairedNulls
(Pair<?, ?>[] v) Checks if any values in a Pair are nulled values.static int
clampBounds
(int i) static boolean
containsClass
(Collection<Class<?>> classes, Class<?> clazz) A very naive implementation to determine if a list of classes contain the provided class by just checking their canonical names.static Consumer<?>
Supplies an empty consumer that does nothing when supplied anything.static Runnable
Supplies an empty runnable that does nothing when called.static boolean
isWrapperClass
(Class<?> e) static void
requireAllNonNull
(Object... objects) Similar toObjects.requireNonNull(Object)
, but instead we are going to check for a vararg amount of Objects.static boolean
strContains
(String str, CharSequence... chars) A macro call forString.contains(CharSequence)
where you might want check against multiple sequences.
-
字段详细资料
-
PRIMS_CLASS
-
-
构造器详细资料
-
BasicService
private BasicService()
-
-
方法详细资料
-
containsClass
A very naive implementation to determine if a list of classes contain the provided class by just checking their canonical names. VERY NAIVE AND SHOULD NOT BE USED FOR MOST CASES. However, I have to say this is the most easy way to do it :)- 参数:
classes
- The classes to search inclazz
- The class to search for- 返回:
- true or false if the desired class was found or not respectively
-
clampBounds
public static int clampBounds(int i) -
strContains
A macro call forString.contains(CharSequence)
where you might want check against multiple sequences.- 参数:
str
- The target string to search inchars
- The supplied sequences to search against- 返回:
- true or false if any of the target sequences were found
-
anyPairedNulls
Checks if any values in a Pair are nulled values. Please note that this function does not do additional checks after justPair.first()
orPair.second()
for nullability!- 参数:
v
- An array of Pairs to check- 返回:
- true or false whether the supplied Pair contains any nulls
-
requireAllNonNull
Similar toObjects.requireNonNull(Object)
, but instead we are going to check for a vararg amount of Objects. It is primarily useful for dealing with parameter validation:public Foo(A a,B b,C c) { requireAllNonNull(a,b,c); }
- 参数:
objects
- Varargs of Objects (List<?>)
-
emptyRunnable
Supplies an empty runnable that does nothing when called. Very useful for placeholders and when you don't want to pass anull
that could lead to aNullPointerException
- 返回:
- The Empty, do-nothing runnable
-
emptyConsumer
Supplies an empty consumer that does nothing when supplied anything. Very useful for placeholders and when you don't want to pass anull
.- 返回:
- The empty, do-nothing consumer
- 另请参阅:
-
isWrapperClass
-