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

项目:GitHub    文件:Jackson2Annotator.java   
@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());
    }
}
项目:centraldogma    文件:PublicKeyMirrorCredential.java   
@JsonCreator
public PublicKeyMirrorCredential(@JsonProperty("hostnamePatterns")
                                 @JsonDeserialize(contentAs = Pattern.class)
                                 Iterable<Pattern> hostnamePatterns,
                                 @JsonProperty("username") String username,
                                 @JsonProperty("publicKey") String publicKey,
                                 @JsonProperty("privateKey") String privateKey,
                                 @JsonProperty("passphrase") String passphrase) {

    super(hostnamePatterns);

    this.username = requireNonEmpty(username, "username");

    requireNonEmpty(publicKey, "publicKey");
    requireNonEmpty(privateKey, "privateKey");
    this.publicKey = requireNonEmpty(publicKey, "publicKey").getBytes(StandardCharsets.UTF_8);
    this.privateKey = requireNonEmpty(privateKey, "privateKey").getBytes(StandardCharsets.UTF_8);

    this.passphrase = decodeBase64OrUtf8(passphrase, "passphrase");
}
项目:centraldogma    文件:DefaultMetaRepository.java   
@JsonCreator
MultipleMirrorConfig(
        @JsonProperty("enabled") Boolean enabled,
        @JsonProperty("defaultSchedule") String defaultSchedule,
        @JsonProperty(value = "defaultDirection", required = true) MirrorDirection defaultDirection,
        @JsonProperty("defaultLocalPath") String defaultLocalPath,
        @JsonProperty(value = "includes", required = true)
        @JsonDeserialize(contentAs = MirrorInclude.class)
        Iterable<MirrorInclude> includes,
        @JsonProperty("excludes")
        @JsonDeserialize(contentAs = Pattern.class)
        Iterable<Pattern> excludes) {

    super(firstNonNull(enabled, true));
    this.defaultSchedule = cronParser.parse(firstNonNull(defaultSchedule, DEFAULT_SCHEDULE));
    this.defaultDirection = requireNonNull(defaultDirection, "defaultDirection");
    this.defaultLocalPath = firstNonNull(defaultLocalPath, "/");
    this.includes = ImmutableList.copyOf(requireNonNullElements(includes, "includes"));
    if (excludes != null) {
        this.excludes = ImmutableList.copyOf(requireNonNullElements(excludes, "excludes"));
    } else {
        this.excludes = Collections.emptyList();
    }
}
项目:gcplot    文件:AddJvmRequest.java   
public AddJvmRequest(@JsonProperty(value = "id", required = true)
                     @JsonDeserialize(using = UUIDDeserializer.class)
                     @JsonSerialize(using = UUIDSerializer.class) UUID jvmId,
                     @JsonProperty(value = "an_id", required = true) String analyseId,
                     @JsonProperty(value = "name", required = true) String jvmName,
                     @JsonProperty(value = "vm_ver", required = true) int vmVersion,
                     @JsonProperty(value = "gc_type", required = true) int gcType,
                     @JsonProperty("headers") String headers,
                     @JsonProperty("mem") MemoryStatus memoryStatus) {
    this.jvmId = jvmId;
    this.analyseId = analyseId;
    this.jvmName = jvmName;
    this.vmVersion = vmVersion;
    this.gcType = gcType;
    this.headers = headers;
    this.memoryStatus = memoryStatus;
}
项目:FreeBuilder    文件:JacksonSupportTest.java   
@Test
public void jacksonAnnotationAddedWithImplicitName() throws CannotGenerateCodeException {
  // See also https://github.com/google/FreeBuilder/issues/90
  TypeElement dataType = model.newType(
      "package com.example;",
      "@" + JsonDeserialize.class.getName() + "(builder = DataType.Builder.class)",
      "public interface DataType {",
      "  int getFooBar();",
      "  class Builder extends DataType_Builder {}",
      "}");

  Metadata metadata = analyser.analyse(dataType);

  Property property = getOnlyElement(metadata.getProperties());
  assertPropertyHasJsonPropertyAnnotation(property, "fooBar");
}
项目:FreeBuilder    文件:JacksonSupportTest.java   
@Test
public void jsonAnyGetterAnnotationDisablesImplicitProperty() throws CannotGenerateCodeException {
  TypeElement dataType = model.newType(
      "package com.example;",
      "@" + JsonDeserialize.class.getName() + "(builder = DataType.Builder.class)",
      "public interface DataType {",
      "  @" + JsonAnyGetter.class.getName(),
      "  " + Map.class.getName() + "<Integer, String> getFooBar();",
      "  class Builder extends DataType_Builder {}",
      "}");

  Metadata metadata = analyser.analyse(dataType);

  Property property = getOnlyElement(metadata.getProperties());
  assertThat(property.getAccessorAnnotations()).named("property accessor annotations").isEmpty();
}
项目: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);
    }
}
项目:GitHub    文件:ObjectMappedTest.java   
@SuppressWarnings("deprecation")
@Test
public void noAnnotationsWorks() throws Exception {
  check(ImmutableJacksonMappedWithNoAnnotations.Json.class.getAnnotation(JsonDeserialize.class)).isNull();
  String json = "{\"someString\":\"xxx\"}";
  ImmutableJacksonMappedWithNoAnnotations value =
      OBJECT_MAPPER.readValue(json, ImmutableJacksonMappedWithNoAnnotations.class);
  check(OBJECT_MAPPER.writeValueAsString(value)).is(json);
}
项目:iiif-apis    文件:SearchResult.java   
/**
 * Set the list of containing resources. Must all be instances of {@link SearchLayer}
 *
 * @throws IllegalArgumentException if at least one of the resources is not a {@link SearchLayer}
 */
