com.fasterxml.jackson.annotation.JacksonInject Java Examples

The following examples show how to use com.fasterxml.jackson.annotation.JacksonInject. 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: AnonymousIpResponse.java    From GeoIP2-java with Apache License 2.0 6 votes vote down vote up
public AnonymousIpResponse(
        @JacksonInject("ip_address") @JsonProperty("ip_address") String ipAddress,
        @JsonProperty("is_anonymous") boolean isAnonymous,
        @JsonProperty("is_anonymous_vpn") boolean isAnonymousVpn,
        @JsonProperty("is_hosting_provider") boolean isHostingProvider,
        @JsonProperty("is_public_proxy") boolean isPublicProxy,
        @JsonProperty("is_tor_exit_node") boolean isTorExitNode,
        @JacksonInject("network") @JsonProperty("network") @JsonDeserialize(using = NetworkDeserializer.class) Network network
) {
    this.isAnonymous = isAnonymous;
    this.isAnonymousVpn = isAnonymousVpn;
    this.isHostingProvider = isHostingProvider;
    this.isPublicProxy = isPublicProxy;
    this.isTorExitNode = isTorExitNode;
    this.ipAddress = ipAddress;
    this.network = network;
}
 
Example #2
Source File: DefaultCouchbaseBucketConfig.java    From java-dcp-client with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new {@link CouchbaseBucketConfig}.
 *
 * @param rev the revision of the config.
 * @param name the name of the bucket.
 * @param uri the URI for this bucket.
 * @param streamingUri the streaming URI for this bucket.
 * @param partitionInfo partition info for this bucket.
 * @param nodeInfos related node information.
 * @param portInfos port info for the nodes, including services.
 */
@JsonCreator
public DefaultCouchbaseBucketConfig(
    @JsonProperty("rev") long rev,
    @JsonProperty("uuid") String uuid,
    @JsonProperty("name") String name,
    @JsonProperty("uri") String uri,
    @JsonProperty("streamingUri") String streamingUri,
    @JsonProperty("vBucketServerMap") CouchbasePartitionInfo partitionInfo,
    @JsonProperty("nodes") List<NodeInfo> nodeInfos,
    @JsonProperty("nodesExt") List<PortInfo> portInfos,
    @JsonProperty("bucketCapabilities") List<BucketCapabilities> bucketCapabilities,
    @JacksonInject("origin") String origin) {
  super(uuid, name, BucketNodeLocator.VBUCKET, uri, streamingUri, nodeInfos, portInfos, bucketCapabilities, origin);
  this.partitionInfo = partitionInfo;
  this.tainted = partitionInfo.tainted();
  List<NodeInfo> extendedNodeInfos = this.nodes(); // includes ports for SSL services
  this.partitionHosts = buildPartitionHosts(extendedNodeInfos, partitionInfo);
  this.nodesWithPrimaryPartitions = buildNodesWithPrimaryPartitions(nodeInfos, partitionInfo.partitions());
  this.rev = rev;

  // Use bucket capabilities to identify if couchapi is missing (then its ephemeral). If its null then
  // we are running an old version of couchbase which doesn't have ephemeral buckets at all.
  this.ephemeral = bucketCapabilities != null && !bucketCapabilities.contains(BucketCapabilities.COUCHAPI);
}
 
Example #3
Source File: StatementDocumentImpl.java    From Wikidata-Toolkit with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor used for JSON deserialization with Jackson.
 */
StatementDocumentImpl(
		@JsonProperty("id") String jsonId,
		@JsonProperty("claims") Map<String, List<StatementImpl.PreStatement>> claims,
		@JsonProperty("lastrevid") long revisionId,
		@JacksonInject("siteIri") String siteIri) {
	super(jsonId, revisionId, siteIri);
	if (claims != null) {
		this.claims = new HashMap<>();
		EntityIdValue subject = this.getEntityId();
		for (Entry<String, List<StatementImpl.PreStatement>> entry : claims
				.entrySet()) {
			List<Statement> statements = new ArrayList<>(entry.getValue().size());
			for (StatementImpl.PreStatement statement : entry.getValue()) {
				statements.add(statement.withSubject(subject));
			}
			this.claims.put(entry.getKey(), statements);
		}
	} else {
		this.claims = Collections.emptyMap();
	}
}
 
