com.algolia.model.insights.EventsItems Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of algoliasearch Show documentation
Show all versions of algoliasearch Show documentation
Java client for Algolia Search API
The newest version!
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost
// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
package com.algolia.model.insights;
import com.algolia.exceptions.AlgoliaRuntimeException;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.annotation.*;
import java.io.IOException;
import java.util.logging.Logger;
/** EventsItems */
@JsonDeserialize(using = EventsItems.Deserializer.class)
public interface EventsItems {
class Deserializer extends JsonDeserializer {
private static final Logger LOGGER = Logger.getLogger(Deserializer.class.getName());
@Override
public EventsItems deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
JsonNode tree = jp.readValueAsTree();
// deserialize AddedToCartObjectIDsAfterSearch
if (tree.isObject() && tree.has("eventType") && tree.has("eventSubtype") && tree.has("queryID") && tree.has("objectIDs")) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
return parser.readValueAs(AddedToCartObjectIDsAfterSearch.class);
} catch (Exception e) {
// deserialization failed, continue
LOGGER.finest(
"Failed to deserialize oneOf AddedToCartObjectIDsAfterSearch (error: " +
e.getMessage() +
") (type: AddedToCartObjectIDsAfterSearch)"
);
}
}
// deserialize PurchasedObjectIDsAfterSearch
if (tree.isObject() && tree.has("eventType") && tree.has("eventSubtype") && tree.has("objectIDs") && tree.has("objectData")) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
return parser.readValueAs(PurchasedObjectIDsAfterSearch.class);
} catch (Exception e) {
// deserialization failed, continue
LOGGER.finest(
"Failed to deserialize oneOf PurchasedObjectIDsAfterSearch (error: " +
e.getMessage() +
") (type: PurchasedObjectIDsAfterSearch)"
);
}
}
// deserialize ClickedObjectIDsAfterSearch
if (tree.isObject() && tree.has("positions") && tree.has("queryID") && tree.has("eventType")) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
return parser.readValueAs(ClickedObjectIDsAfterSearch.class);
} catch (Exception e) {
// deserialization failed, continue
LOGGER.finest(
"Failed to deserialize oneOf ClickedObjectIDsAfterSearch (error: " + e.getMessage() + ") (type: ClickedObjectIDsAfterSearch)"
);
}
}
// deserialize PurchasedObjectIDs
if (tree.isObject() && tree.has("eventType") && tree.has("eventSubtype") && tree.has("objectIDs")) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
return parser.readValueAs(PurchasedObjectIDs.class);
} catch (Exception e) {
// deserialization failed, continue
LOGGER.finest("Failed to deserialize oneOf PurchasedObjectIDs (error: " + e.getMessage() + ") (type: PurchasedObjectIDs)");
}
}
// deserialize AddedToCartObjectIDs
if (tree.isObject() && tree.has("eventType") && tree.has("eventSubtype") && tree.has("objectIDs")) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
return parser.readValueAs(AddedToCartObjectIDs.class);
} catch (Exception e) {
// deserialization failed, continue
LOGGER.finest("Failed to deserialize oneOf AddedToCartObjectIDs (error: " + e.getMessage() + ") (type: AddedToCartObjectIDs)");
}
}
// deserialize ConvertedObjectIDsAfterSearch
if (tree.isObject() && tree.has("queryID") && tree.has("eventType")) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
return parser.readValueAs(ConvertedObjectIDsAfterSearch.class);
} catch (Exception e) {
// deserialization failed, continue
LOGGER.finest(
"Failed to deserialize oneOf ConvertedObjectIDsAfterSearch (error: " +
e.getMessage() +
") (type: ConvertedObjectIDsAfterSearch)"
);
}
}
// deserialize ClickedObjectIDs
if (tree.isObject() && tree.has("eventType") && tree.has("objectIDs")) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
return parser.readValueAs(ClickedObjectIDs.class);
} catch (Exception e) {
// deserialization failed, continue
LOGGER.finest("Failed to deserialize oneOf ClickedObjectIDs (error: " + e.getMessage() + ") (type: ClickedObjectIDs)");
}
}
// deserialize ConvertedObjectIDs
if (tree.isObject() && tree.has("eventType") && tree.has("objectIDs")) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
return parser.readValueAs(ConvertedObjectIDs.class);
} catch (Exception e) {
// deserialization failed, continue
LOGGER.finest("Failed to deserialize oneOf ConvertedObjectIDs (error: " + e.getMessage() + ") (type: ConvertedObjectIDs)");
}
}
// deserialize ClickedFilters
if (tree.isObject() && tree.has("eventType") && tree.has("filters")) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
return parser.readValueAs(ClickedFilters.class);
} catch (Exception e) {
// deserialization failed, continue
LOGGER.finest("Failed to deserialize oneOf ClickedFilters (error: " + e.getMessage() + ") (type: ClickedFilters)");
}
}
// deserialize ConvertedFilters
if (tree.isObject() && tree.has("eventType") && tree.has("filters")) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
return parser.readValueAs(ConvertedFilters.class);
} catch (Exception e) {
// deserialization failed, continue
LOGGER.finest("Failed to deserialize oneOf ConvertedFilters (error: " + e.getMessage() + ") (type: ConvertedFilters)");
}
}
// deserialize ViewedObjectIDs
if (tree.isObject() && tree.has("eventType") && tree.has("objectIDs")) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
return parser.readValueAs(ViewedObjectIDs.class);
} catch (Exception e) {
// deserialization failed, continue
LOGGER.finest("Failed to deserialize oneOf ViewedObjectIDs (error: " + e.getMessage() + ") (type: ViewedObjectIDs)");
}
}
// deserialize ViewedFilters
if (tree.isObject() && tree.has("eventType") && tree.has("filters")) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
return parser.readValueAs(ViewedFilters.class);
} catch (Exception e) {
// deserialization failed, continue
LOGGER.finest("Failed to deserialize oneOf ViewedFilters (error: " + e.getMessage() + ") (type: ViewedFilters)");
}
}
throw new AlgoliaRuntimeException(String.format("Failed to deserialize json element: %s", tree));
}
/** Handle deserialization of the 'null' value. */
@Override
public EventsItems getNullValue(DeserializationContext ctxt) throws JsonMappingException {
throw new JsonMappingException(ctxt.getParser(), "EventsItems cannot be null");
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy