Java 类com.fasterxml.jackson.databind.annotation.JsonSerialize 实例源码

项目:GitHub    文件:AnnotationStyleIT.java   
@Test
@SuppressWarnings({ "rawtypes", "unchecked" })
public void annotationStyleJackson1ProducesJackson1Annotations() throws ClassNotFoundException, SecurityException, NoSuchMethodException {

    Class generatedType = schemaRule.generateAndCompile("/schema/properties/primitiveProperties.json", "com.example",
            config("annotationStyle", "jackson1"))
            .loadClass("com.example.PrimitiveProperties");

    assertThat(schemaRule.getGenerateDir(), not(containsText("com.fasterxml.jackson")));
    assertThat(schemaRule.getGenerateDir(), containsText("org.codehaus.jackson"));

    Method getter = generatedType.getMethod("getA");

    assertThat(generatedType.getAnnotation(org.codehaus.jackson.annotate.JsonPropertyOrder.class), is(notNullValue()));
    assertThat(generatedType.getAnnotation(org.codehaus.jackson.map.annotate.JsonSerialize.class), is(notNullValue()));
    assertThat(getter.getAnnotation(org.codehaus.jackson.annotate.JsonProperty.class), is(notNullValue()));
}
项目:GitHub    文件:MediaIT.java   
@Test
public void shouldCreateByteArrayFieldWithAnyEncoding() throws SecurityException, NoSuchFieldException {
    Field field = classWithMediaProperties.getDeclaredField("anyBinaryEncoding");
    JsonSerialize serAnnotation = field.getAnnotation(JsonSerialize.class);
    JsonDeserialize deserAnnotation = field.getAnnotation(JsonDeserialize.class);

    assertThat("any binary encoding field has type byte[]", field.getType(), equalToType(BYTE_ARRAY));
    assertThat("any binary encoding has a serializer", serAnnotation, notNullValue());
    assertThat("any binary encoding has a deserializer", deserAnnotation, notNullValue());
}
项目:GitHub    文件:MediaIT.java   
@Override
public void propertyField(JFieldVar field, JDefinedClass clazz, String propertyName, JsonNode propertyNode) {
    if( isQuotedPrintableProperty(propertyNode) ) {
        field.annotate(JsonSerialize.class).param(USING, QuotedPrintableSerializer.class);
        field.annotate(JsonInclude.class).param("value", JsonInclude.Include.NON_NULL);
        field.annotate(JsonDeserialize.class).param(USING, QuotedPrintableDeserializer.class);
    }
}
项目:CityPower-Build-Sample    文件:IncidentServiceImpl.java   
@Override
   @JsonSerialize(using = Jackson2HalModule.HalResourcesSerializer.class)
   @JsonDeserialize(using = Jackson2HalModule.HalResourcesDeserializer.class)
