Class Util
java.lang.Object
com.blamejared.crafttweaker.annotation.processor.util.Util
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <P,R> Function<P, R> cacheLatest(Function<P, R> func) static com.google.gson.JsonObjectdeepMerge(com.google.gson.JsonObject source, com.google.gson.JsonObject target) Merge "source" into "target".enumLookup(T[] values) static List<AnnotationMirror>getAnnotationsOfType(TypeElement element, Class<?> annotationClass, Class<?> repeatableHolder) static MemberOrigingetOrigin(Element element, ExecutableElement method, MemberOrigin defaultOrigin) static MemberOrigingetOrigin(Element element, VariableElement field, MemberOrigin defaultOrigin) getPackageName(DeclaredType type) getPackageName(TypeMirror mirror) getSimpleName(DeclaredType type) getSimpleName(TypeMirror mirror) static booleanisEvent(TypeElement typeElement) static booleanisExposedField(Element element) static booleanisExposedMethod(Element element) static booleanisMethodSame(Element firstElem, Element secondElem) static booleanisSubTypeOrGeneric(TypeMirror first, TypeMirror second) static <T> Tstatic <T> Tstatic <P,R> Function<P, R> static <T> Optional<T>optionalIf(T thing, Predicate<T> predicate) static StringquoteAndEscape(String str) Quotes the given String in double quotes (") and escapes any control character.static com.google.gson.JsonElementsort(com.google.gson.JsonElement element) static com.google.gson.JsonElementsortObjectsFirst(com.google.gson.JsonElement element) static <T> Tstatic StringWraps the given String in another String and also optionally escapes control characters in the String.
-
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
-
make
-
quoteAndEscape
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
Wraps the given String in another String and also optionally escapes control characters in the String.- Parameters:
str- String to wrapwith- String to wrap withescape- Should control characters be escaped- Returns:
- a new String that is wrapped with the given String and optionally escaped.
-
uncheck
-
notNull
-
cacheLatest
-
enumLookup
-
isSubTypeOrGeneric
-
isMethodSame
-
getOrigin
public static MemberOrigin getOrigin(Element element, ExecutableElement method, MemberOrigin defaultOrigin) -
getOrigin
public static MemberOrigin getOrigin(Element element, VariableElement field, MemberOrigin defaultOrigin) -
isExposedField
-
isExposedMethod
-
optionalIf
-
isEvent
-
getAnnotationsOfType
public static List<AnnotationMirror> getAnnotationsOfType(TypeElement element, Class<?> annotationClass, Class<?> repeatableHolder) -
getPackageName
-
getSimpleName
-
getPackageName
-
getSimpleName
-