Example #4
Source File: ItemDocumentImpl.java    From Wikidata-Toolkit with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor. Creates an object that can be populated during JSON
 * deserialization. Should only be used by Jackson for this very purpose.
 */
@JsonCreator
public ItemDocumentImpl(
		@JsonProperty("id") String jsonId,
		@JsonProperty("labels") @JsonDeserialize(contentAs=TermImpl.class) Map<String, MonolingualTextValue> labels,
		@JsonProperty("descriptions") @JsonDeserialize(contentAs=TermImpl.class) Map<String, MonolingualTextValue> descriptions,
		@JsonProperty("aliases") @JsonDeserialize(using = AliasesDeserializer.class) Map<String, List<MonolingualTextValue>> aliases,
		@JsonProperty("claims") Map<String, List<StatementImpl.PreStatement>> claims,
		@JsonProperty("sitelinks") Map<String, SiteLink> sitelinks,
		@JsonProperty("lastrevid") long revisionId,
		@JacksonInject("siteIri") String siteIri) {
	super(jsonId, labels, descriptions, aliases, claims, revisionId, siteIri);
	if (sitelinks != null) {
		this.sitelinks = sitelinks;
	} else {
		this.sitelinks = Collections.emptyMap();
	}
}
 
Example #5
Source File: WriterCommitterPOP.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
@JsonCreator
public WriterCommitterPOP(
    @JsonProperty("props") OpProps props,
    @JsonProperty("tempLocation") String tempLocation,
    @JsonProperty("finalLocation") String finalLocation,
    @JsonProperty("pluginId") StoragePluginId pluginId,
    @JsonProperty("icebergTableProps") IcebergTableProps icebergTableProps,
    @JsonProperty("child") PhysicalOperator child,
    @JacksonInject CatalogService catalogService
    ) {
  super(props, child);
  this.tempLocation = tempLocation;
  this.finalLocation = finalLocation;
  this.icebergTableProps = icebergTableProps;
  this.plugin = Preconditions.checkNotNull(catalogService.<FileSystemPlugin<?>>getSource(pluginId));
}
 
Example #6
Source File: KafkaConsumer.java    From suro with Apache License 2.0 6 votes vote down vote up
@JsonCreator
public KafkaConsumer(
        @JsonProperty("consumerProps") Properties consumerProps,
        @JsonProperty("topic") String topic,
        @JsonProperty("readers") int readers,
        @JacksonInject MessageRouter router,
        @JacksonInject ObjectMapper jsonMapper
) {
    Preconditions.checkNotNull(consumerProps);
    Preconditions.checkNotNull(topic);
    Preconditions.checkNotNull(consumerProps.getProperty("group.id"));
    Preconditions.checkNotNull(consumerProps.getProperty("zookeeper.connect"));
    String timeoutStr = consumerProps.getProperty("consumer.timeout.ms");
    Preconditions.checkNotNull(timeoutStr);
    Preconditions.checkArgument(Long.parseLong(timeoutStr) > 0);

    this.consumerProps = consumerProps;
    this.topic = topic;
    this.readers = readers == 0 ? 1 : readers;
    this.router = router;
    this.jsonMapper = jsonMapper;
}
 
