Java 类com.fasterxml.jackson.annotation.JsonCreator.Mode 实例源码

项目:hawkular-metrics    文件:TagRequest.java   
@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;
}
项目:hawkular-metrics    文件:MixedMetricsRequest.java   
@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);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JacksonAutoConfigurationTests.java   
private void assertParameterNamesModuleCreatorBinding(Mode expectedMode,
        Class<?>... configClasses) {
    this.context.register(configClasses);
    this.context.refresh();
    Annotated annotated = mock(Annotated.class);
    Mode mode = this.context.getBean(ObjectMapper.class).getDeserializationConfig()
            .getAnnotationIntrospector().findCreatorBinding(annotated);
    assertThat(mode).isEqualTo(expectedMode);
}
项目:HeliosStreams    文件:LocalPortForwardRequest.java   
/**
 * Creates a new LocalPortForwardRequest
 * @param localPort The local port, defaults to zero for an ephremeral port
 * @param remotePort The remote port to tunnel to
 * @param remoteHost The remote host to tunnel to
 */
@JsonCreator(mode=Mode.PROPERTIES)
public LocalPortForwardRequest(
        @JsonProperty(value="localport", defaultValue="0") final int localPort, 
        @JsonProperty(value="remoteport") final int remotePort, 
        @JsonProperty(value="remotehost") final String remoteHost) {
    if(localPort < 0 || localPort > 65535) throw new IllegalArgumentException("The passed local port [" + localPort + "] is invalid");
    if(remotePort < 1 || remotePort > 65535) throw new IllegalArgumentException("The passed remote port [" + localPort + "] is invalid");
    if(remoteHost==null || remoteHost.trim().isEmpty()) throw new IllegalArgumentException("The passed remote host was null or empty");
    this.localPort = localPort;
    this.remotePort = remotePort;
    this.remoteHost = remoteHost.trim();
    key = this.remoteHost + "-" + remotePort;
}
项目:spring-boot-concourse    文件:JacksonAutoConfigurationTests.java   
private void assertParameterNamesModuleCreatorBinding(Mode expectedMode,
        Class<?>... configClasses) {
    this.context.register(configClasses);
    this.context.refresh();
    Annotated annotated = mock(Annotated.class);
    Mode mode = this.context.getBean(ObjectMapper.class).getDeserializationConfig()
            .getAnnotationIntrospector().findCreatorBinding(annotated);
    assertThat(mode).isEqualTo(expectedMode);
}
项目:contestparser    文件:JacksonAutoConfigurationTests.java   
private void assertParameterNamesModuleCreatorBinding(Mode expectedMode,
        Class<?>... configClasses) {
    this.context.register(configClasses);
    this.context.refresh();
    Annotated annotated = mock(Annotated.class);
    Mode mode = this.context.getBean(ObjectMapper.class).getDeserializationConfig()
            .getAnnotationIntrospector().findCreatorBinding(annotated);
    assertThat(mode, is(equalTo(expectedMode)));
}
项目:spring-data-dev-tools    文件:IssueTrackerConfiguration.java   
@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;
}
项目:hawkular-metrics    文件:TenantDefinition.java   
@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);
}
项目:hawkular-metrics    文件:Metric.java   
@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;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JacksonAutoConfigurationTests.java   
@Test
public void parameterNamesModuleIsAutoConfigured() {
    assertParameterNamesModuleCreatorBinding(Mode.DEFAULT,
            JacksonAutoConfiguration.class);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JacksonAutoConfigurationTests.java   
@Test
public void customParameterNamesModuleCanBeConfigured() {
    assertParameterNamesModuleCreatorBinding(Mode.DELEGATING,
            ParameterNamesModuleConfig.class, JacksonAutoConfiguration.class);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JacksonAutoConfigurationTests.java   
@Bean
public ParameterNamesModule parameterNamesModule() {
    return new ParameterNamesModule(JsonCreator.Mode.DELEGATING);
}
项目:spring-boot-concourse    文件:JacksonAutoConfigurationTests.java   
@Test
public void parameterNamesModuleIsAutoConfigured() {
    assertParameterNamesModuleCreatorBinding(Mode.DEFAULT,
            JacksonAutoConfiguration.class);
}
项目:spring-boot-concourse    文件:JacksonAutoConfigurationTests.java   
@Test
public void customParameterNamesModuleCanBeConfigured() {
    assertParameterNamesModuleCreatorBinding(Mode.DELEGATING,
            ParameterNamesModuleConfig.class, JacksonAutoConfiguration.class);
}
项目:spring-boot-concourse    文件:JacksonAutoConfigurationTests.java   
@Bean
public ParameterNamesModule parameterNamesModule() {
    return new ParameterNamesModule(JsonCreator.Mode.DELEGATING);
}
项目:contestparser    文件:JacksonAutoConfigurationTests.java   
@Test
public void parameterNamesModuleIsAutoConfigured() {
    assertParameterNamesModuleCreatorBinding(Mode.PROPERTIES,
            JacksonAutoConfiguration.class);
}
项目:contestparser    文件:JacksonAutoConfigurationTests.java   
@Test
public void customParameterNamesModuleCanBeConfigured() {
    assertParameterNamesModuleCreatorBinding(Mode.DELEGATING,
            ParameterNamesModuleConfig.class, JacksonAutoConfiguration.class);
}
项目:contestparser    文件:JacksonAutoConfigurationTests.java   
@Bean
public ParameterNamesModule parameterNamesModule() {
    return new ParameterNamesModule(JsonCreator.Mode.DELEGATING);
}