下面列出了怎么用com.fasterxml.jackson.databind.annotation.JsonDeserialize的API类实例代码及写法,或者点击链接到github查看源代码。
public VerifyServiceProviderConfiguration(
@JsonProperty("serviceEntityIds") @NotNull @Size(min = 1, message = NOT_EMPTY_MESSAGE) @Valid List<String> serviceEntityIds,
@JsonProperty("hashingEntityId") @Valid String hashingEntityId,
@JsonProperty("verifyHubConfiguration") @NotNull @Valid VerifyHubConfiguration verifyHubConfiguration,
@JsonProperty("samlSigningKey") @NotNull @Valid @JsonDeserialize(using = PrivateKeyDeserializer.class) PrivateKey samlSigningKey,
@JsonProperty("samlPrimaryEncryptionKey") @NotNull @Valid @JsonDeserialize(using = PrivateKeyDeserializer.class) PrivateKey samlPrimaryEncryptionKey,
@JsonProperty("samlSecondaryEncryptionKey") @Valid @JsonDeserialize(using = PrivateKeyDeserializer.class) PrivateKey samlSecondaryEncryptionKey,
@JsonProperty("msaMetadata") @NotNull @UnwrapValidatedValue @Valid Optional<MsaMetadataConfiguration> msaMetadata,
@JsonProperty("clockSkew") @NotNull @Valid Duration clockSkew,
@JsonProperty("europeanIdentity") @Valid @UnwrapValidatedValue Optional<EuropeanIdentityConfiguration> europeanIdentity) {
this.serviceEntityIds = serviceEntityIds;
this.hashingEntityId = hashingEntityId;
this.verifyHubConfiguration = verifyHubConfiguration;
this.samlSigningKey = samlSigningKey;
this.samlPrimaryEncryptionKey = samlPrimaryEncryptionKey;
this.samlSecondaryEncryptionKey = samlSecondaryEncryptionKey;
this.msaMetadata = msaMetadata;
this.clockSkew = clockSkew;
this.europeanIdentity = europeanIdentity;
this.europeanIdentity.ifPresent(eid -> eid.setEnvironment(verifyHubConfiguration.getHubEnvironment()));
}
private CoinbaseOrderInfo(
@JsonProperty("id") final String id,
@JsonProperty("created_at") @JsonDeserialize(using = ISO8601DateDeserializer.class)
final Date createdAt,
@JsonProperty("status") final CoinbaseOrderStatus status,
@JsonProperty("total_btc") @JsonDeserialize(using = CoinbaseCentsDeserializer.class)
final CoinbaseMoney totalBTC,
@JsonProperty("total_native") @JsonDeserialize(using = CoinbaseCentsDeserializer.class)
final CoinbaseMoney totalNative,
@JsonProperty("custom") final String custom,
@JsonProperty("receive_address") final String receiveAddress,
@JsonProperty("button") final CoinbaseButtonInfo button,
@JsonProperty("transaction") final CoinbaseOrderTransaction transaction) {
this.id = id;
this.createdAt = createdAt;
this.status = status;
this.totalBTC = totalBTC;
this.totalNative = totalNative;
this.custom = custom;
this.receiveAddress = receiveAddress;
this.button = new CoinbaseButton(button);
this.transaction = transaction;
}
private CoinbaseTransactionInfoResult(
@JsonProperty("id") final String id,
@JsonProperty("created_at") @JsonDeserialize(using = ISO8601DateDeserializer.class)
final Date createdAt,
@JsonProperty("amount") final CoinbaseMoney amount,
@JsonProperty("request") final boolean request,
@JsonProperty("status") final CoinbaseTransactionStatus status,
@JsonProperty("sender") final CoinbaseUserInfo sender,
@JsonProperty("recipient") final CoinbaseUserInfo recipient,
@JsonProperty("recipient_address") final String recipientAddress,
@JsonProperty("notes") final String notes,
@JsonProperty("hsh") final String transactionHash,
@JsonProperty("idem") final String idempotencyKey) {
this.id = id;
this.createdAt = createdAt;
this.amount = amount;
this.request = request;
this.status = status;
this.sender = new CoinbaseUser(sender);
this.recipient = new CoinbaseUser(recipient);
this.recipientAddress = recipientAddress;
this.notes = notes;
this.transactionHash = transactionHash;
this.idempotencyKey = idempotencyKey;
}
private CoinbaseAccountChange(
@JsonProperty("id") final String id,
@JsonProperty("created_at") @JsonDeserialize(using = ISO8601DateDeserializer.class)
final Date createdAt,
@JsonProperty("transaction_id") final String transactionId,
@JsonProperty("confirmed") final boolean confirmed,
@JsonProperty("cache") final CoinbaseCache cache,
@JsonProperty("amount") final CoinbaseMoney amount) {
this.id = id;
this.createdAt = createdAt;
this.transactionId = transactionId;
this.confirmed = confirmed;
this.cache = cache;
this.amount = amount;
}
@JsonCreator
public PublicKeyMirrorCredential(@JsonProperty("id") @Nullable String id,
@JsonProperty("hostnamePatterns") @Nullable
@JsonDeserialize(contentAs = Pattern.class)
Iterable<Pattern> hostnamePatterns,
@JsonProperty("username") String username,
@JsonProperty("publicKey") String publicKey,
@JsonProperty("privateKey") String privateKey,
@JsonProperty("passphrase") @Nullable String passphrase) {
super(id, 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");
}
@JsonCreator
public LogsQuery(
@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY) @JsonProperty("address")
final List<Address> addresses,
@JsonDeserialize(using = TopicsDeserializer.class) @JsonProperty("topics")
final List<List<LogTopic>> topics) {
// Ordinarily this defensive copy wouldn't be surprising, style wise it should be an immutable
// collection. However, the semantics of the Ethereum JSON-RPC APIs ascribe meaning to a null
// value in lists for logs queries. We need to proactively put the values into a collection
// that won't throw a null pointer exception when checking to see if the list contains null.
// List.of(...) is one of the lists that reacts poorly to null member checks and is something
// that we should expect to see passed in. So we must copy into a null-tolerant list.
this.addresses = addresses != null ? new ArrayList<>(addresses) : emptyList();
this.topics =
topics != null
? topics.stream().map(ArrayList::new).collect(Collectors.toList())
: emptyList();
this.addressBlooms =
this.addresses.stream()
.map(address -> LogsBloomFilter.builder().insertBytes(address).build())
.collect(toUnmodifiableList());
this.topicsBlooms =
this.topics.stream()
.map(
subTopics ->
subTopics.stream()
.filter(Objects::nonNull)
.map(logTopic -> LogsBloomFilter.builder().insertBytes(logTopic).build())
.collect(Collectors.toList()))
.collect(toUnmodifiableList());
}
/**
* Get the RSA Private Key Parameter value.
*
* @return the RSA Private Key Parameter value.
*/
@JsonProperty("dq")
@JsonSerialize(using = Base64UrlJsonSerializer.class)
@JsonDeserialize(using = Base64UrlJsonDeserializer.class)
public byte[] dq() {
return this.dq;
}
@JsonProperty
@JsonSerialize(keyUsing = ColumnStatisticMetadataKeySerializer.class)
@JsonDeserialize(keyUsing = ColumnStatisticMetadataKeyDeserializer.class)
public Map<ColumnStatisticMetadata, T> getColumnStatistics()
{
return columnStatistics;
}
@SuppressWarnings("unused")
@JsonDeserialize(using = RawDeserializer.class)
@JsonProperty("features")
public void _setFeatures(Object features) {
if (features instanceof String) {
this.features = new LazyParsable<>((String) features);
} else if (features instanceof List) {
this.features = new LazyParsable<>();
//noinspection unchecked
this.features.set((List<Feature>) features);
}
}
/**
* Get the y value.
*
* @return the y value
*/
@JsonProperty("y")
@JsonSerialize(using = Base64UrlJsonSerializer.class)
@JsonDeserialize(using = Base64UrlJsonDeserializer.class)
public byte[] y() {
return this.y;
}
@JsonCreator
private ImportOperation(@JsonProperty("type") final String type,
@JsonProperty("id") final UUID id,
@JsonProperty("creationTime") final Instant creationTime,
@JsonProperty("state") final State state,
@JsonProperty("failureCause") final Throwable failureCause,
@JsonProperty("progress") final float progress,
@JsonProperty("startTime") final Instant startTime,
@JsonProperty("keyspace") final String keyspace,
@JsonProperty("table") final String table,
@JsonProperty("keepLevel") final boolean keepLevel,
@JsonProperty("noVerify") final boolean noVerify,
@JsonProperty("noVerifyTokens") final boolean noVerifyTokens,
@JsonProperty("noInvalidateCaches") final boolean noInvalidateCaches,
@JsonProperty("quick") final boolean quick,
@JsonProperty("extendedVerify") final boolean extendedVerify,
@NotNull
@JsonProperty("sourceDir")
@JsonDeserialize(using = NioPathDeserializer.class)
@JsonSerialize(using = NioPathSerializer.class) final Path sourceDir) {
super(type,
id,
creationTime,
state,
failureCause,
progress,
startTime,
new ImportOperationRequest(type,
keyspace,
table,
keepLevel,
noVerify,
noVerifyTokens,
noInvalidateCaches,
quick,
extendedVerify,
sourceDir));
this.cassandraJMXService = null;
this.cassandraVersion = null;
}
@JsonCreator
public ImportOperationRequest(@JsonProperty("type") final String type,
@JsonProperty("keyspace") final String keyspace,
@JsonProperty("table") final String table,
@JsonProperty("keepLevel") final boolean keepLevel,
@JsonProperty("noVerify") final boolean noVerify,
@JsonProperty("noVerifyTokens") final boolean noVerifyTokens,
@JsonProperty("noInvalidateCaches") final boolean noInvalidateCaches,
@JsonProperty("quick") final boolean quick,
@JsonProperty("extendedVerify") final boolean extendedVerify,
@NotNull
@JsonProperty("sourceDir")
@JsonDeserialize(using = NioPathDeserializer.class)
@JsonSerialize(using = NioPathSerializer.class) final Path sourceDir) {
this.keyspace = keyspace;
this.table = table;
this.keepLevel = keepLevel;
this.noVerify = noVerify;
this.noVerifyTokens = noVerifyTokens;
this.noInvalidateCaches = noInvalidateCaches;
this.quick = quick;
this.extendedVerify = extendedVerify;
this.sourceDir = sourceDir;
this.type = "import";
if (quick) {
quickImport();
}
}
@JsonCreator
private BackupOperation(@JsonProperty("type") final String type,
@JsonProperty("id") final UUID id,
@JsonProperty("creationTime") final Instant creationTime,
@JsonProperty("state") final State state,
@JsonProperty("failureCause") final Throwable failureCause,
@JsonProperty("progress") final float progress,
@JsonProperty("startTime") final Instant startTime,
@JsonProperty("storageLocation") final StorageLocation storageLocation,
@JsonProperty("duration") final Time duration,
@JsonProperty("bandwidth") final DataRate bandwidth,
@JsonProperty("concurrentConnections") final Integer concurrentConnections,
@JsonProperty("lockFile") final Path lockFile,
@JsonProperty("cassandraDirectory") final Path cassandraDirectory,
@JsonProperty("entities")
@JsonSerialize(using = DatabaseEntitiesSerializer.class)
@JsonDeserialize(using = DatabaseEntitiesDeserializer.class) final DatabaseEntities entities,
@JsonProperty("snapshotTag") final String snapshotTag,
@JsonProperty("k8sNamespace") final String k8sNamespace,
@JsonProperty("k8sSecretName") final String k8sBackupSecretName,
@JsonProperty("globalRequest") final boolean globalRequest,
@JsonProperty("dc") final String dc) {
super(type, id, creationTime, state, failureCause, progress, startTime, new BackupOperationRequest(type,
storageLocation,
duration,
bandwidth,
concurrentConnections,
lockFile,
cassandraDirectory,
entities,
snapshotTag,
k8sNamespace,
k8sBackupSecretName,
globalRequest,
dc));
coordinator = null;
}
/**
* Get the e value.
*
* @return the e value
*/
@JsonProperty("e")
@JsonSerialize(using = Base64UrlJsonSerializer.class)
@JsonDeserialize(using = Base64UrlJsonDeserializer.class)
public byte[] e() {
return this.e;
}
/**
* Get the RSA Private Key Parameter value.
*
* @return the RSA Private Key Parameter value.
*/
@JsonProperty("dp")
@JsonSerialize(using = Base64UrlJsonSerializer.class)
@JsonDeserialize(using = Base64UrlJsonDeserializer.class)
public byte[] dp() {
return this.dp;
}
/**
* Get HSM Token value, used with Bring Your Own Key.
*
* @return HSM Token, used with Bring Your Own Key.
*/
@JsonProperty("key_hsm")
@JsonSerialize(using = Base64UrlJsonSerializer.class)
@JsonDeserialize(using = Base64UrlJsonDeserializer.class)
public byte[] t() {
return this.t;
}
/**
* Get the n value.
*
* @return the n value
*/
@JsonProperty("n")
@JsonSerialize(using = Base64UrlJsonSerializer.class)
@JsonDeserialize(using = Base64UrlJsonDeserializer.class)
public byte[] n() {
return this.n;
}
/**
* Constructor
*
* @param calls
* @param timeSpan
* @param timeUnit
*/
public RateLimit(
@JsonProperty("calls") int calls,
@JsonProperty("time_span") int timeSpan,
@JsonProperty("time_unit") @JsonDeserialize(using = TimeUnitDeserializer.class)
TimeUnit timeUnit) {
this.calls = calls;
this.timeUnit = timeUnit;
this.timeSpan = timeSpan;
}
private CoinbaseSubscriptionInfo(
@JsonProperty("id") final String id,
@JsonProperty("created_at") @JsonDeserialize(using = ISO8601DateDeserializer.class)
final Date createdAt,
@JsonProperty("status") final CoinbaseRecurringPaymentStatus status,
@JsonProperty("custom") final String custom,
@JsonProperty("button") final CoinbaseButtonInfo button) {
this.id = id;
this.createdAt = createdAt;
this.status = status;
this.custom = custom;
this.button = new CoinbaseButton(button);
}
private CoinbaseAddress(
@JsonProperty("address") final String address,
@JsonProperty("callback_url") final String callbackUrl,
@JsonProperty("label") final String label,
@JsonProperty("created_at") @JsonDeserialize(using = ISO8601DateDeserializer.class)
final Date createdAt,
@JsonProperty("success") final boolean success,
@JsonProperty("errors") final List<String> errors) {
super(success, errors);
this.address = address;
this.callbackUrl = callbackUrl;
this.label = label;
this.createdAt = createdAt;
}
private CoinbaseUserInfo(
@JsonProperty("id") final String id,
@JsonProperty("email") final String email,
@JsonProperty("name") final String name,
@JsonProperty("password") final String password,
@JsonProperty("receive_address") final String receiveAddress,
@JsonProperty("referrer_id") final String referrerId,
@JsonProperty("time_zone") final String timeZone,
@JsonProperty("balance") @JsonDeserialize(using = CoinbaseMoneyDeserializer.class)
final CoinbaseMoney balance,
@JsonProperty("native_currency") final String nativeCurrency,
@JsonProperty("buy_level") final CoinbaseBuySellLevel buyLevel,
@JsonProperty("sell_level") final CoinbaseBuySellLevel sellLevel,
@JsonProperty("buy_limit") @JsonDeserialize(using = CoinbaseMoneyDeserializer.class)
final CoinbaseMoney buyLimit,
@JsonProperty("sell_limit") @JsonDeserialize(using = CoinbaseMoneyDeserializer.class)
final CoinbaseMoney sellLimit,
@JsonProperty("pin") final String pin,
@JsonProperty("merchant") final CoinbaseMerchant merchant) {
this.id = id;
this.email = email;
this.name = name;
this.password = password;
this.receiveAddress = receiveAddress;
this.referrerId = referrerId;
this.timeZone = timeZone;
this.balance = balance;
this.nativeCurrency = nativeCurrency;
this.buyLevel = buyLevel;
this.sellLevel = sellLevel;
this.buyLimit = buyLimit;
this.sellLimit = sellLimit;
this.pin = pin;
this.merchant = merchant;
}
private CoinbaseRecurringPaymentInfo(
@JsonProperty("id") final String id,
@JsonProperty("type") final CoinbaseRecurringPaymentType type,
@JsonProperty("status") final CoinbaseRecurringPaymentStatus status,
@JsonProperty("created_at") @JsonDeserialize(using = ISO8601DateDeserializer.class)
final Date createdAt,
@JsonProperty("to") final String to,
@JsonProperty("from") final String from,
@JsonProperty("start_type") final String startType,
@JsonProperty("times") final int times,
@JsonProperty("times_run") final int timesRun,
@JsonProperty("repeat") final CoinbaseRepeat repeat,
@JsonProperty("last_run") @JsonDeserialize(using = ISO8601DateDeserializer.class)
final Date lastRun,
@JsonProperty("next_run") @JsonDeserialize(using = ISO8601DateDeserializer.class)
final Date nextRun,
@JsonProperty("notes") final String notes,
@JsonProperty("description") final String description,
@JsonProperty("amount") @JsonDeserialize(using = CoinbaseMoneyDeserializer.class)
final CoinbaseMoney amount) {
this.id = id;
this.type = type;
this.status = status;
this.createdAt = createdAt;
this.to = to;
this.from = from;
this.startType = startType;
this.times = times;
this.timesRun = timesRun;
this.repeat = repeat;
this.lastRun = lastRun;
this.nextRun = nextRun;
this.notes = notes;
this.description = description;
this.amount = amount;
}
@Override
public TypeSpec.Builder classCreated(UnionPluginContext unionPluginContext, UnionTypeDeclaration ramlType, TypeSpec.Builder incoming, EventType eventType) {
ClassName deserializer = ClassName.get("", unionPluginContext.creationResult().getJavaName(EventType.INTERFACE).simpleName(), Names.typeName("deserializer"));
ClassName serializer = ClassName.get("", unionPluginContext.creationResult().getJavaName(EventType.INTERFACE).simpleName(), Names.typeName("serializer"));
createSerializer(unionPluginContext, serializer, ramlType, incoming, eventType);
createDeserializer(unionPluginContext, deserializer, ramlType, incoming, eventType);
incoming.addAnnotation(AnnotationSpec.builder(JsonDeserialize.class).addMember("using", "$T.class", deserializer).build());
incoming.addAnnotation(AnnotationSpec.builder(JsonSerialize.class).addMember("using", "$T.class", serializer).build());
return incoming;
}
/**
* Get the d value.
*
* @return the d value
*/
@JsonProperty("d")
@JsonSerialize(using = Base64UrlJsonSerializer.class)
@JsonDeserialize(using = Base64UrlJsonDeserializer.class)
public byte[] d() {
return this.d;
}
/**
* Get Symmetric key value.
*
* @return the symmetric key value.
*/
@JsonProperty("k")
@JsonSerialize(using = Base64UrlJsonSerializer.class)
@JsonDeserialize(using = Base64UrlJsonDeserializer.class)
public byte[] k() {
return this.k;
}
@JsonCreator
public ReadOnlyNetworkNodes(
@JsonProperty("url") final URI uri,
@JsonProperty("nodeURLs") List<URI> nodeURIs,
@JsonProperty("nodePKs") @JsonDeserialize(
keyUsing = PublicKeyMapKeyDeserializer.class) final Map<Bytes, URI> nodePKs) {
this.uri = uri;
this.nodePKs = new HashMap<>(nodePKs);
}
/**
* Get the x value.
*
* @return the x value
*/
@JsonProperty("x")
@JsonSerialize(using = Base64UrlJsonSerializer.class)
@JsonDeserialize(using = Base64UrlJsonDeserializer.class)
public byte[] x() {
return this.x;
}
@JsonCreator
ClientProfile(@JsonProperty(value = "name", required = true) String name,
@JsonProperty("priority") @Nullable Integer priority,
@JsonProperty("hosts") @JsonDeserialize(contentAs = Entry.class) @Nullable Set<Entry> hosts) {
this.name = requireNonNull(name, "name");
checkArgument(!name.isEmpty(), "name is empty.");
this.priority = firstNonNull(priority, 0);
this.hosts = ImmutableSet.copyOf(firstNonNull(hosts, ImmutableSet.of()));
}
/**
* Creates a new {@link Session} instance.
*
* @param id the session ID
* @param username the name of the user which belongs to this session
* @param creationTime the created time {@link Instant}
* @param expirationTime the time {@link Instant} that this session is to be expired at
* @param rawSession the serializable session object which is specific to authentication provider
*/
@JsonCreator
public Session(@JsonProperty("id") String id,
@JsonProperty("username") String username,
@JsonProperty("creationTime") Instant creationTime,
@JsonProperty("expirationTime") Instant expirationTime,
@JsonProperty("rawSession")
@JsonDeserialize(using = RawSessionJsonDeserializer.class)
@Nullable Serializable rawSession) {
this.id = requireNonNull(id, "id");
this.username = requireNonNull(username, "username");
this.creationTime = requireNonNull(creationTime, "creationTime");
this.expirationTime = requireNonNull(expirationTime, "expirationTime");
this.rawSession = rawSession;
}
/**
* Get the RSA Private Key Parameter value.
*
* @return the RSA Private Key Parameter value.
*/
@JsonProperty("qi")
@JsonSerialize(using = Base64UrlJsonSerializer.class)
@JsonDeserialize(using = Base64UrlJsonDeserializer.class)
public byte[] qi() {
return this.qi;
}