Example #7
Source File: FileSystemCreateTableEntry.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
@JsonCreator
public FileSystemCreateTableEntry(@JsonProperty("userName") String userName,
                                  @JsonProperty("pluginId") StoragePluginId pluginId,
                                  @JsonProperty("formatConfig") FormatPluginConfig formatConfig,
                                  @JsonProperty("location") String location,
                                  @JsonProperty("icebergTableProps") IcebergTableProps icebergTableProps,
                                  @JsonProperty("options") WriterOptions options,
                                  @JacksonInject CatalogService catalogService)
    throws ExecutionSetupException {
  this.userName = userName;
  this.plugin = catalogService.getSource(pluginId);
  this.formatPlugin = plugin.getFormatPlugin(formatConfig);
  this.location = location;
  this.options = options;
  this.icebergTableProps = icebergTableProps;
}
 
Example #8
Source File: EasyWriter.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
@JsonCreator
public EasyWriter(
    @JsonProperty("props") OpProps props,
    @JsonProperty("child") PhysicalOperator child,
    @JsonProperty("userName") String userName,
    @JsonProperty("location") String location,
    @JsonProperty("options") WriterOptions options,
    @JsonProperty("sortColumns") List<String> sortColumns,
    @JsonProperty("pluginId") StoragePluginId pluginId,
    @JsonProperty("format") FormatPluginConfig formatConfig,
    @JacksonInject CatalogService catalogService
    ) {
  super(props, child, options);
  //CatalogService catalogService = null;
  this.plugin = catalogService.getSource(pluginId);
  this.formatPlugin = (EasyFormatPlugin<?>) plugin.getFormatPlugin(formatConfig);
  Preconditions.checkNotNull(formatPlugin, "Unable to load format plugin for provided format config.");
  this.location = location;
}
 
Example #9
Source File: POJOPropertiesCollector.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
protected void _doAddInjectable(JacksonInject.Value injectable, AnnotatedMember m)
{
    if (injectable == null) {
        return;
    }
    Object id = injectable.getId();
    if (_injectables == null) {
        _injectables = new LinkedHashMap<Object, AnnotatedMember>();
    }
    AnnotatedMember prev = _injectables.put(id, m);
    if (prev != null) {
        // 12-Apr-2017, tatu: Let's allow masking of Field by Method
        if (prev.getClass() == m.getClass()) {
            String type = id.getClass().getName();
            throw new IllegalArgumentException("Duplicate injectable value with id '"
                    +String.valueOf(id)+"' (of type "+type+")");
        }
    }
}
 
Example #10
Source File: ParquetWriter.java    From Bats with Apache License 2.0 6 votes vote down vote up
@JsonCreator
public ParquetWriter(
        @JsonProperty("child") PhysicalOperator child,
        @JsonProperty("location") String location,
        @JsonProperty("partitionColumns") List<String> partitionColumns,
        @JsonProperty("storageStrategy") StorageStrategy storageStrategy,
        @JsonProperty("storage") StoragePluginConfig storageConfig,
        @JacksonInject StoragePluginRegistry engineRegistry) throws IOException, ExecutionSetupException {

  super(child);
  this.formatPlugin = (ParquetFormatPlugin) engineRegistry.getFormatPlugin(storageConfig, new ParquetFormatConfig());
  Preconditions.checkNotNull(formatPlugin, "Unable to load format plugin for provided format config.");
  this.location = location;
  this.partitionColumns = partitionColumns;
  setStorageStrategy(storageStrategy);
}
 
Example #11
Source File: ParquetRowGroupScan.java    From Bats with Apache License 2.0 6 votes vote down vote up
@JsonCreator
public ParquetRowGroupScan(@JacksonInject StoragePluginRegistry registry,
                           @JsonProperty("userName") String userName,
                           @JsonProperty("storageConfig") StoragePluginConfig storageConfig,
                           @JsonProperty("formatConfig") FormatPluginConfig formatConfig,
                           @JsonProperty("rowGroupReadEntries") LinkedList<RowGroupReadEntry> rowGroupReadEntries,
                           @JsonProperty("columns") List<SchemaPath> columns,
                           @JsonProperty("readerConfig") ParquetReaderConfig readerConfig,
                           @JsonProperty("selectionRoot") Path selectionRoot,
                           @JsonProperty("filter") LogicalExpression filter) throws ExecutionSetupException {
  this(userName,
      (ParquetFormatPlugin) registry.getFormatPlugin(Preconditions.checkNotNull(storageConfig), Preconditions.checkNotNull(formatConfig)),
      rowGroupReadEntries,
      columns,
      readerConfig,
      selectionRoot,
      filter);
}
 
