Esempio 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]);
   }
 }
Esempio 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);
   }
 }
Esempio n. 5
0
 /**
  * INTERNAL: This is the preferred constructor.
  *
  * <p>This constructor builds the map of XML-Java type pairs, and sets the JavaModel and
  * ClassLoader.
  *
  * @param model
  */
 public Helper(JavaModel model) {
   xmlToJavaTypeMap = buildXMLToJavaTypeMap();
   setJavaModel(model);
   setClassLoader(model.getClassLoader());
   COLLECTION_CLASS = getJavaClass(CoreClassConstants.Collection_Class);
   LIST_CLASS = getJavaClass(CoreClassConstants.List_Class);
   SET_CLASS = getJavaClass(CoreClassConstants.Set_Class);
   MAP_CLASS = getJavaClass(CoreClassConstants.Map_Class);
   JAXBELEMENT_CLASS = getJavaClass(JAXBElement.class);
   OBJECT_CLASS = getJavaClass(CoreClassConstants.OBJECT);
 }
Esempio n. 6
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);
 }
Esempio n. 7
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);
 }
Esempio n. 8
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);
 }