java.lang.Object
com.blamejared.crafttweaker.annotation.processor.util.Util

public class Util extends Object
  • Constructor Details

    • Util

      public Util()
  • Method Details

    • deepMerge

      public static com.google.gson.JsonObject deepMerge(com.google.gson.JsonObject source, com.google.gson.JsonObject target)
      Merge "source" into "target". If fields have equal name, merge them recursively. Null values in source will remove the field from the target. Override target values with source values Keys not supplied in source will remain unchanged in target
      Returns:
      the merged object (target).
    • sortObjectsFirst

      public static com.google.gson.JsonElement sortObjectsFirst(com.google.gson.JsonElement element)
    • sort

      public static com.google.gson.JsonElement sort(com.google.gson.JsonElement element)
    • make

      public static <T> T make(Supplier<T> supplier)
    • make

      public static <T> T make(T instance, Consumer<T> consumer)
    • quoteAndEscape

      public static String quoteAndEscape(String str)
      Quotes the given String in double quotes ( ") and escapes any control character.
      Parameters:
      str - String to quote and escape.
      Returns:
      a new String with the String quoted and escaped.
    • wrap

      public static String wrap(String str, String with, boolean escape)
      Wraps the given String in another String and also optionally escapes control characters in the String.
      Parameters:
      str - String to wrap
      with - String to wrap with
      escape - Should control characters be escaped
      Returns:
      a new String that is wrapped with the given String and optionally escaped.
    • uncheck

      public static <T> T uncheck(Object o)
    • notNull

      public static <P, R> Function<P,R> notNull(Function<P,R> func)
    • cacheLatest

      public static <P, R> Function<P,R> cacheLatest(Function<P,R> func)
    • enumLookup

      public static <T extends Enum<T> & Keyable> Function<String,T> enumLookup(T[] values)
    • isSubTypeOrGeneric

      public static boolean isSubTypeOrGeneric(TypeMirror first, TypeMirror second)
    • isMethodSame

      public static boolean isMethodSame(Element firstElem, Element secondElem)
    • getOrigin

      public static MemberOrigin getOrigin(Element element, ExecutableElement method, MemberOrigin defaultOrigin)
    • getOrigin

      public static MemberOrigin getOrigin(Element element, VariableElement field, MemberOrigin defaultOrigin)
    • isExposedField

      public static boolean isExposedField(Element element)
    • isExposedMethod

      public static boolean isExposedMethod(Element element)
    • optionalIf

      public static <T> Optional<T> optionalIf(T thing, Predicate<T> predicate)
    • isEvent

      public static boolean isEvent(TypeElement typeElement)
    • getAnnotationsOfType

      public static List<AnnotationMirror> getAnnotationsOfType(TypeElement element, Class<?> annotationClass, Class<?> repeatableHolder)
    • getPackageName

      public static Optional<String> getPackageName(DeclaredType type)
    • getSimpleName

      public static Optional<String> getSimpleName(DeclaredType type)
    • getPackageName

      public static Optional<String> getPackageName(TypeMirror mirror)
    • getSimpleName

      public static Optional<String> getSimpleName(TypeMirror mirror)