Example #12
Source File: EasyGroupScan.java    From Bats with Apache License 2.0 6 votes vote down vote up
@JsonCreator
public EasyGroupScan(
    @JsonProperty("userName") String userName,
    @JsonProperty("files") List<Path> files,
    @JsonProperty("storage") StoragePluginConfig storageConfig,
    @JsonProperty("format") FormatPluginConfig formatConfig,
    @JacksonInject StoragePluginRegistry engineRegistry,
    @JsonProperty("columns") List<SchemaPath> columns,
    @JsonProperty("selectionRoot") Path selectionRoot,
    @JsonProperty("schema") TupleSchema schema
    ) throws IOException, ExecutionSetupException {
  super(ImpersonationUtil.resolveUserName(userName));
  this.selection = FileSelection.create(null, files, selectionRoot);
  this.formatPlugin = Preconditions.checkNotNull((EasyFormatPlugin<?>) engineRegistry.getFormatPlugin(storageConfig, formatConfig),
      "Unable to load format plugin for provided format config.");
  this.columns = columns == null ? ALL_COLUMNS : columns;
  this.selectionRoot = selectionRoot;
  SimpleFileTableMetadataProviderBuilder builder =
      (SimpleFileTableMetadataProviderBuilder) new FileSystemMetadataProviderManager().builder(MetadataProviderManager.MetadataProviderKind.SCHEMA_STATS_ONLY);

  this.metadataProvider = builder.withLocation(selection.getSelectionRoot())
      .withSchema(schema)
      .build();
  initFromSelection(selection, formatPlugin);
}
 
Example #13
Source File: EasyWriter.java    From Bats with Apache License 2.0 6 votes vote down vote up
@JsonCreator
public EasyWriter(
    @JsonProperty("child") PhysicalOperator child,
    @JsonProperty("location") String location,
    @JsonProperty("partitionColumns") List<String> partitionColumns,
    @JsonProperty("storageStrategy") StorageStrategy storageStrategy,
    @JsonProperty("storage") StoragePluginConfig storageConfig,
    @JsonProperty("format") FormatPluginConfig formatConfig,
    @JacksonInject StoragePluginRegistry engineRegistry) throws IOException, ExecutionSetupException {

  super(child);
  this.formatPlugin = (EasyFormatPlugin<?>) engineRegistry.getFormatPlugin(storageConfig, formatConfig);
  Preconditions.checkNotNull(formatPlugin, "Unable to load format plugin for provided format config.");
  this.location = location;
  this.partitionColumns = partitionColumns;
  setStorageStrategy(storageStrategy);
}
 
Example #14
Source File: EasySubScan.java    From Bats with Apache License 2.0 6 votes vote down vote up
@JsonCreator
public EasySubScan(
  @JsonProperty("userName") String userName,
  @JsonProperty("files") List<FileWorkImpl> files,
  @JsonProperty("storage") StoragePluginConfig storageConfig,
  @JsonProperty("format") FormatPluginConfig formatConfig,
  @JacksonInject StoragePluginRegistry engineRegistry,
  @JsonProperty("columns") List<SchemaPath> columns,
  @JsonProperty("selectionRoot") Path selectionRoot,
  @JsonProperty("partitionDepth") int partitionDepth,
  @JsonProperty("schema") TupleSchema schema
  ) throws ExecutionSetupException {
  super(userName);
  this.formatPlugin = (EasyFormatPlugin<?>) engineRegistry.getFormatPlugin(storageConfig, formatConfig);
  Preconditions.checkNotNull(this.formatPlugin);
  this.files = files;
  this.columns = columns;
  this.selectionRoot = selectionRoot;
  this.partitionDepth = partitionDepth;
  this.schema = schema;
}
 
