类com.fasterxml.jackson.annotation.JsonInclude源码实例Demo

下面列出了怎么用com.fasterxml.jackson.annotation.JsonInclude的API类实例代码及写法,或者点击链接到github查看源代码。

@Override
public Optional<JsonIncludeStrategy> getJsonIncludeStrategy(BeanAttributeInformation attributeDesc) {
	Optional<JsonInclude> includeAnnotation = attributeDesc.getAnnotation(JsonInclude.class);
	if (includeAnnotation.isPresent()) {
		JsonInclude.Include value = includeAnnotation.get().value();
		JsonIncludeStrategy strategy;
		if (NON_NULL.equals(value)) {
			strategy = JsonIncludeStrategy.NOT_NULL;
		}
		else if (JsonInclude.Include.NON_EMPTY.equals(value)) {
			strategy = JsonIncludeStrategy.NON_EMPTY;
		}
		else {
			strategy = JsonIncludeStrategy.DEFAULT;
		}
		return Optional.of(strategy);
	}
	return Optional.empty();
}
 
源代码2 项目: openapi-generator   文件: User.java
/**
 * Get firstName
 * @return firstName
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@JsonProperty(JSON_PROPERTY_FIRST_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public String getFirstName() {
  return firstName;
}
 
源代码3 项目: quilt   文件: SpspClientDefaults.java
private static ObjectMapper defaultMapper() {
  final ObjectMapper objectMapper = JsonMapper.builder()
      .serializationInclusion(JsonInclude.Include.NON_EMPTY)
      .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
      .configure(JsonWriteFeature.WRITE_NUMBERS_AS_STRINGS, false)
      .build()
      .registerModule(new Jdk8Module())
      .registerModule(new InterledgerModule(Encoding.BASE64));
  objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
  objectMapper.configure(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN, true);
  return objectMapper;
}
 
源代码4 项目: openapi-generator   文件: InlineObject3.java
/**
 * None
 * @return string
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "None")
@JsonProperty(JSON_PROPERTY_STRING)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public String getString() {
  return string;
}
 
源代码5 项目: openapi-generator   文件: FormatTest.java
/**
 * Get _byte
 * @return _byte
**/
@ApiModelProperty(required = true, value = "")
@JsonProperty(JSON_PROPERTY_BYTE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@JacksonXmlProperty(localName = "byte")

public byte[] getByte() {
  return _byte;
}
 
源代码6 项目: lams   文件: AnnotationIntrospectorPair.java
@Override
public JsonInclude.Value findPropertyInclusion(Annotated a)
{
    JsonInclude.Value v2 = _secondary.findPropertyInclusion(a);
    JsonInclude.Value v1 = _primary.findPropertyInclusion(a);

    if (v2 == null) { // shouldn't occur but
        return v1;
    }
    return v2.withOverrides(v1);
}
 
源代码7 项目: openapi-generator   文件: TypeHolderExample.java
/**
 * Get boolItem
 * @return boolItem
**/
@NotNull
@ApiModelProperty(example = "true", required = true, value = "")
@JsonProperty(JSON_PROPERTY_BOOL_ITEM)
@JsonInclude(value = JsonInclude.Include.ALWAYS)

public Boolean isBoolItem() {
  return boolItem;
}
 
源代码8 项目: openapi-generator   文件: Pet.java
/**
 * pet status in the store
 * @return status
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "pet status in the store")
@JsonProperty(JSON_PROPERTY_STATUS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public StatusEnum getStatus() {
  return status;
}
 
源代码9 项目: openapi-generator   文件: XmlItem.java
/**
 * Get prefixNsNumber
 * @return prefixNsNumber
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "1.234", value = "")
@JsonProperty(JSON_PROPERTY_PREFIX_NS_NUMBER)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public BigDecimal getPrefixNsNumber() {
  return prefixNsNumber;
}
 
源代码10 项目: openapi-generator   文件: XmlItem.java
/**
 * Get prefixString
 * @return prefixString
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "string", value = "")
@JsonProperty(JSON_PROPERTY_PREFIX_STRING)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public String getPrefixString() {
  return prefixString;
}
 
/**
 * Get name
 * @return name
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public String getName() {
  return name;
}
 
源代码12 项目: openapi-generator   文件: DogAllOf.java
/**
 * Get breed
 * @return breed
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@JsonProperty(JSON_PROPERTY_BREED)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public String getBreed() {
  return breed;
}
 
源代码13 项目: openapi-generator   文件: Model200Response.java
/**
 * Get propertyClass
 * @return propertyClass
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@JsonProperty(JSON_PROPERTY_PROPERTY_CLASS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public String getPropertyClass() {
  return propertyClass;
}
 
源代码14 项目: openapi-generator   文件: ComplexQuadrilateral.java
/**
 * Get shapeType
 * @return shapeType
**/
@ApiModelProperty(required = true, value = "")
@JsonProperty(JSON_PROPERTY_SHAPE_TYPE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)

public String getShapeType() {
  return shapeType;
}
 
源代码15 项目: openapi-generator   文件: Capitalization.java
/**
 * Get smallSnake
 * @return smallSnake
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@JsonProperty(JSON_PROPERTY_SMALL_SNAKE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public String getSmallSnake() {
  return smallSnake;
}
 
源代码16 项目: spring-boot-start-current   文件: JsonUtils.java
private CustomizationObjectMapper (DateFormat dateFormat) {
	super();
	// 设置格式化
	setDateFormat( dateFormat );
	// <code>null<code> 不序列化
	setSerializationInclusion( JsonInclude.Include.NON_NULL );
	// 遇到未知属性,略过
	configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false );
}
 
源代码17 项目: openapi-generator   文件: Model200Response.java
/**
 * Get name
 * @return name
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@JsonProperty(JSON_PROPERTY_NAME)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public Integer getName() {
  return name;
}
 
源代码18 项目: openapi-generator   文件: Pet.java
/**
 * Get photoUrls
 * @return photoUrls
**/
@NotNull
@ApiModelProperty(required = true, value = "")
@JsonProperty(JSON_PROPERTY_PHOTO_URLS)
@JsonInclude(value = JsonInclude.Include.ALWAYS)

public Set<String> getPhotoUrls() {
  return photoUrls;
}
 
/**
 * Get mapMapAnytype
 * @return mapMapAnytype
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@JsonProperty(JSON_PROPERTY_MAP_MAP_ANYTYPE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public Map<String, Map<String, Object>> getMapMapAnytype() {
  return mapMapAnytype;
}
 
/**
 * Get mapBoolean
 * @return mapBoolean
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@JsonProperty(JSON_PROPERTY_MAP_BOOLEAN)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public Map<String, Boolean> getMapBoolean() {
  return mapBoolean;
}
 
源代码21 项目: openapi-generator   文件: Order.java
/**
 * Get id
 * @return id
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public Long getId() {
  return id;
}
 
源代码22 项目: openapi-generator   文件: Model200Response.java
/**
 * Get propertyClass
 * @return propertyClass
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@JsonProperty(JSON_PROPERTY_PROPERTY_CLASS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public String getPropertyClass() {
  return propertyClass;
}
 
源代码23 项目: openapi-generator   文件: Order.java
/**
 * Get id
 * @return id
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public Long getId() {
  return id;
}
 
源代码24 项目: openapi-generator   文件: User.java
/**
 * Get password
 * @return password
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@JsonProperty(JSON_PROPERTY_PASSWORD)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public String getPassword() {
  return password;
}
 
源代码25 项目: openapi-generator   文件: ModelReturn.java
/**
 * Get _return
 * @return _return
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@JsonProperty(JSON_PROPERTY_RETURN)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public Integer getReturn() {
  return _return;
}
 
源代码26 项目: openapi-generator   文件: User.java
/**
 * Get password
 * @return password
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@JsonProperty(JSON_PROPERTY_PASSWORD)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public String getPassword() {
  return password;
}
 
源代码27 项目: openapi-generator   文件: XmlItem.java
/**
 * Get nameNumber
 * @return nameNumber
**/
@javax.annotation.Nullable
@ApiModelProperty(example = "1.234", value = "")
@JsonProperty(JSON_PROPERTY_NAME_NUMBER)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public BigDecimal getNameNumber() {
  return nameNumber;
}
 
源代码28 项目: openapi-generator   文件: FormatTest.java
/**
 * Get int64
 * @return int64
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@JsonProperty(JSON_PROPERTY_INT64)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public Long getInt64() {
  return int64;
}
 
源代码29 项目: openapi-generator   文件: FileSchemaTestClass.java
/**
 * Get files
 * @return files
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
@JsonProperty(JSON_PROPERTY_FILES)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

public List<java.io.File> getFiles() {
  return files;
}
 
源代码30 项目: lams   文件: BasicSerializerFactory.java
/**
 * Helper method used for finding inclusion definitions for structured
 * container types like <code>Map</code>s and referential types
 * (like <code>AtomicReference</code>).
 *
 * @param contentType Declared full content type of container
 * @param configType Raw base type under which `configOverride`, if any, needs to be defined
 */
protected JsonInclude.Value _findInclusionWithContent(SerializerProvider prov,
        BeanDescription beanDesc,
        JavaType contentType, Class<?> configType)
    throws JsonMappingException
{
    final SerializationConfig config = prov.getConfig();

    // Defaulting gets complicated because we might have two distinct
    //   axis to consider: Container type itself , and then value (content) type.
    //  Start with Container-defaults, then use more-specific value override, if any.

    // Start by getting global setting, overridden by Map-type-override
    JsonInclude.Value inclV = beanDesc.findPropertyInclusion(config.getDefaultPropertyInclusion());
    inclV = config.getDefaultPropertyInclusion(configType, inclV);

    // and then merge content-type overrides, if any. But note that there's
    // content-to-value inclusion shift we have to do
    JsonInclude.Value valueIncl = config.getDefaultPropertyInclusion(contentType.getRawClass(), null);

    if (valueIncl != null) {
        switch (valueIncl.getValueInclusion()) {
        case USE_DEFAULTS:
            break;
        case CUSTOM:
            inclV = inclV.withContentFilter(valueIncl.getContentFilter());
            break;
        default:
            inclV = inclV.withContentInclusion(valueIncl.getValueInclusion());
        }
    }
    return inclV;
}
 
 同包方法