Ejemplo n.º 1
0
 /**
  * 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]);
   }
 }
Ejemplo n.º 3
0
 /**
  * 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);
   }
 }
Ejemplo n.º 5
0
 /**
  * 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);
 }
Ejemplo n.º 6
0
 /**
  * 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);
 }
Ejemplo n.º 7
0
 /**
  * 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);
 }