下面列出了com.fasterxml.jackson.databind.annotation.JsonDeserialize#com.fasterxml.jackson.annotation.JsonCreator 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@JsonCreator
public PhotoModel(
@JsonProperty("title") String title,
@JsonProperty("fetchableUrl") String fetchableUrl,
@JsonProperty("description") String description,
@JsonProperty("mediaType") String mediaType,
@JsonProperty("dataId") String dataId,
@JsonProperty("albumId") String albumId,
@JsonProperty("inTempStore") boolean inTempStore) {
this.title = title;
this.fetchableUrl = fetchableUrl;
this.description = description;
this.mediaType = mediaType;
if (dataId == null || dataId.isEmpty()) {
throw new IllegalArgumentException("dataID must be set");
}
this.dataId = dataId;
this.albumId = albumId;
this.inTempStore = inTempStore;
}
@Builder
@JsonCreator
private JSONNotificationTarget(
@JsonProperty("targetType") @NonNull final UserNotificationTargetType targetType,
@JsonProperty("windowId") final String windowId,
@JsonProperty("documentId") final String documentId,
@JsonProperty("viewId") final String viewId)
{
this.targetType = targetType;
this.windowId = windowId;
this.documentType = windowId;
this.documentId = documentId;
this.viewId = viewId;
}
@JsonCreator
public ModelPath(
@JsonProperty("id") String id,
@JsonProperty("pathMembers") List<ModelPathStep> pathMembers) {
this.id = id;
this.pathMembers = pathMembers;
boolean assignedRootId = false;
for (int i = 0; i < this.pathMembers.size(); i++) {
ModelPathStep member = pathMembers.get(i);
if (member.getIsRootId()) {
if (assignedRootId) {
throw new RuntimeException("should only have one root id declared, check " + member.toString());
} else {
this.rootIdIndex = i;
assignedRootId = true;
}
}
}
if (!assignedRootId) {
throw new IllegalStateException("ModelPath must have a root id.");
}
}
@JsonCreator
private static @Nonnull AutocompleteSuggestion create(
@Nullable @JsonProperty(PROP_TEXT) String text,
@Nullable @JsonProperty(PROP_SUGGESTION_TYPE) SuggestionType suggestionType,
@JsonProperty(PROP_IS_PARTIAL) boolean isPartial,
@Nullable @JsonProperty(PROP_DESCRIPTION) String description,
@JsonProperty(PROP_RANK) int rank,
@JsonProperty(PROP_INSERTION_INDEX) int insertionIndex,
@Nullable @JsonProperty(PROP_HINT) String hint) {
return new AutocompleteSuggestion(
firstNonNull(text, ""),
firstNonNull(suggestionType, SuggestionType.UNKNOWN),
isPartial,
description,
rank,
insertionIndex,
hint);
}
@JsonCreator
public static RegistryConfigs create(final Map<String, RegistryAuth> configs) {
if (configs == null) {
return empty();
}
// need to add serverAddress to each RegistryAuth instance; it is not available when
// Jackson is deserializing the RegistryAuth field
final Map<String, RegistryAuth> transformedMap = Maps.transformEntries(configs,
new Maps.EntryTransformer<String, RegistryAuth, RegistryAuth>() {
@Override
public RegistryAuth transformEntry(final String key, final RegistryAuth value) {
if (value == null) {
return null;
}
if (value.serverAddress() == null) {
return value.toBuilder()
.serverAddress(key)
.build();
}
return value;
}
});
return builder().configs(transformedMap).build();
}
@JsonCreator
public BlockData(
@JsonProperty("number") final Optional<String> number,
@JsonProperty("parentHash") final Optional<String> parentHash,
@JsonProperty("coinbase") final Optional<String> coinbase,
@JsonProperty("extraData") final Optional<String> extraData,
@JsonProperty("transactions") final List<TransactionData> transactions) {
this.number = number.map(UInt256::fromHexString).map(UInt256::toLong);
this.parentHash = parentHash.map(Bytes32::fromHexString).map(Hash::wrap);
this.coinbase = coinbase.map(Address::fromHexString);
this.extraData = extraData.map(Bytes::fromHexStringLenient);
this.transactionData = transactions;
}
@JsonCreator
static Container create(
@JsonProperty("Id") final String id,
@JsonProperty("Names") final List<String> names,
@JsonProperty("Image") final String image,
@JsonProperty("ImageID") final String imageId,
@JsonProperty("Command") final String command,
@JsonProperty("Created") final Long created,
@JsonProperty("State") final String state,
@JsonProperty("Status") final String status,
@JsonProperty("Ports") final List<PortMapping> ports,
@JsonProperty("Labels") final Map<String, String> labels,
@JsonProperty("SizeRw") final Long sizeRw,
@JsonProperty("SizeRootFs") final Long sizeRootFs,
@JsonProperty("NetworkSettings") final NetworkSettings networkSettings,
@JsonProperty("Mounts") final List<ContainerMount> mounts) {
final ImmutableMap<String, String> labelsT = labels == null
? null : ImmutableMap.copyOf(labels);
final ImmutableList<ContainerMount> mountsT = mounts == null
? null : ImmutableList.copyOf(mounts);
final ImmutableList<String> namesT = names == null
? null : ImmutableList.copyOf(names);
final ImmutableList<PortMapping> portsT = ports == null
? null : ImmutableList.copyOf(ports);
return new AutoValue_Container(id, namesT, image, imageId, command,
created, state, status, portsT, labelsT, sizeRw,
sizeRootFs, networkSettings, mountsT);
}
@JsonCreator
public MergeJoinPOP(
@JsonProperty("left") PhysicalOperator left,
@JsonProperty("right") PhysicalOperator right,
@JsonProperty("conditions") List<JoinCondition> conditions,
@JsonProperty("joinType") JoinRelType joinType
) {
super(left, right, joinType, false, null, conditions);
Preconditions.checkArgument(joinType != null, "Join type is missing!");
Preconditions.checkArgument(joinType != JoinRelType.FULL,
"Full outer join not currently supported with Merge Join");
}
@JsonCreator
public NotePatchInput(@JsonProperty("title") String title,
@JsonProperty("body") String body, @JsonProperty("tags") List<URI> tagUris) {
this.title = title;
this.body = body;
this.tagUris = tagUris == null ? Collections.<URI>emptyList() : tagUris;
}
@JsonCreator
public static StatusEnum fromValue(String value) {
for (StatusEnum b : StatusEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
@JsonCreator
static Driver create(
@JsonProperty("Name") final String name,
@JsonProperty("Options") final Map<String, String> options) {
final Builder builder = builder()
.name(name);
if (options != null) {
builder.options(options);
}
return builder.build();
}
@JsonCreator
protected DefaultResourceSpec(
@JsonProperty("name") String name,
@JsonProperty("value") Protos.Value value,
@JsonProperty("role") String role,
@JsonProperty("pre-reserved-role") String preReservedRole,
@JsonProperty("principal") String principal)
{
this.name = name;
this.value = value;
this.role = role;
this.preReservedRole = preReservedRole == null ? Constants.ANY_ROLE : preReservedRole;
this.principal = principal;
}
@JsonCreator
@Nonnull
private static If jsonCreator(
@Nullable @JsonProperty(PROP_ACTIONS) List<Statement> actions,
@Nullable @JsonProperty(PROP_TRUE_STATEMENTS) BoolExpr matchCondition) {
checkArgument(matchCondition != null, "Missing %s", PROP_TRUE_STATEMENTS);
return new If(matchCondition, firstNonNull(actions, ImmutableList.of()));
}
@JsonCreator
public static ParameterType build(String type) {
final ParameterType paramType = new ParameterType();
paramType.setType(type);
return paramType;
}
@JsonCreator
public static EnumNumberEnum fromValue(Double value) {
for (EnumNumberEnum b : EnumNumberEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
@JsonCreator
public SingularityPortMapping(
@JsonProperty("hostPort") int hostPort,
@JsonProperty("containerPort") int containerPort,
@JsonProperty("protocol") Optional<String> protocol
) {
this.hostPort = hostPort;
this.containerPort = containerPort;
this.protocol = protocol;
}
@JsonCreator
public IntervalParameters(
@JsonProperty("sets") Set<IntervalSet> sets,
@JsonProperty("intervals") List<Interval> intervals)
{
this.sets = sets;
this.intervals = intervals;
}
@JsonCreator
public IcebergTableProps(
@JsonProperty("tableLocation") String tableLocation,
@JsonProperty("uuid") String uuid,
@JsonProperty("fullSchema") BatchSchema fullSchema,
@JsonProperty("partitionColumnNames") List<String> partitionColumnNames,
@JsonProperty("icebergOpType") IcebergOperation.Type icebergOpType
) {
this.tableLocation = tableLocation;
this.uuid = uuid;
this.fullSchema = fullSchema;
this.partitionColumnNames = partitionColumnNames;
this.icebergOpType = icebergOpType;
}
@JsonCreator
public static EJAnswers factory(final String json) {
try {
return new ObjectMapper().readValue(json, EJAnswers.class);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
@JsonCreator
public ProtocolFactory(
@JsonProperty("type") String type, @JsonProperty("host") String host,
@JsonProperty("port") Integer port,
@JsonProperty("receiveBufferSize") Integer receiveBufferSize
) {
this.type = type;
this.host = host;
this.port = port;
this.receiveBufferSize = receiveBufferSize;
}
@JsonCreator
public DailyReport(@JsonProperty("atTime") long atTime,
@JsonProperty("durationType") ReportDurationType durationType,
@JsonProperty("startTs") long startTs,
@JsonProperty("endTs")long endTs) {
this.atTime = atTime;
this.durationType = durationType;
this.startTs = startTs;
this.endTs = endTs;
}
@JsonCreator
public L1Handle(@JsonProperty("handle") int handle,
@JsonProperty("l2_handle") int l2handle,
@JsonProperty("rid") int rid) {
this.handle = handle;
this.l2handle = l2handle;
this.rid = rid;
}
@JsonCreator
public static EnumNumberEnum fromValue(Double value) {
for (EnumNumberEnum b : EnumNumberEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
@JsonCreator
public static InnerEnum fromValue(String value) {
for (InnerEnum b : InnerEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
@JsonCreator
public Endpoint(@JsonProperty("cluster") String cluster ,
@JsonProperty("tls") boolean tls,
@JsonProperty("url") URI url,
@JsonProperty("scope") String scope,
@JsonProperty("routingMethod") RoutingMethod routingMethod) {
this.cluster = cluster;
this.tls = tls;
this.url = url;
this.scope = scope;
this.routingMethod = routingMethod;
}
@JsonCreator
public static ImportCount create(
@JsonProperty(IMPORTED) Integer imported,
@JsonProperty(UPDATED) Integer updated,
@JsonProperty(DELETED) Integer deleted,
@JsonProperty(IGNORED) Integer ignored) {
return new AutoValue_ImportCount(imported, updated, deleted, ignored);
}
@JsonCreator
public static EnumFormStringEnum fromValue(String value) {
for (EnumFormStringEnum b : EnumFormStringEnum.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
@JsonCreator
public TimestampSpec(
@JsonProperty("column") String timestampColumn,
@JsonProperty("format") String format,
// this value should never be set for production data
@JsonProperty("missingValue") DateTime missingValue
)
{
this.timestampColumn = (timestampColumn == null) ? DEFAULT_COLUMN : timestampColumn;
this.timestampFormat = format == null ? DEFAULT_FORMAT : format;
this.timestampConverter = TimestampParser.createObjectTimestampParser(timestampFormat);
this.missingValue = missingValue == null
? DEFAULT_MISSING_VALUE
: missingValue;
}
@JsonCreator
public SingularityRequestWithState(
@JsonProperty("request") SingularityRequest request,
@JsonProperty("state") RequestState state,
@JsonProperty("timestamp") long timestamp
) {
this.request = request;
this.state = state;
this.timestamp = timestamp;
}
@JsonCreator
private static @Nonnull MinorIssueConfig create(
@JsonProperty(PROP_MINOR_ISSUE) @Nullable String minorIssue,
@JsonProperty(PROP_SEVERITY) @Nullable Integer severity,
@JsonProperty(PROP_URL) @Nullable String url) {
return new MinorIssueConfig(
requireNonNull(minorIssue, "'minorIssue' cannot be null"), severity, url);
}