当前位置: 首页>>代码示例>>Java>>正文


Java JsonDeserialize类代码示例

本文整理汇总了Java中com.fasterxml.jackson.databind.annotation.JsonDeserialize的典型用法代码示例。如果您正苦于以下问题:Java JsonDeserialize类的具体用法?Java JsonDeserialize怎么用?Java JsonDeserialize使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JsonDeserialize类属于com.fasterxml.jackson.databind.annotation包,在下文中一共展示了JsonDeserialize类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: propertyField

import com.fasterxml.jackson.databind.annotation.JsonDeserialize; //导入依赖的package包/类
@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());
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:Jackson2Annotator.java

示例2: PublicKeyMirrorCredential

import com.fasterxml.jackson.databind.annotation.JsonDeserialize; //导入依赖的package包/类
@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");
}
 
开发者ID:line,项目名称:centraldogma,代码行数:21,代码来源:PublicKeyMirrorCredential.java

示例3: MultipleMirrorConfig

import com.fasterxml.jackson.databind.annotation.JsonDeserialize; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:line,项目名称:centraldogma,代码行数:25,代码来源:DefaultMetaRepository.java

示例4: AddJvmRequest

import com.fasterxml.jackson.databind.annotation.JsonDeserialize; //导入依赖的package包/类
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;
}
 
开发者ID:dmart28,项目名称:gcplot,代码行数:18,代码来源:AddJvmRequest.java

示例5: jacksonAnnotationAddedWithImplicitName

import com.fasterxml.jackson.databind.annotation.JsonDeserialize; //导入依赖的package包/类
@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");
}
 
开发者ID:google,项目名称:FreeBuilder,代码行数:17,代码来源:JacksonSupportTest.java

示例6: jsonAnyGetterAnnotationDisablesImplicitProperty

import com.fasterxml.jackson.databind.annotation.JsonDeserialize; //导入依赖的package包/类
@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();
}
 
开发者ID:google,项目名称:FreeBuilder,代码行数:17,代码来源:JacksonSupportTest.java

示例7: shouldCreateByteArrayFieldWithAnyEncoding

import com.fasterxml.jackson.databind.annotation.JsonDeserialize; //导入依赖的package包/类
@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());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:MediaIT.java

示例8: propertyField

import com.fasterxml.jackson.databind.annotation.JsonDeserialize; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:MediaIT.java

示例9: noAnnotationsWorks

import com.fasterxml.jackson.databind.annotation.JsonDeserialize; //导入依赖的package包/类
@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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:ObjectMappedTest.java

示例10: setWithin

import com.fasterxml.jackson.databind.annotation.JsonDeserialize; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:dbmdz,项目名称:iiif-apis,代码行数:14,代码来源:SearchResult.java

示例11: PasswordMirrorCredential

import com.fasterxml.jackson.databind.annotation.JsonDeserialize; //导入依赖的package包/类
@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");
}
 
开发者ID:line,项目名称:centraldogma,代码行数:12,代码来源:PasswordMirrorCredential.java

示例12: CreateSessionCommand

import com.fasterxml.jackson.databind.annotation.JsonDeserialize; //导入依赖的package包/类
@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");
}
 
开发者ID:line,项目名称:centraldogma,代码行数:11,代码来源:CreateSessionCommand.java

示例13: create

import com.fasterxml.jackson.databind.annotation.JsonDeserialize; //导入依赖的package包/类
@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();
}
 
开发者ID:spotify,项目名称:bazel-tools,代码行数:8,代码来源:Dependencies.java

示例14: getIncidentsPaged

import com.fasterxml.jackson.databind.annotation.JsonDeserialize; //导入依赖的package包/类
@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;
}
 
开发者ID:Azure,项目名称:CityPower-Build-Sample,代码行数:14,代码来源:IncidentServiceImpl.java

示例15: Rule

import com.fasterxml.jackson.databind.annotation.JsonDeserialize; //导入依赖的package包/类
@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;
}
 
开发者ID:spring-projects,项目名称:spring-vault,代码行数:16,代码来源:Policy.java


注:本文中的com.fasterxml.jackson.databind.annotation.JsonDeserialize类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。