Exemple #1
0
 public File generateAnnotationCode(File dir, JavaNameResolver resolver) throws Exception {
   File source = createSourceFile(dir, resolver);
   JavaMessageBuilder builder = new JavaMessageBuilder(source, resolver);
   annotationHeader(builder);
   builder.close();
   return source;
 }
Exemple #2
0
 private void annotationHeader(JavaMessageBuilder builder) throws ObjectStoreConfigException {
   String pkg = builder.getPackageName(this.getURI());
   String simple = builder.getSimpleName(this.getURI());
   if (pkg == null) {
     builder.imports(simple);
   } else {
     builder.pkg(pkg);
     builder.imports(pkg + '.' + simple);
   }
   builder.comment(this);
   if (this.isA(OWL.DEPRECATEDPROPERTY)) {
     builder.annotate(Deprecated.class);
   }
   builder.annotateEnum(Retention.class, RetentionPolicy.class, "RUNTIME");
   builder.annotateEnums(
       Target.class,
       ElementType.class,
       "TYPE",
       "METHOD",
       "PARAMETER",
       "ANNOTATION_TYPE",
       "PACKAGE");
   builder.annotationName(simple);
   builder.annotationProperties(this);
   builder.annotateURI(Iri.class, builder.getType(this.getURI()));
   if (this.isA(OWL.FUNCTIONALPROPERTY)) {
     builder.method("value", true).returnType(builder.imports(String.class)).end();
   } else {
     builder.method("value", true).returnType(builder.imports(String.class) + "[]").end();
   }
 }