@JsonDeserialize(contentAs = SearchLayer.class)
@Override
public void setWithin(List<Resource> within) throws IllegalArgumentException {
  if (within.stream().anyMatch(r -> !(r instanceof SearchLayer))) {
    throw new IllegalArgumentException("SearchResult can only be within a SearchLayer.");
  }
  super.setWithin(within);
}
项目:centraldogma    文件:PasswordMirrorCredential.java   
@JsonCreator
public PasswordMirrorCredential(@JsonProperty("hostnamePatterns")
                                @JsonDeserialize(contentAs = Pattern.class)
                                Iterable<Pattern> hostnamePatterns,
                                @JsonProperty("username") String username,
                                @JsonProperty("password") String password) {
    super(hostnamePatterns);

    this.username = requireNonEmpty(username, "username");
    this.password = requireNonNull(password, "password");
}
项目:centraldogma    文件:CreateSessionCommand.java   
@JsonCreator
CreateSessionCommand(@JsonProperty("timestamp") @Nullable Long timestamp,
                     @JsonProperty("author") @Nullable Author author,
                     @JsonProperty("session")
                     @JsonDeserialize(using = SimpleSessionJsonDeserializer.class)
                     SimpleSession session) {

    super(CommandType.CREATE_SESSION, timestamp, author);
    this.session = requireNonNull(session, "session");
}
项目:bazel-tools    文件:Dependencies.java   
@JsonCreator
public static Dependencies create(
    @JsonProperty("options") final Options options,
    @JsonDeserialize(using = TableDeserializer.class) @JsonProperty("maven")
        final ImmutableTable<String, String, Maven> maven) {
  return builder().options(options).maven(maven == null ? ImmutableTable.of() : maven).build();
}
项目: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;
}
项目:spring-vault    文件:Policy.java   
@JsonCreator
private Rule(
        @JsonProperty("capabilities") List<Capability> capabilities,
        @JsonProperty("min_wrapping_ttl") @JsonDeserialize(converter = StringToDurationConverter.class) Duration minWrappingTtl,
        @JsonProperty("max_wrapping_ttl") @JsonDeserialize(converter = StringToDurationConverter.class) Duration maxWrappingTtl,
        @JsonProperty("allowed_parameters") Map<String, List<String>> allowedParameters,
        @JsonProperty("denied_parameters") Map<String, List<String>> deniedParameters) {

    this.path = "";
    this.capabilities = capabilities;
    this.minWrappingTtl = minWrappingTtl;
    this.maxWrappingTtl = maxWrappingTtl;
    this.allowedParameters = allowedParameters;
    this.deniedParameters = deniedParameters;
}
项目:jacksync    文件:PatchPathOperation.java   
/**
 * @param path the path to set
 */
@JsonDeserialize(using = JsonPointerDeserializer.class)
public void setPath(JsonPointer path) {
       if (path == null) {
           throw new IllegalArgumentException("Path is null");
       }
    this.path = path;
}
项目:jacksync    文件:PatchDualPathOperation.java   
/**
 * @param from the from to set
 */
@JsonDeserialize(using = JsonPointerDeserializer.class)
public void setFrom(JsonPointer from) {
       if (from == null) {
           throw new IllegalArgumentException("From is null");
       }
    this.from = from;
}
项目:camino    文件:Repeat.java   
/**
 * Constructor
 *
 * @param var name of variable
 * @param list list to iterate over
 * @param paths list of paths
 */
