com.fasterxml.jackson.annotation.JsonCreator.Mode Java Examples

The following examples show how to use com.fasterxml.jackson.annotation.JsonCreator.Mode. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TagRequest.java    From hawkular-metrics with Apache License 2.0 6 votes vote down vote up
@JsonCreator(mode = Mode.PROPERTIES)
public TagRequest(
        @JsonProperty("tags")
        Map<String, String> tags,
        @JsonProperty("start")
        Long start,
        @JsonProperty("end")
        Long end,
        @JsonProperty("timestamp")
        Long timestamp
) {
    this.tags = tags == null ? emptyMap() : unmodifiableMap(tags);
    this.start = start;
    this.end = end;
    this.timestamp = timestamp;
}
 
Example #2
Source File: MixedMetricsRequest.java    From hawkular-metrics with Apache License 2.0 6 votes vote down vote up
@JsonCreator(mode = Mode.PROPERTIES)
public MixedMetricsRequest(
        @JsonProperty("gauges")
        List<Metric<Double>> gauges,
        @JsonProperty("availabilities")
        List<Metric<AvailabilityType>> availabilities,
        @JsonProperty("counters")
        List<Metric<Long>> counters,
        @JsonProperty("strings")
        List<Metric<String>> strings
) {
    this.gauges = gauges == null ? emptyList() : unmodifiableList(gauges);
    this.availabilities = availabilities == null ? emptyList() : unmodifiableList(availabilities);
    this.counters = counters == null ? emptyList() : unmodifiableList(counters);
    this.strings = strings == null ? emptyList() : unmodifiableList(strings);
}
 
Example #3
Source File: BasicDeserializerFactory.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @since 2.9
 */
protected boolean _hasCreatorAnnotation(DeserializationContext ctxt,
        Annotated ann) {
    AnnotationIntrospector intr = ctxt.getAnnotationIntrospector();
    if (intr != null) {
        JsonCreator.Mode mode = intr.findCreatorAnnotation(ctxt.getConfig(), ann);
        return (mode != null) && (mode != JsonCreator.Mode.DISABLED); 
    }
    return false;
}
 
Example #4
Source File: IssueTrackerConfiguration.java    From spring-data-dev-tools with Apache License 2.0 5 votes vote down vote up
@Bean
ObjectMapper jacksonObjectMapper() {

	ObjectMapper mapper = new ObjectMapper();

	mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
	mapper.setSerializationInclusion(Include.NON_NULL);
	mapper.registerModule(new ParameterNamesModule(Mode.PROPERTIES));
	mapper.registerModule(new SyntheticLambdaFactoryMethodIgnoringModule());

	return mapper;
}
 
Example #5
Source File: TenantDefinition.java    From hawkular-metrics with Apache License 2.0 5 votes vote down vote up
@JsonCreator(mode = Mode.PROPERTIES)
public TenantDefinition(
        @JsonProperty("id")
        String id,
        @JsonProperty("retentions")
        @JsonDeserialize(keyUsing = MetricTypeKeyDeserializer.class)
        Map<MetricType<?>, Integer> retentionSettings) {
    checkArgument(id != null, "Tenant id is null");
    this.id = id;
    this.retentionSettings = retentionSettings == null ? emptyMap() : unmodifiableMap(retentionSettings);
}
 
Example #6
Source File: Metric.java    From hawkular-metrics with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@JsonCreator(mode = Mode.PROPERTIES)
public Metric(
        @JsonProperty("id")
        String id,
        @JsonProperty(value = "tags")
        Map<String, String> tags,
        @JsonProperty("dataRetention")
        Integer dataRetention,
        @JsonProperty("type")
        @JsonDeserialize(using = MetricTypeDeserializer.class)
        MetricType<T> type,
        @JsonProperty("data")
        List<DataPoint<T>> data,
        @JsonProperty(value="tenantId", defaultValue="")
        String tenantId
) {
    checkArgument(id != null, "Metric id is null");

    if (type == null) {
        type = MetricType.UNDEFINED;
    }

    if (tenantId == null) {
        tenantId = "";
    }

    this.id = new MetricId<T>(tenantId, type, id);
    this.tags = tags == null ? emptyMap() : unmodifiableMap(tags);
    this.dataRetention = dataRetention;
    this.dataPoints = data == null || data.isEmpty() ? emptyList() : unmodifiableList(data);
    this.minTimestamp = this.maxTimestamp = null;
}
 
Example #7
Source File: LazyParsable.java    From xyz-hub with Apache License 2.0 4 votes vote down vote up
@JsonCreator(mode = Mode.DELEGATING)
public LazyParsable(String valueString) {
  this.valueString = valueString;
}