Back to project page morpheus.
The source code is released under:
Apache License
If you think the Android project morpheus listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.github.stephanenicolas.morpheus.commons; /*from w w w. j a v a2s.c om*/ import java.lang.annotation.Annotation; import java.lang.reflect.Method; import javassist.CtField; import javassist.NotFoundException; public final class NullableUtils { private NullableUtils() { } public static boolean isNotNullable(CtField field) { return !isNullable(field); } public static boolean isNullable(CtField field) { try { for (Object annotation : field.getAnnotations()) { Class annotationClass = Annotation.class; //workaround for robolectric //https://github.com/robolectric/robolectric/pull/1240 Method method = annotationClass.getMethod("annotationType"); Class type = (Class) method.invoke(annotation); if ("Nullable".equals(type.getSimpleName())) return true; } } catch (Exception e) { throw new RuntimeException(e); } return false; } }