本文整理汇总了Java中org.jsonschema2pojo.Annotator类的典型用法代码示例。如果您正苦于以下问题:Java Annotator类的具体用法?Java Annotator怎么用?Java Annotator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Annotator类属于org.jsonschema2pojo包,在下文中一共展示了Annotator类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCustomAnnotator
import org.jsonschema2pojo.Annotator; //导入依赖的package包/类
@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;
}
}
示例2: setCustomAnnotator
import org.jsonschema2pojo.Annotator; //导入依赖的package包/类
/**
* 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;
}
}
示例3: classIsCreatedFromFullyQualifiedClassName
import org.jsonschema2pojo.Annotator; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void classIsCreatedFromFullyQualifiedClassName() {
Class<Annotator> clazz = converter.convert(Annotator.class.getName());
assertThat(clazz, is(equalTo(Annotator.class)));
}
示例4: getAnnotator
import org.jsonschema2pojo.Annotator; //导入依赖的package包/类
/**
*
* @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;
}
示例5: getAnnotator
import org.jsonschema2pojo.Annotator; //导入依赖的package包/类
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;
}
示例6: generateModelSources
import org.jsonschema2pojo.Annotator; //导入依赖的package包/类
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);
}
}
示例7: getCustomAnnotator
import org.jsonschema2pojo.Annotator; //导入依赖的package包/类
@Override
public Class<? extends Annotator> getCustomAnnotator() {
return customAnnotator;
}
示例8: APXCustomRuleFactory
import org.jsonschema2pojo.Annotator; //导入依赖的package包/类
public APXCustomRuleFactory(GenerationConfig generationConfig, Annotator annotator, SchemaStore schemaStore) {
super(generationConfig, annotator, schemaStore);
}
示例9: requireAnnotator
import org.jsonschema2pojo.Annotator; //导入依赖的package包/类
private static Annotator requireAnnotator(AnnotationStyle annotationStyle) {
checkState(ANNOTATOR_SUPPLIER_INDEX.containsKey(annotationStyle), "Illegal annotation style: %s", annotationStyle);
return ANNOTATOR_SUPPLIER_INDEX.get(annotationStyle).get();
}
示例10: RuleFactory
import org.jsonschema2pojo.Annotator; //导入依赖的package包/类
/**
* 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);
}
示例11: getCodeModel
import org.jsonschema2pojo.Annotator; //导入依赖的package包/类
/**
* 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);
}
}
示例12: getAnnotator
import org.jsonschema2pojo.Annotator; //导入依赖的package包/类
/**
* 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;
}
示例13: setAnnotator
import org.jsonschema2pojo.Annotator; //导入依赖的package包/类
/**
* 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;
}