public PagedIncidents getIncidentsPaged(int pagenum,int pagesize) {
    LOG.info("Performing get {} web service", applicationProperties.getIncidentApiUrl() +"/incidents");
    final String restUri = applicationProperties.getIncidentApiUrl() +"/incidents?page="+pagenum+"&size="+pagesize;
    ResponseEntity<PagedResources<IncidentBean>> response = restTemplate.exchange(restUri, HttpMethod.GET, null,
            new ParameterizedTypeReference<PagedResources<IncidentBean>>() {});
    //        LOG.info("Total Incidents {}", response.getBody().size());
    PagedResources<IncidentBean> beanResources = response.getBody();
    PagedIncidents incidents = new PagedIncidents(beanResources,pagenum);
    return incidents;
}
项目:GitHub    文件:AnnotationStyleIT.java   
@Test
@SuppressWarnings({ "rawtypes", "unchecked" })
public void annotationStyleNoneProducesNoAnnotations() throws ClassNotFoundException, SecurityException, NoSuchMethodException {

    ClassLoader resultsClassLoader = schemaRule.generateAndCompile("/schema/properties/primitiveProperties.json", "com.example",
            config("annotationStyle", "none"));

    Class generatedType = resultsClassLoader.loadClass("com.example.PrimitiveProperties");

    Method getter = generatedType.getMethod("getA");

    assertThat(generatedType.getAnnotation(JsonPropertyOrder.class), is(nullValue()));
    assertThat(generatedType.getAnnotation(JsonSerialize.class), is(nullValue()));
    assertThat(getter.getAnnotation(JsonProperty.class), is(nullValue()));

}
项目:GitHub    文件:JacksonMappedWithExtraAnnotation.java   
@AdditionalJacksonAnnotation("some_long")
@JsonProperty("some_long_string")
@JsonSerialize(using=ToStringSerializer.class)
Long getSomeLong();
项目:GitHub    文件:BuilderDeserializationTest.java   
@JsonProperty("int_value_property")
@JsonSerialize(converter = IntValueOverrideConverter.StringSerializer.class)
@JsonDeserialize(converter = IntValueOverrideConverter.StringDeserializer.class)
abstract IntValueClass getIntValue();
项目:GitHub    文件:BuilderDeserializationTest.java   
@JsonProperty("int_value_property")
@JsonSerialize(converter = IntValueOverrideConverter.StringSerializer.class)
@JsonDeserialize(converter = IntValueOverrideConverter.StringDeserializer.class)
abstract IntValueClass getIntValue();
项目:iiif-apis    文件:SearchLayer.java   
@JsonSerialize(contentAs = String.class)
public Set<String> getIgnored() {
  return ignored;
}
项目:rkt-launcher    文件:Image.java   
@JsonDeserialize(converter = Time.Nano2Instant.class)
@JsonSerialize(converter = Time.Instant2Nano.class)
Instant importTime();
项目:rkt-launcher    文件:Image.java   
@JsonDeserialize(converter = Time.Nano2Instant.class)
@JsonSerialize(converter = Time.Instant2Nano.class)
Instant lastUsedTime();
项目:rkt-launcher    文件:App.java   
@JsonDeserialize(converter = Time.Nano2Instant.class)
@JsonSerialize(converter = Time.Instant2Nano.class)
Instant createdAt();
项目:rkt-launcher    文件:App.java   
@JsonDeserialize(converter = Time.Nano2Instant.class)
@JsonSerialize(converter = Time.Instant2Nano.class)
Instant startedAt();
项目:daelic    文件:TimeFormatExtractionFn.java   
@JsonSerialize(using = ToStringSerializer.class)
public ZoneId getTimeZone() {
    return timeZone;
}
项目:daelic    文件:TimeFormatExtractionFn.java   
@JsonSerialize(using = ToStringSerializer.class)
public Locale getLocale() {
    return locale;
}
项目:daelic    文件:PeriodGranularity.java   
@JsonSerialize(using = ToStringSerializer.class)
public ZoneId getTimeZone() {
    return timeZone;
}
项目:daelic    文件:PeriodGranularity.java   
@JsonSerialize(using = ToStringSerializer.class)
public OffsetDateTime getOrigin() {
    return origin;
}
项目:daelic    文件:DurationGranularity.java   
@JsonSerialize(using = ToStringSerializer.class)
public OffsetDateTime getOrigin() {
    return origin;
}
项目:daelic    文件:GroupByRowResult.java   
@JsonSerialize(using = ToStringSerializer.class)
public ZonedDateTime getTimestamp() {
    return timestamp;
}
项目:centraldogma    文件:CreateSessionCommand.java   
@JsonProperty("session")
@JsonSerialize(using = SimpleSessionJsonSerializer.class)
public SimpleSession session() {
    return session;
}
项目:centraldogma    文件:CentralDogmaConfig.java   
@JsonProperty
@JsonSerialize(contentUsing = ServerPortSerializer.class)
List<ServerPort> ports() {
    return ports;
}
项目:centraldogma    文件:CentralDogmaConfig.java   
@JsonProperty
@JsonSerialize(converter = OptionalConverter.class)
Optional<Integer> numWorkers() {
    return Optional.ofNullable(numWorkers);
}
项目:centraldogma    文件:CentralDogmaConfig.java   
@JsonProperty
@JsonSerialize(converter = OptionalConverter.class)
Optional<Integer> maxNumConnections() {
    return Optional.ofNullable(maxNumConnections);
}
项目:centraldogma    文件:CentralDogmaConfig.java   
@JsonProperty
@JsonSerialize(converter = OptionalConverter.class)
Optional<Long> requestTimeoutMillis() {
    return Optional.ofNullable(requestTimeoutMillis);
}
项目:centraldogma    文件:CentralDogmaConfig.java   
@JsonProperty
@JsonSerialize(converter = OptionalConverter.class)
Optional<Long> idleTimeoutMillis() {
    return Optional.ofNullable(idleTimeoutMillis);
}
项目:centraldogma    文件:CentralDogmaConfig.java   
@JsonProperty
@JsonSerialize(converter = OptionalConverter.class)
Optional<Integer> maxFrameLength() {
    return Optional.ofNullable(maxFrameLength);
}
项目:centraldogma    文件:CentralDogmaConfig.java   
@JsonProperty
@JsonSerialize(converter = OptionalConverter.class)
Optional<GracefulShutdownTimeout> gracefulShutdownTimeout() {
    return Optional.ofNullable(gracefulShutdownTimeout);
}
项目:pyplyn    文件:AuthRequest.java   
@Value.Redacted
@JsonSerialize(using=SensitiveByteArraySerializer.class)
public abstract byte[] password();
项目:pyplyn    文件:AuthResponse.java   
@Nullable
@Value.Redacted
@JsonSerialize(using=SensitiveByteArraySerializer.class)
@JsonDeserialize(using=SensitiveByteArrayDeserializer.class)
public abstract byte[] token();
项目:pyplyn    文件:AuthRequest.java   
@Value.Redacted
@JsonSerialize(using=SensitiveByteArraySerializer.class)
public abstract byte[] password();
项目:pyplyn    文件:AuthToken.java   
@Value.Redacted
@JsonProperty(access = WRITE_ONLY)
@JsonSerialize(using=SensitiveByteArraySerializer.class)
@JsonDeserialize(using=SensitiveByteArrayDeserializer.class)
public abstract byte[] accessToken();
项目:pyplyn    文件:AuthToken.java   
@Value.Redacted
@JsonSerialize(using=SensitiveByteArraySerializer.class)
@JsonDeserialize(using=SensitiveByteArrayDeserializer.class)
public abstract byte[] refreshToken();
项目:taskana    文件:WorkbasketMixIn.java   
@JsonSerialize(using = DistributionTargetSerializer.class)
@JsonDeserialize(using = DistributionTargetDeserializer.class)
abstract List<Workbasket> getDistributionTargets();
项目:iTAP-controller    文件:ControllerSwitchesResource.java   
@JsonSerialize(using=DPIDSerializer.class)
public DatapathId getSwitchDPID() {
    return dpid;
}
项目:microservices-basics-spring-boot    文件:CommentDTO.java   
/**
 * @return the posted
 */