@JsonCreator
public Repeat(@JsonProperty("var") String var, @JsonProperty("list") String list,
        @JsonProperty("paths") @JsonDeserialize(contentAs = Path.class) List<Path> paths,
        @JsonProperty("repeats") @JsonDeserialize(contentAs = Repeat.class) List<Repeat> repeats) {
    this.var = var;
    this.list = list;
    this.paths = ImmutableList.copyOf(paths != null ? paths : Collections.emptyList());
    this.repeats = ImmutableList.copyOf(repeats != null ? repeats :
            Collections.emptyList());
}
项目:camino    文件:Config.java   
/**
 * Constructor
 */
@JsonCreator
public Config(@JacksonInject("location") URI location,
        @JsonProperty("includes") List<String> includes,
        @JsonProperty("properties") @JsonDeserialize(as = LinkedHashMap.class, keyAs = String.class,
                contentAs = String.class) Map<String, String> properties,
        @JsonProperty("paths") @JsonDeserialize(contentAs = Path.class) List<Path> paths,
        @JsonProperty("repeats") @JsonDeserialize(contentAs = Repeat.class) List<Repeat> repeats) {
    this(location, includes, properties == null ? null : ConfigUtil.mapToList(properties,
            Property::new),
            paths, repeats);
}
项目:camino    文件:Path.java   
/**
 * Constructor
 *
 * @param name name of path
 * @param value value of path
 * @param metrics metrics under this path
 * @param tags tags of this path as ordered map of tag key/value pairs
 * @param expectedCreationTime expression to calculate creation time of this path
 */
