Package com.googlecode.objectify.impl
Class TypeUtils
java.lang.Object
com.googlecode.objectify.impl.TypeUtils
public class TypeUtils extends Object
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
Checked exceptions are LAME.static <A extends Annotation>
AgetAnnotation(Annotation[] annotations, Class<A> annotationType)
Gets the annotation that has the specified type, or null if there isn't onestatic MethodHandle
getConstructor(Class<?> clazz, Class<?>... args)
Gets a constructor that has the specified types of arguments.static <A extends Annotation>
AgetDeclaredAnnotation(Class<?> onClass, Class<A> annotationType)
Get the declared annotation, ignoring any inherited annotationsstatic <T> Constructor<T>
getNoArgConstructor(Class<T> clazz)
Throw an IllegalStateException if the class does not have a no-arg constructor.static <T> T
invoke(MethodHandle methodHandle, Object... params)
Wraps any non-runtime exceptions with a runtime exceptionstatic boolean
isAssignableFrom(Class<?> to, Class<?> from)
Just like Class.isAssignableFrom(), but does the right thing when considering autoboxing.static <A extends Annotation>
booleanisDeclaredAnnotationPresent(Class<?> onClass, Class<A> annotationType)
Is the declared annotation present, ignoring any inherited annotationsstatic <T> T
newInstance(Constructor<T> ctor, Object... params)
Checked exceptions are LAME.
-
Method Details
-
getNoArgConstructor
Throw an IllegalStateException if the class does not have a no-arg constructor. -
getConstructor
Gets a constructor that has the specified types of arguments. Throw an IllegalStateException if the class does not have such a constructor. -
invoke
Wraps any non-runtime exceptions with a runtime exception -
newInstance
Checked exceptions are LAME. -
field_get
Checked exceptions are LAME. -
isAssignableFrom
Just like Class.isAssignableFrom(), but does the right thing when considering autoboxing. -
getAnnotation
public static <A extends Annotation> A getAnnotation(Annotation[] annotations, Class<A> annotationType)Gets the annotation that has the specified type, or null if there isn't one -
getDeclaredAnnotation
public static <A extends Annotation> A getDeclaredAnnotation(Class<?> onClass, Class<A> annotationType)Get the declared annotation, ignoring any inherited annotations -
isDeclaredAnnotationPresent
public static <A extends Annotation> boolean isDeclaredAnnotationPresent(Class<?> onClass, Class<A> annotationType)Is the declared annotation present, ignoring any inherited annotations
-