/** * Returns a either a dynamic proxy instance that allows an element to be treated as an annotation * (for JOT), or a Java annotation (for Reflection), or null if the specified annotation does not * exist. Intended to be used in conjunction with isAnnotationPresent. * * @param element * @param annotationClass * @return * @see #isAnnotationPresent */ public Annotation getAnnotation(JavaHasAnnotations element, Class annotationClass) { JavaAnnotation janno = element.getAnnotation(jModel.getClass(annotationClass)); if (janno == null) { return null; } return jModel.getAnnotation(janno, annotationClass); }
public XJCJavaModelInputImpl(Class<?>[] classes, JavaModel javaModel) { this.jModel = javaModel; this.jClasses = new JavaClass[classes.length]; for (int i = 0; i < classes.length; i++) { jClasses[i] = jModel.getClass(classes[i]); } }
/** * Returns a JavaClass instance wrapping the provided field's resolved type. * * @param field * @return */ public JavaClass getType(JavaField field) { JavaClass type = (JavaClass) field.getResolvedType(); try { return jModel.getClass(type.getRawName()); } catch (Exception x) { } return null; }
public XJCJavaModelInputImpl(TypeMappingInfo[] types, JavaModel javaModel) { this.jModel = javaModel; this.jClasses = new JavaClass[types.length]; for (int i = 0; i < types.length; i++) { TypeMappingInfo typeMappingInfo = types[i]; Type type = typeMappingInfo.getType(); jClasses[i] = jModel.getClass((Class<?>) type); } }
/** * Indicates if element contains a given annotation. * * @param element * @param annotationClass * @return */ public boolean isAnnotationPresent(JavaHasAnnotations element, Class annotationClass) { if (element == null || annotationClass == null) { return false; } return (element.getAnnotation(jModel.getClass(annotationClass)) != null); }
/** * Return a JavaClass instance created based on fully qualified class name. This assumes that a * class with the provided name exists on the classpath - null is returned otherwise. * * @param javaClassName * @return */ public JavaClass getJavaClass(String javaClassName) { return jModel.getClass(javaClassName); }
/** * Return a JavaClass instance created based the provided class. This assumes that the provided * class exists on the classpath - null is returned otherwise. * * @param javaClass * @return */ public JavaClass getJavaClass(Class javaClass) { return jModel.getClass(javaClass); }