@JsonCreator
public Path(@JsonProperty("name") String name, @JsonProperty("value") String value,
        @JsonProperty("metrics") @JsonDeserialize(contentAs = Metric.class) List<Metric> metrics,
        @JsonProperty("tags") @JsonDeserialize(as = LinkedHashMap.class, keyAs = String.class,
                contentAs = String.class) Map<String, String> tags,
        @JsonProperty("expectedCreationTime") String expectedCreationTime) {
    this(name, value, metrics, tags == null ? null : ConfigUtil.mapToList(tags,
            Tag::new), expectedCreationTime);
}
项目:cineast    文件:RetrieverConfig.java   
@JsonProperty("features")
@JsonDeserialize(contentUsing = FeatureCategoriesDeserializer.class)
public List<String> getRetrieverCategories(){
    Set<String> keys = this.retrieverCategories.keySet();
    ArrayList<String> _return = new ArrayList<>(keys.size());
    _return.addAll(keys);
    return _return;
}
项目:haven-platform    文件:JobParameters.java   
@JsonDeserialize(contentUsing = JobParametersDeserializer.class)
public void setParameters(Map<String, Object> parameters) {
    this.parameters.clear();
    if(parameters != null) {
        this.parameters.putAll(parameters);
    }
}
项目:vespa    文件:InstanceConfirmation.java   
@JsonCreator
public InstanceConfirmation(@JsonProperty("provider") String provider,
                            @JsonProperty("domain") String domain,
                            @JsonProperty("service") String service,
                            @JsonProperty("attestationData") @JsonDeserialize(using = SignedIdentityDeserializer.class)
                                        SignedIdentityDocument signedIdentityDocument) {
    this.provider = provider;
    this.domain = domain;
    this.service = service;
    this.signedIdentityDocument = signedIdentityDocument;
}
项目:dhis2-core    文件:DataInputPeriod.java   
@JsonProperty
@JsonSerialize( using = JacksonPeriodSerializer.class )
@JsonDeserialize( using = JacksonPeriodDeserializer.class )
@JacksonXmlProperty( localName = "period", namespace = DxfNamespaces.DXF_2_0 )
public Period getPeriod()
{
    return period;
}
项目:dhis2-core    文件:DataSet.java   
@JsonProperty
@JsonSerialize( using = JacksonPeriodTypeSerializer.class )
@JsonDeserialize( using = JacksonPeriodTypeDeserializer.class )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
@Property( PropertyType.TEXT )
public PeriodType getPeriodType()
{
    return periodType;
}
项目:dhis2-core    文件:ValidationRule.java   
@JsonProperty
@JsonSerialize( using = JacksonPeriodTypeSerializer.class )
@JsonDeserialize( using = JacksonPeriodTypeDeserializer.class )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
@Property( PropertyType.TEXT )
public PeriodType getPeriodType()
{
    return periodType;
}
项目:dhis2-core    文件:EventChart.java   
@Override
@JsonProperty
@JsonDeserialize( as = BaseDimensionalItemObject.class )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public DimensionalItemObject getValue()
{
    return value;
}
项目:dhis2-core    文件:Predictor.java   
@JsonProperty
@JsonSerialize( using = JacksonPeriodTypeSerializer.class )
@JsonDeserialize( using = JacksonPeriodTypeDeserializer.class )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
@Property( PropertyType.TEXT )
public PeriodType getPeriodType()
{
    return periodType;
}
项目:dhis2-core    文件:Program.java   
@JsonProperty
@JsonSerialize( using = JacksonPeriodTypeSerializer.class )
@JsonDeserialize( using = JacksonPeriodTypeDeserializer.class )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public PeriodType getExpiryPeriodType()
{
    return expiryPeriodType;
}
项目:dhis2-core    文件:ProgramStage.java   
@JsonProperty
@JsonSerialize( using = JacksonPeriodTypeSerializer.class )
@JsonDeserialize( using = JacksonPeriodTypeDeserializer.class )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
@Property( PropertyType.TEXT )
public PeriodType getPeriodType()
{
    return periodType;
}
项目:dhis2-core    文件:DataApprovalWorkflow.java   
@JsonProperty
@JsonSerialize( using = JacksonPeriodTypeSerializer.class )
@JsonDeserialize( using = JacksonPeriodTypeDeserializer.class )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
@Property( PropertyType.TEXT )
public PeriodType getPeriodType()
{
    return periodType;
}
项目:dhis2-core    文件:EventReport.java   
@Override
@JsonProperty
@JsonDeserialize( as = BaseDimensionalItemObject.class )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public DimensionalItemObject getValue()
{
    return value;
}
项目:dhis2-core    文件:BaseAnalyticalObject.java   
@JsonProperty
@JsonSerialize( contentUsing = JacksonPeriodSerializer.class )
@JsonDeserialize( contentUsing = JacksonPeriodDeserializer.class )
@JacksonXmlElementWrapper( localName = "periods", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "period", namespace = DxfNamespaces.DXF_2_0 )
public List<Period> getPeriods()
{
    return periods;
}
项目:dhis2-core    文件:BaseAnalyticalObject.java   
@Override
@JsonProperty
@JsonDeserialize( contentAs = BaseDimensionalObject.class )
@JacksonXmlElementWrapper( localName = "columns", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "column", namespace = DxfNamespaces.DXF_2_0 )
public List<DimensionalObject> getColumns()
{
    return columns;
}
项目:dhis2-core    文件:BaseAnalyticalObject.java   
@Override
@JsonProperty
@JsonDeserialize( contentAs = BaseDimensionalObject.class )
@JacksonXmlElementWrapper( localName = "rows", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "row", namespace = DxfNamespaces.DXF_2_0 )
public List<DimensionalObject> getRows()
{
    return rows;
}
项目:dhis2-core    文件:BaseAnalyticalObject.java   
@Override
@JsonProperty
@JsonDeserialize( contentAs = BaseDimensionalObject.class )
@JacksonXmlElementWrapper( localName = "filters", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "filter", namespace = DxfNamespaces.DXF_2_0 )
public List<DimensionalObject> getFilters()
{
    return filters;
}
项目:dhis2-core    文件:BaseIdentifiableObject.java   
@JsonProperty
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
@JsonSerialize( using = CustomLastUpdatedUserSerializer.class )
@JsonDeserialize
public User getLastUpdatedBy()
{
    return  lastUpdatedBy;
}
项目:dhis2-core    文件:BaseDimensionalObject.java   
@Override
@JsonProperty
@JsonDeserialize( contentAs = BaseDimensionalItemObject.class )
@JacksonXmlElementWrapper( localName = "items", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "item", namespace = DxfNamespaces.DXF_2_0 )
public List<DimensionalItemObject> getItems()
{
    return items;
}
项目:dhis2-core    文件:Period.java   
@JsonProperty
@JsonSerialize( using = JacksonPeriodTypeSerializer.class )
@JsonDeserialize( using = JacksonPeriodTypeDeserializer.class )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
@Property( PropertyType.TEXT )
public PeriodType getPeriodType()
{
    return periodType;
}
项目:archie    文件:DvTime.java   
@Override
//    @XmlElements({
//            @XmlElement(type=OffsetTime.class),
//            @XmlElement(type=LocalTime.class)
//    })    
    @JsonDeserialize(using=TimeDeserializer.class)
    public TemporalAccessor getValue() {
        return value;
    }