Example #15
Source File: DefaultCouchbaseBucketConfig.java    From couchbase-jvm-core with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new {@link CouchbaseBucketConfig}.
 *
 * @param rev the revision of the config.
 * @param name the name of the bucket.
 * @param uri the URI for this bucket.
 * @param streamingUri the streaming URI for this bucket.
 * @param partitionInfo partition info for this bucket.
 * @param nodeInfos related node information.
 * @param portInfos port info for the nodes, including services.
 */
@JsonCreator
public DefaultCouchbaseBucketConfig(
    @JsonProperty("rev") long rev,
    @JsonProperty("uuid") String uuid,
    @JsonProperty("name") String name,
    @JsonProperty("uri") String uri,
    @JsonProperty("streamingUri") String streamingUri,
    @JsonProperty("vBucketServerMap") CouchbasePartitionInfo partitionInfo,
    @JsonProperty("nodes") List<NodeInfo> nodeInfos,
    @JsonProperty("nodesExt") List<PortInfo> portInfos,
    @JsonProperty("bucketCapabilities") List<BucketCapabilities> bucketCapabilities,
    @JacksonInject("origin") String origin) {
    super(uuid, name, BucketNodeLocator.VBUCKET, uri, streamingUri, nodeInfos, portInfos, bucketCapabilities, origin);
    this.partitionInfo = partitionInfo;
    this.tainted = partitionInfo.tainted();
    List<NodeInfo> extendedNodeInfos = this.nodes(); // includes ports for SSL services
    this.partitionHosts = buildPartitionHosts(extendedNodeInfos, partitionInfo);
    this.nodesWithPrimaryPartitions = buildNodesWithPrimaryPartitions(nodeInfos, partitionInfo.partitions());
    this.rev = rev;

    // Use bucket capabilities to identify if couchapi is missing (then its ephemeral). If its null then
    // we are running an old version of couchbase which doesn't have ephemeral buckets at all.
    this.ephemeral = bucketCapabilities != null && !bucketCapabilities.contains(BucketCapabilities.COUCHAPI);
}
 
Example #16
Source File: DefaultMemcachedBucketConfig.java    From couchbase-jvm-core with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new {@link MemcachedBucketConfig}.
 *
 * @param env the bootstrap part of environment object.
 * @param rev the revision of the config.
 * @param name the name of the bucket.
 * @param uri the URI for this bucket.
 * @param streamingUri the streaming URI for this bucket.
 * @param nodeInfos related node information.
 * @param portInfos port info for the nodes, including services.
 */
@JsonCreator
public DefaultMemcachedBucketConfig(
        @JacksonInject("env")ConfigParserEnvironment env,
        @JsonProperty("rev") long rev,
        @JsonProperty("uuid") String uuid,
        @JsonProperty("name") String name,
        @JsonProperty("uri") String uri,
        @JsonProperty("streamingUri") String streamingUri,
        @JsonProperty("nodes") List<NodeInfo> nodeInfos,
        @JsonProperty("nodesExt") List<PortInfo> portInfos,
        @JsonProperty("bucketCapabilities") List<BucketCapabilities> bucketCapabilities,
        @JacksonInject("origin") String origin) {
    super(uuid, name, BucketNodeLocator.KETAMA, uri, streamingUri, nodeInfos, portInfos, bucketCapabilities, origin);
    this.env = env;
    this.rev = rev;
    this.ketamaNodes = new TreeMap<>();
    populateKetamaNodes();
}
 
Example #17
Source File: LabeledStatementDocumentImpl.java    From Wikidata-Toolkit with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor used for JSON deserialization with Jackson.
 */
