本文整理汇总了Java中com.fasterxml.jackson.annotation.JsonPropertyDescription类的典型用法代码示例。如果您正苦于以下问题:Java JsonPropertyDescription类的具体用法?Java JsonPropertyDescription怎么用?Java JsonPropertyDescription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JsonPropertyDescription类属于com.fasterxml.jackson.annotation包,在下文中一共展示了JsonPropertyDescription类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: propertyField
import com.fasterxml.jackson.annotation.JsonPropertyDescription; //导入依赖的package包/类
@Override
public void propertyField(JFieldVar field, JDefinedClass clazz, String propertyName, JsonNode propertyNode) {
field.annotate(JsonProperty.class).param("value", propertyName);
if (field.type().erasure().equals(field.type().owner().ref(Set.class))) {
field.annotate(JsonDeserialize.class).param("as", LinkedHashSet.class);
}
if (propertyNode.has("javaJsonView")) {
field.annotate(JsonView.class).param(
"value", field.type().owner().ref(propertyNode.get("javaJsonView").asText()));
}
if (propertyNode.has("description")) {
field.annotate(JsonPropertyDescription.class).param("value", propertyNode.get("description").asText());
}
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:Jackson2Annotator.java
示例2: annotationStyleJackson2ProducesJsonPropertyDescription
import com.fasterxml.jackson.annotation.JsonPropertyDescription; //导入依赖的package包/类
@Test
public void annotationStyleJackson2ProducesJsonPropertyDescription() throws Exception {
Class<?> generatedType = schemaRule.generateAndCompile("/schema/description/description.json", "com.example", config("annotationStyle", "jackson2")).loadClass("com.example.Description");
Field field = generatedType.getDeclaredField("description");
assertThat(field.getAnnotation(JsonPropertyDescription.class).value(), is("A description for this property"));
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:AnnotationStyleIT.java
示例3: getInfoForClass
import com.fasterxml.jackson.annotation.JsonPropertyDescription; //导入依赖的package包/类
private void getInfoForClass(List<Map<String, String>> rows, Class<?> clazz, String prefix) throws Exception {
Object instance = clazz.newInstance();
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
field.setAccessible(true);
String fieldName = field.getName();
String description = null;
boolean isRequired = false;
Object defaultValue = null;
try {
defaultValue = field.get(instance);
} catch (IllegalArgumentException e) {
}
for (Annotation annotation : field.getAnnotations()) {
if (annotation instanceof JsonProperty) {
JsonProperty propAnn = (JsonProperty) annotation;
String name = propAnn.value();
if (!StringUtils.isEmpty(name)) {
fieldName = name;
}
isRequired = propAnn.required();
}
if (annotation instanceof JsonPropertyDescription) {
JsonPropertyDescription descAnn = (JsonPropertyDescription) annotation;
description = descAnn.value();
}
}
if (hasGenerateDocumentation(field)) {
getInfoForClass(rows, field.getType(), fieldName);
} else if (description != null) {
Map<String, String> entries = new HashMap<>();
if (prefix != null) {
fieldName = prefix + "." + fieldName;
}
String type = field.getType().getSimpleName().toLowerCase();
entries.put("key", fieldName);
entries.put("description", description);
entries.put("type", type.toLowerCase());
entries.put("defaultValue", String.valueOf(defaultValue));
entries.put("required", String.valueOf(isRequired));
rows.add(entries);
}
}
}
开发者ID:gentics,项目名称:mesh,代码行数:46,代码来源:TableGenerator.java
示例4: getId
import com.fasterxml.jackson.annotation.JsonPropertyDescription; //导入依赖的package包/类
@JsonProperty("id")
@JsonPropertyDescription("A unique identifier for the entity, can be either URI or CURIE")
@JsonldId
public String getId();
开发者ID:phenopackets,项目名称:phenopacket-reference-implementation,代码行数:5,代码来源:Entity.java
示例5: getLabel
import com.fasterxml.jackson.annotation.JsonPropertyDescription; //导入依赖的package包/类
@JsonProperty("label")
@JsonPropertyDescription("A string that contains the preferred natural language term to denote the entity")
@JsonldProperty("http://www.w3.org/2000/01/rdf-schema#label")
public String getLabel();
开发者ID:phenopackets,项目名称:phenopacket-reference-implementation,代码行数:5,代码来源:Entity.java
示例6: getEvidence
import com.fasterxml.jackson.annotation.JsonPropertyDescription; //导入依赖的package包/类
@JsonProperty("evidence")
@JsonPropertyDescription("Any Association can have any number of pieces of evidence attached")
public List<Evidence> getEvidence();
开发者ID:phenopackets,项目名称:phenopacket-reference-implementation,代码行数:4,代码来源:Association.java
示例7: getType
import com.fasterxml.jackson.annotation.JsonPropertyDescription; //导入依赖的package包/类
@JsonProperty(value = "schema")
@JsonPropertyDescription("The type of this param")
public JsonSchema getType() throws JsonMappingException {
return Document.toJsonSchema(type);
}
开发者ID:wb14123,项目名称:bard,代码行数:6,代码来源:DocParameter.java
示例8: getReturn
import com.fasterxml.jackson.annotation.JsonPropertyDescription; //导入依赖的package包/类
@JsonProperty(value = "schema")
@JsonPropertyDescription("The return type.")
public JsonSchema getReturn() throws JsonMappingException {
return Document.toJsonSchema(returnType);
}
开发者ID:wb14123,项目名称:bard,代码行数:6,代码来源:Response.java
示例9: getType
import com.fasterxml.jackson.annotation.JsonPropertyDescription; //导入依赖的package包/类
/**
* Return the type of the field schema.
*
* @return Field schema type
*/
@JsonProperty(required = true)
@JsonPropertyDescription("Type of the field.")
String getType();
开发者ID:gentics,项目名称:mesh,代码行数:9,代码来源:FieldSchema.java
示例10: getLabel
import com.fasterxml.jackson.annotation.JsonPropertyDescription; //导入依赖的package包/类
/**
* Return the label of the field schema.
*
* @return Label
*/
@JsonProperty(required = false)
@JsonPropertyDescription("Label of the field.")
String getLabel();
开发者ID:gentics,项目名称:mesh,代码行数:9,代码来源:FieldSchema.java
示例11: getName
import com.fasterxml.jackson.annotation.JsonPropertyDescription; //导入依赖的package包/类
/**
* Return the name of the field schema.
*
* @return Name
*/
@JsonProperty(required = true)
@JsonPropertyDescription("Name of the field.")
String getName();
开发者ID:gentics,项目名称:mesh,代码行数:9,代码来源:FieldSchema.java
注:本文中的com.fasterxml.jackson.annotation.JsonPropertyDescription类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论