private File createTargetDir() { String s = env.getOptions().get("-s"); File targetDir = new File(s); if (!targetDir.exists()) { targetDir.mkdirs(); } return targetDir; } }
private File createTargetDir() { String s = env.getOptions().get( "-s" ); File targetDir = new File( s ); if ( !targetDir.exists() ) { targetDir.mkdirs(); } return targetDir; } }
/** * Whether processing should be verbose. * * @return Whether processing should be verbose. */ protected boolean isVerbose() { return getAnnotationProcessorEnvironment().getOptions().containsKey(EnunciateAnnotationProcessorFactory.VERBOSE_OPTION); }
public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> decls, AnnotationProcessorEnvironment env) { 26 String page = null; 27 File output = new File("extension-points.wiki"); 28 for( String k : env.getOptions().keySet() ) { 29 if(k.startsWith("-Apage=")) 30 page = k.substring("-Apage=".length()); 31 if(k.startsWith("-Atarget=")) 32 output = new File(k.substring("-Atarget=".length())); 33 } 34 return new ExtensionPointLister(env,page, output); 35 } 36} <configuration> <force>true</force> <!-- disable staleness check --> <factory>org.jvnet.hudson.tools.ExtensionPointListerFactory</factory> <options> <option>page=Extension points</option> <option>target=${project.basedir}/target/extension-points.wiki</option> </options> </configuration>
/** * Whether processing should be verbose. * * @return Whether processing should be verbose. */ protected boolean isVerbose() { return getAnnotationProcessorEnvironment().getOptions().containsKey(EnunciateAnnotationProcessorFactory.VERBOSE_OPTION); }
public DecoratedAnnotationProcessorEnvironment(AnnotationProcessorEnvironment delegate) { this.delegate = delegate; this.options = parseOptions(delegate.getOptions()); }
/** * Default implementation ensures only one APT round does any work and establishes the context before instantiating the processor. * * @param set The relevant annotation types. * @param env The environment. * @return The processor. */ public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> set, AnnotationProcessorEnvironment env) { if (++round > 1) { //we only process one round... //todo: think of some way to process more than one round? return AnnotationProcessors.NO_OP; } AnnotationProcessorEnvironment ape = decorateEnvironment(env); if (ape.getOptions().containsKey(DECLARATION_DECORATOR_OPTION)) { System.setProperty(DeclarationDecorator.class.getName(), ape.getOptions().get(DECLARATION_DECORATOR_OPTION)); } if (ape.getOptions().containsKey(TYPE_DECORATOR_OPTION)) { System.setProperty(TypeMirrorDecorator.class.getName(), ape.getOptions().get(TYPE_DECORATOR_OPTION)); } Context.setCurrentEnvironment(ape); return getProcessorFor(set); }
/** * The collection of variables to establish in the model before processing. * * @return The collection of variables to establish in the model before processing. */ protected Collection<FreemarkerVariable> getVariables() { Collection<FreemarkerVariable> variables = new ArrayList<FreemarkerVariable>(); Map<String, String> options = Context.getCurrentEnvironment().getOptions(); String namespace = options.get(FreemarkerProcessorFactory.FM_LIBRARY_NS_OPTION); variables.add(new FreemarkerVariable(namespace, "aptOptions", options)); return variables; }
AnnotationParser(Set<AnnotationTypeDeclaration> atds, AnnotationProcessorEnvironment env) { this.env = env; errorListener = new ErrorReceiverImpl(env.getMessager(),env.getOptions().containsKey(Const.DEBUG_OPTION)); }
AnnotationParser(Set<AnnotationTypeDeclaration> atds, AnnotationProcessorEnvironment env) { this.env = env; errorListener = new ErrorReceiverImpl(env.getMessager(),env.getOptions().containsKey(Const.DEBUG_OPTION)); }
Map<String, String> options = env.getOptions(); String fileOption = options.get(TEMPLATE_FILE_OPTION); URL url = this.template;
@Override public Collection<FreemarkerTransform> getTransforms() { String namespace = Context.getCurrentEnvironment().getOptions().get(EnunciateAnnotationProcessorFactory.FM_LIBRARY_NS_OPTION); Collection<FreemarkerTransform> transforms = super.getTransforms(); //jaxws transforms. transforms.add(new ForEachBindingTypeTransform(namespace)); transforms.add(new ForEachEndpointInterfaceTransform(namespace)); transforms.add(new ForEachThrownWebFaultTransform(namespace)); transforms.add(new ForEachWebFaultTransform(namespace)); transforms.add(new ForEachWebMessageTransform(namespace)); transforms.add(new ForEachWebMethodTransform(namespace)); transforms.add(new ForEachWsdlTransform(namespace)); //jaxb transforms. transforms.add(new ForEachSchemaTransform(namespace)); //rest transforms. transforms.add(new ForEachRESTEndpointTransform(namespace)); transforms.add(new ForEachRESTNounTransform(namespace)); //set up the enunciate file transform. EnunciateFileTransform fileTransform = new EnunciateFileTransform(namespace); transforms.add(fileTransform); return transforms; }
/** * The collection of transforms to establish in the model before processing. * * @return The collection of transforms to establish in the model before processing. */ protected Collection<FreemarkerTransform> getTransforms() { String namespace = Context.getCurrentEnvironment().getOptions().get(FreemarkerProcessorFactory.FM_LIBRARY_NS_OPTION); Collection<FreemarkerTransform> transforms = new ArrayList<FreemarkerTransform>(); transforms.add(new AnnotationValueTransform(namespace)); transforms.add(new FileTransform(namespace)); transforms.add(new ForAllConstructorsTransform(namespace)); transforms.add(new ForAllFieldsTransform(namespace)); transforms.add(new ForAllImportedTypesTransform(namespace)); transforms.add(new ForAllMethodsTransform(namespace)); transforms.add(new ForAllNestedTypesTransform(namespace)); transforms.add(new ForAllPackagesTransform(namespace)); transforms.add(new ForAllParametersTransform(namespace)); transforms.add(new ForAllPropertiesTransform(namespace)); transforms.add(new ForAllThrownTypesTransform(namespace)); transforms.add(new ForAllTypesTransform(namespace)); transforms.add(new IfHasAnnotationTransform(namespace)); transforms.add(new IfHasDeclarationTransform(namespace)); transforms.add(new JavaSourceTransform(namespace)); transforms.add(new PrimitiveWrapperTransform(namespace)); transforms.add(new WrapIfPrimitiveTransform(namespace)); transforms.add(new UnwrapIfPrimitiveTransform(namespace)); return transforms; }
@Override public Collection<FreemarkerTransform> getTransforms() { String namespace = Context.getCurrentEnvironment().getOptions().get(EnunciateAnnotationProcessorFactory.FM_LIBRARY_NS_OPTION); Collection<FreemarkerTransform> transforms = super.getTransforms(); //common transforms. transforms.add(new ForEachServiceEndpointTransform(namespace)); //jaxws transforms. transforms.add(new ForEachBindingTypeTransform(namespace)); transforms.add(new ForEachEndpointInterfaceTransform(namespace)); transforms.add(new ForEachThrownWebFaultTransform(namespace)); transforms.add(new ForEachWebFaultTransform(namespace)); transforms.add(new ForEachWebMessageTransform(namespace)); transforms.add(new ForEachWebMethodTransform(namespace)); transforms.add(new ForEachWsdlTransform(namespace)); //schema/data transforms. transforms.add(new ForEachSchemaTransform(namespace)); transforms.add(new ForEachJsonSchemaTransform(namespace)); transforms.add(new ForAllAccessorsTransform(namespace)); //rest transforms. transforms.add(new ForEachResourceMethodListByPathTransform(namespace)); //set up the enunciate file transform. EnunciateFileTransform fileTransform = new EnunciateFileTransform(namespace); transforms.add(fileTransform); return transforms; }
public void process() { for( Map.Entry<String,String> me : env.getOptions().entrySet() ) { String key = me.getKey(); if (key.startsWith(Const.CONFIG_FILE_OPTION+'=')) {
public void process() { for( Map.Entry<String,String> me : env.getOptions().entrySet() ) { String key = me.getKey(); if (key.startsWith(Const.CONFIG_FILE_OPTION+'=')) {