@JsonSerialize(using = CustomDateToLongSerializer.class)
public Date getPosted() {
    return posted;
}
项目:microservices-basics-spring-boot    文件:CommentResource.java   
/**
 * @return the posted
 */
@JsonProperty(JP_POSTED)
@JsonSerialize(using = CustomDateToStringSerializer.class)
public Date getPosted() {
    return posted;
}
项目:optashift-employee-rostering    文件:AbstractRosterView.java   
@JsonSerialize(using = LocalDateSerializer.class)
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonFormat(shape = JsonFormat.Shape.STRING)
public LocalDate getStartDate() {
    return startDate;
}
项目:optashift-employee-rostering    文件:AbstractRosterView.java   
@JsonSerialize(using = LocalDateSerializer.class)
@JsonDeserialize(using = LocalDateDeserializer.class)
@JsonFormat(shape = JsonFormat.Shape.STRING)
public LocalDate getEndDate() {
    return endDate;
}
项目:optashift-employee-rostering    文件:AbstractRosterView.java   
@JsonSerialize(using = ScoreJacksonJsonSerializer.class)
@JsonDeserialize(using = HardSoftScoreJacksonJsonDeserializer.class)
public HardSoftScore getScore() {
    return score;
}
项目:optashift-employee-rostering    文件:TimeSlot.java   
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonFormat(shape = JsonFormat.Shape.STRING)
public LocalDateTime getStartDateTime() {
    return startDateTime;
}