Java 类org.jsonschema2pojo.Annotator 实例源码

项目:GitHub    文件:Jsonschema2PojoMojo.java   
@Override
@SuppressWarnings("unchecked")
public Class<? extends Annotator> getCustomAnnotator() {
    if (isNotBlank(customAnnotator)) {
        try {
            return (Class<? extends Annotator>) Class.forName(customAnnotator);
        } catch (ClassNotFoundException e) {
            throw new IllegalArgumentException(e);
        }
    } else {
        return NoopAnnotator.class;
    }
}
项目:GitHub    文件:Jsonschema2PojoTask.java   
/**
 * Sets the 'customAnnotator' property of this class
 *
 * @param customAnnotator
 *            A custom annotator to use to annotate the generated types
 */
@SuppressWarnings("unchecked")
public void setCustomAnnotator(String customAnnotator) {
    if (isNotBlank(customAnnotator)) {
        try {
            this.customAnnotator = (Class<? extends Annotator>) Class.forName(customAnnotator);
        } catch (ClassNotFoundException e) {
            throw new IllegalArgumentException(e);
        }
    } else {
        this.customAnnotator = NoopAnnotator.class;
    }
}
项目:GitHub    文件:ClassConverterTest.java   
@Test
@SuppressWarnings("unchecked")
public void classIsCreatedFromFullyQualifiedClassName() {
    Class<Annotator> clazz = converter.convert(Annotator.class.getName());

    assertThat(clazz, is(equalTo(Annotator.class)));
}
项目:aml    文件:Context.java   
/**
 *
 * @param config
 * @return
 */
private static Annotator getAnnotator(GenerationConfig config) {
    Annotator coreAnnotator = new AnnotatorFactory().getAnnotator(config.getAnnotationStyle());
    if(config.getCustomAnnotator() != null){
        Annotator customAnnotator = new AnnotatorFactory().getAnnotator(config.getCustomAnnotator());
        return new CompositeAnnotator(coreAnnotator, customAnnotator);
    }
    return coreAnnotator;
}
项目:aml    文件:Context.java   
/**
 *
 * @param config
 * @return
 */
private static Annotator getAnnotator(GenerationConfig config) {
    Annotator coreAnnotator = new AnnotatorFactory().getAnnotator(config.getAnnotationStyle());
    if(config.getCustomAnnotator() != null){
        Annotator customAnnotator = new AnnotatorFactory().getAnnotator(config.getCustomAnnotator());
        return new CompositeAnnotator(coreAnnotator, customAnnotator);
    }
    return coreAnnotator;
}
项目:aml    文件:JavaWriter.java   
private Annotator getAnnotator() {
    ArrayList<Annotator> annotators = new ArrayList<>();
    if (config.isGsonSupport()) {
        annotators.add(new GsonAnnotator());
    }
    if (config.isJacksonSupport()) {
        annotators.add(new Jackson2Annotator());
    }
    CompositeAnnotator ac = new CompositeAnnotator(annotators.toArray(new Annotator[annotators.size()]));
    return ac;
}
项目:springmvc-raml-plugin    文件:SpringMvcEndpointGeneratorMojo.java   
private void generateModelSources(JCodeModel codeModel, ApiBodyMetadata body, File rootDir, GenerationConfig config, Annotator annotator) {
    boolean build = false;
    if (codeModel == null) {
        this.getLog().info("Generating Model object for: " + body.getName());
        build = true;
        if (config == null && annotator == null) {
            codeModel = body.getCodeModel();
        } else {
            codeModel = body.getCodeModel(resolvedSchemaLocation, basePackage + NamingHelper.getDefaultModelPackage(), config, annotator);
        }
    }
    if (build && codeModel != null) {
        buildCodeModelToDisk(codeModel, body.getName(), rootDir);
    }
}
项目:GitHub    文件:Jsonschema2PojoTask.java   
@Override
public Class<? extends Annotator> getCustomAnnotator() {
    return customAnnotator;
}
项目:GitHub    文件:Arguments.java   
@Override
public Class<? extends Annotator> getCustomAnnotator() {
    return customAnnotator;
}
项目:APX    文件:APXCustomRuleFactory.java   
public APXCustomRuleFactory(GenerationConfig generationConfig, Annotator annotator, SchemaStore schemaStore) {
    super(generationConfig, annotator, schemaStore);
}
项目:raml-maven-plugin    文件:AbstractSpringWebMojo.java   
private static Annotator requireAnnotator(AnnotationStyle annotationStyle) {
    checkState(ANNOTATOR_SUPPLIER_INDEX.containsKey(annotationStyle), "Illegal annotation style: %s", annotationStyle);
    return ANNOTATOR_SUPPLIER_INDEX.get(annotationStyle).get();
}
项目:GitHub    文件:RuleFactory.java   
/**
 * Create a new rule factory with the given generation config options.
 *
 * @param generationConfig
 *            The generation config options for type generation. These
 *            config options will influence the java code generated by rules
 *            created by this factory.
 * @param annotator
 *            the annotator used to mark up Java types with any annotations
 *            that are required to build JSON compatible types
 * @param schemaStore
 *            the object used by this factory to get and store schemas
 */
public RuleFactory(GenerationConfig generationConfig, Annotator annotator, SchemaStore schemaStore) {
    this.generationConfig = generationConfig;
    this.annotator = annotator;
    this.schemaStore = schemaStore;
    this.nameHelper = new NameHelper(generationConfig);
}
项目:springmvc-raml-plugin    文件:ApiBodyMetadata.java   
/**
 * Builds a JCodeModel for this body
 *
 * @param basePackage The package we will be using for the domain objects
 * @param schemaLocation The location of this schema, will be used to create absolute URIs for $ref tags eg "classpath:/"
 * @param config JsonSchema2Pojo configuration. if null a default config will be used
 * @param annotator JsonSchema2Pojo annotator. if null a default annotator will be used
 * @return built JCodeModel
 */
public JCodeModel getCodeModel(String basePackage, String schemaLocation, GenerationConfig config, Annotator annotator) {
    if (type != null) {
        return codeModel;
    } else {
        return SchemaHelper.buildBodyJCodeModel(schemaLocation, basePackage, name, schema, config, annotator);
    }
}
项目:GitHub    文件:RuleFactory.java   
/**
 * Gets the annotator that will in apply annotations to the generated code
 * to allow correct serialization and deserialization, according to the
 * chosen annotation style.
 *
 * @return an annotator that can annotate various code constructs for JSON
 *         support
 */
public Annotator getAnnotator() {
    return annotator;
}
项目:GitHub    文件:RuleFactory.java   
/**
 * The annotator used to mark up Java types with any annotations that are
 * required to build JSON compatible types
 *
 * @param annotator
 *            the annotator
 */
public void setAnnotator(final Annotator annotator) {
    this.annotator = annotator;
}