类 BasicService

java.lang.Object
pkg.exoad.poprock.core.BasicService

@ServiceClass(requiresArming=false) public final class BasicService extends Object
Basic Service - Some very rudementary functions that can be used for some Java related stuffs:
  • Reflection helper functions
  • Basic Null Safety
  • Object equality
and more...
作者:
Jack Meng
  • 字段详细资料

  • 构造器详细资料

    • BasicService

      private BasicService()
  • 方法详细资料

    • containsClass

      public 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. 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 in
      clazz - 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

      public static boolean strContains(String str, CharSequence... chars)
      A macro call for String.contains(CharSequence) where you might want check against multiple sequences.
      参数:
      str - The target string to search in
      chars - The supplied sequences to search against
      返回:
      true or false if any of the target sequences were found
    • anyPairedNulls

      public static boolean anyPairedNulls(Pair<?,?>[] v)
      Checks if any values in a Pair are nulled values. Please note that this function does not do additional checks after just Pair.first() or Pair.second() for nullability!
      参数:
      v - An array of Pairs to check
      返回:
      true or false whether the supplied Pair contains any nulls
    • requireAllNonNull

      public static void requireAllNonNull(Object... objects)
      Similar to Objects.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

      public static Runnable emptyRunnable()
      Supplies an empty runnable that does nothing when called. Very useful for placeholders and when you don't want to pass a null that could lead to a NullPointerException
      返回:
      The Empty, do-nothing runnable
    • emptyConsumer

      public static Consumer<?> emptyConsumer()
      Supplies an empty consumer that does nothing when supplied anything. Very useful for placeholders and when you don't want to pass a null.
      返回:
      The empty, do-nothing consumer
      另请参阅:
    • isWrapperClass

      public static boolean isWrapperClass(Class<?> e)