LabeledStatementDocumentImpl(
		@JsonProperty("id") String jsonId,
		@JsonProperty("labels") Map<String, MonolingualTextValue> labels,
		@JsonProperty("claims") Map<String, List<StatementImpl.PreStatement>> claims,
		@JsonProperty("lastrevid") long revisionId,
		@JacksonInject("siteIri") String siteIri) {
	super(jsonId, claims, revisionId, siteIri);
	this.labels = (labels == null) ? Collections.emptyMap() : labels;
}
 
Example #18
Source File: NoValueSnakImpl.java    From Wikidata-Toolkit with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor for deserialization from JSON with Jackson.
 */
@JsonCreator
protected NoValueSnakImpl(
		@JsonProperty("property") String property,
		@JacksonInject("siteIri") String siteIri) {
	super(property, siteIri);
}
 
Example #19
Source File: SQSNotice.java    From suro with Apache License 2.0 5 votes vote down vote up
@JsonCreator
public SQSNotice(
        @JsonProperty("queues") List<String> queues,
        @JsonProperty("region") @JacksonInject("region") String region,
        @JsonProperty("connectionTimeout") int connectionTimeout,
        @JsonProperty("maxConnections") int maxConnections,
        @JsonProperty("socketTimeout") int socketTimeout,
        @JsonProperty("maxRetries") int maxRetries,
        @JsonProperty("enableBase64Encoding") boolean enableBase64Encoding,
        @JacksonInject AmazonSQSClient sqsClient,
        @JacksonInject AWSCredentialsProvider credentialsProvider) {
    this.queues = queues;
    this.region = region;

    this.enableBase64Encoding = enableBase64Encoding;
    this.sqsClient = sqsClient;
    this.credentialsProvider = credentialsProvider;

    Preconditions.checkArgument(queues.size() > 0);
    Preconditions.checkNotNull(region);

    clientConfig = new ClientConfiguration();
    if (connectionTimeout > 0) {
        clientConfig = clientConfig.withConnectionTimeout(connectionTimeout);
    }
    if (maxConnections > 0) {
        clientConfig = clientConfig.withMaxConnections(maxConnections);
    }
    if (socketTimeout > 0) {
        clientConfig = clientConfig.withSocketTimeout(socketTimeout);
    }
    if (maxRetries > 0) {
        clientConfig = clientConfig.withMaxErrorRetry(maxRetries);
    }

    Monitors.registerObject(Joiner.on('_').join(queues), this);
}
 
Example #20
Source File: ThriftServer.java    From suro with Apache License 2.0 5 votes vote down vote up
@JsonCreator
public ThriftServer(
        @JacksonInject ServerConfig config,
        @JacksonInject MessageSetProcessor msgProcessor) throws Exception {
    this.config = config;
    this.msgProcessor = msgProcessor;
    this.msgProcessor.setInput(this);
}
 
Example #21
Source File: PropertyIdValueImpl.java    From Wikidata-Toolkit with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor used to deserialize an object from JSON with Jackson
 */
@JsonCreator
PropertyIdValueImpl(
		@JsonProperty("value") JacksonInnerEntityId value,
		@JacksonInject("siteIri") String siteIri) {
	super(value, siteIri);
	assertHasJsonEntityType(JSON_ENTITY_TYPE_PROPERTY);
}
 
Example #22
Source File: AbandonmentEvent.java    From find with MIT License 5 votes vote down vote up
public AbandonmentEvent(
    @JsonProperty("search") final String search,
    @JsonProperty("click-type") final ClickType clickType,
    @JacksonInject final AuthenticationInformationRetriever<?, ?> authenticationInformationRetriever
) {
    super(search, clickType, authenticationInformationRetriever);
}
 
Example #23
Source File: ValueSnakImpl.java    From Wikidata-Toolkit with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor used to deserialize from JSON with Jackson.
 */
