com.fasterxml.jackson.annotation.JsonCreator Java Examples
The following examples show how to use
com.fasterxml.jackson.annotation.JsonCreator.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AutocompleteSuggestion.java From batfish with Apache License 2.0 | 7 votes |
@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); }
Example #2
Source File: JSONNotificationTarget.java From metasfresh-webui-api-legacy with GNU General Public License v3.0 | 6 votes |
@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; }
Example #3
Source File: ModelPath.java From tasmo with Apache License 2.0 | 6 votes |
@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."); } }
Example #4
Source File: PhotoModel.java From data-transfer-project with Apache License 2.0 | 6 votes |
@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; }
Example #5
Source File: RegistryConfigs.java From docker-client with Apache License 2.0 | 6 votes |
@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(); }
Example #6
Source File: MapTest.java From openapi-generator with Apache License 2.0 | 5 votes |
@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 + "'"); }
Example #7
Source File: InlineObject2.java From openapi-generator with Apache License 2.0 | 5 votes |
@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 + "'"); }
Example #8
Source File: EnumTest.java From openapi-generator with Apache License 2.0 | 5 votes |
@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 + "'"); }
Example #9
Source File: BlockData.java From besu with Apache License 2.0 | 5 votes |
@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; }
Example #10
Source File: DailyReport.java From blynk-server with GNU General Public License v3.0 | 5 votes |
@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; }
Example #11
Source File: ProtocolFactory.java From ffwd with Apache License 2.0 | 5 votes |
@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; }
Example #12
Source File: EJAnswers.java From NLIWOD with GNU Affero General Public License v3.0 | 5 votes |
@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; } }
Example #13
Source File: EnumTest.java From openapi-generator with Apache License 2.0 | 5 votes |
@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 + "'"); }
Example #14
Source File: Order.java From openapi-generator with Apache License 2.0 | 5 votes |
@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 + "'"); }
Example #15
Source File: ParameterType.java From eventeum with Apache License 2.0 | 5 votes |
@JsonCreator public static ParameterType build(String type) { final ParameterType paramType = new ParameterType(); paramType.setType(type); return paramType; }
Example #16
Source File: Driver.java From docker-client with Apache License 2.0 | 5 votes |
@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(); }
Example #17
Source File: NotePatchInput.java From restdocs-wiremock with Apache License 2.0 | 5 votes |
@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; }
Example #18
Source File: InstanceInformation.java From vespa with Apache License 2.0 | 5 votes |
@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; }
Example #19
Source File: ImportCount.java From dhis2-android-sdk with BSD 3-Clause "New" or "Revised" License | 5 votes |
@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); }
Example #20
Source File: Bmv2PreJsonGroups.java From onos with Apache License 2.0 | 5 votes |
@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; }
Example #21
Source File: TimestampSpec.java From druid-api with Apache License 2.0 | 5 votes |
@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; }
Example #22
Source File: SingularityRequestWithState.java From Singularity with Apache License 2.0 | 5 votes |
@JsonCreator public SingularityRequestWithState( @JsonProperty("request") SingularityRequest request, @JsonProperty("state") RequestState state, @JsonProperty("timestamp") long timestamp ) { this.request = request; this.state = state; this.timestamp = timestamp; }
Example #23
Source File: MinorIssueConfig.java From batfish with Apache License 2.0 | 5 votes |
@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); }
Example #24
Source File: EventEnvelope.java From cqrs-eventsourcing-kafka with Apache License 2.0 | 5 votes |
@JsonCreator public EventEnvelope( @JsonProperty("eventType") String eventType, @JsonProperty("eventData") Map eventData, @JsonProperty("timestamp") LocalDateTime timestamp) { this.eventType = eventType; this.eventData = eventData; this.timestamp = timestamp; }
Example #25
Source File: EthereumTableLayoutHandle.java From presto-ethereum with Apache License 2.0 | 5 votes |
@JsonCreator public EthereumTableLayoutHandle( @JsonProperty("table") EthereumTableHandle table, @JsonProperty("blockRanges") List<EthereumBlockRange> blockRanges ) { this.table = requireNonNull(table, "table is null"); this.blockRanges = requireNonNull(blockRanges, "blockRanges is null"); }
Example #26
Source File: FieldDescriptor.java From Bats with Apache License 2.0 | 5 votes |
@JsonCreator public FieldDescriptor( @JsonProperty("name") String name, @JsonProperty("descriptor") String descriptor, @JsonProperty("annotations") List<AnnotationDescriptor> annotations) { this.name = name; this.descriptor = descriptor; this.annotations = annotations; this.annotationMap = AnnotationDescriptor.buildAnnotationsMap(annotations); // validate the descriptor getType(); }
Example #27
Source File: DefinableConfig.java From pampas with Apache License 2.0 | 5 votes |
@JsonCreator public static ConfigLevelEnum getEnum(String value) { for (ConfigLevelEnum anEnum : values()) { if (anEnum.getValue().equals(value)) { return anEnum; } } throw new IllegalArgumentException("不合法的数据:" + value); }
Example #28
Source File: EnterInputIfaceStep.java From batfish with Apache License 2.0 | 5 votes |
@JsonCreator private static EnterInputIfaceStepDetail jsonCreator( @JsonProperty(PROP_INPUT_INTERFACE) @Nullable NodeInterfacePair inputInterface, @JsonProperty(PROP_INPUT_VRF) @Nullable String inputVrf) { checkArgument(inputInterface != null, "Input interface should be set"); return new EnterInputIfaceStepDetail(inputInterface, inputVrf); }
Example #29
Source File: NeighborIsAsPath.java From batfish with Apache License 2.0 | 5 votes |
@JsonCreator private static NeighborIsAsPath jsonCreator( @Nullable @JsonProperty(PROP_EXACT) Boolean exact, @Nullable @JsonProperty(PROP_RANGE) List<SubRangeExpr> range) { checkArgument(exact != null, "%s must be provided", PROP_EXACT); return new NeighborIsAsPath(firstNonNull(range, ImmutableList.of()), exact); }
Example #30
Source File: SampleDTO.java From newts with Apache License 2.0 | 5 votes |
@JsonCreator public SampleDTO(@JsonProperty("timestamp") long timestamp, @JsonProperty("resource") ResourceDTO resource, @JsonProperty("name") String name, @JsonProperty("type") MetricType type, @JsonProperty("value") Number value, @JsonProperty("attributes") Map<String, String> attributes, @JsonProperty("context") String context) { m_timestamp = checkNotNull(timestamp, "m_timestamp argument"); m_resource = checkNotNull(resource, "m_resource argument"); m_name = checkNotNull(name, "m_name argument"); m_type = checkNotNull(type, "m_type argument"); m_value = checkNotNull(value, "m_value argument"); m_attributes = attributes; m_context = context != null ? new Context(context) : Context.DEFAULT_CONTEXT; }