@JsonCreator
protected ValueSnakImpl(
		@JsonProperty("property") String property,
		@JsonProperty("datatype") String datatype,
		@JsonProperty("datavalue") Value datavalue,
		@JacksonInject("siteIri") String siteIri) {
	super(property, siteIri);
	Validate.notNull(datavalue, "A datavalue must be provided to create a value snak.");
	this.datavalue = datavalue;
	this.datatype = datatype;
}
 
Example #24
Source File: SomeValueSnakImpl.java    From Wikidata-Toolkit with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor for deserialization from JSON with Jackson.
 */
@JsonCreator
protected SomeValueSnakImpl(
		@JsonProperty("property") String property,
		@JacksonInject("siteIri") String siteIri) {
	super(property, siteIri);
}
 
Example #25
Source File: UnsupportedEntityIdValueImpl.java    From Wikidata-Toolkit with Apache License 2.0 5 votes vote down vote up
@JsonCreator
private UnsupportedEntityIdValueImpl(
		@JsonProperty("value")
		JacksonIdValue value,
		@JacksonInject("siteIri")
		String siteIri) {
	super(JSON_VALUE_TYPE_ENTITY_ID);
	this.value = value;
	this.siteIri = siteIri;
}
 
Example #26
Source File: EntityRedirectDocumentImpl.java    From Wikidata-Toolkit with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor used for JSON deserialization with Jackson.
 */
@JsonCreator
EntityRedirectDocumentImpl(
		@JsonProperty("entity") String jsonId,
		@JsonProperty("redirect") String jsonTargetId,
		@JsonProperty("lastrevid") long revisionId,
		@JacksonInject("siteIri") String siteIri) {
	this.entityId = EntityIdValueImpl.fromId(jsonId, siteIri);
	Validate.notNull(jsonTargetId);
	this.targetId = EntityIdValueImpl.fromId(jsonTargetId, siteIri);
	Validate.isTrue(getEntityId().getEntityType().equals(targetId.getEntityType()), "You could only do redirects between entities of the same type");
	this.revisionId = revisionId;
}
 
Example #27
Source File: Config.java    From digdag with Apache License 2.0 5 votes vote down vote up
@JsonCreator
public static Config deserializeFromJackson(@JacksonInject ObjectMapper mapper, JsonNode object)
{
    if (!object.isObject()) {
        throw new RuntimeJsonMappingException("Expected object but got "+object);
    }
    return new Config(mapper, (ObjectNode) object);
}
 
Example #28
Source File: PageEvent.java    From find with MIT License 5 votes vote down vote up
public PageEvent(
    @JsonProperty("search") final String search,
    @JsonProperty("page") final int page,
    @JacksonInject final AuthenticationInformationRetriever<?, ?> authenticationInformationRetriever
) {
    super(search, authenticationInformationRetriever);
    this.page = page;
}
 
Example #29
Source File: ClickThroughEvent.java    From find with MIT License 5 votes vote down vote up
public ClickThroughEvent(
    @JsonProperty("search") final String search,
    @JsonProperty("click-type") final ClickType clickType,
    @JsonProperty("position") final int position,
    @JacksonInject final AuthenticationInformationRetriever<?, ?> authenticationInformationRetriever
) {
    super(search, clickType, authenticationInformationRetriever);
    this.position = position;
}
 
Example #30
Source File: LealoneGroupScan.java    From Bats with Apache License 2.0 5 votes vote down vote up
@JsonCreator
public LealoneGroupScan(@JsonProperty("scanSpec") LealoneScanSpec scanSpec,
        @JsonProperty("lealoneStoragePluginConfig") LealoneStoragePluginConfig lealoneStoragePluginConfig,
        @JsonProperty("columns") List<SchemaPath> columns, @JacksonInject StoragePluginRegistry pluginRegistry)
        throws IOException, ExecutionSetupException {
    this((LealoneStoragePlugin) pluginRegistry.getPlugin(lealoneStoragePluginConfig), scanSpec, columns);
}