All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.factset.sdk.FactSetGlobalPrices.models.BatchResult Maven / Gradle / Ivy

There is a newer version: 3.1.2
Show newest version
/*
 * FactSet Global Prices API
 * The FactSet Global Prices API provides end of day market pricing content using cloud and microservices technology, encompassing both pricing as well as corporate actions and events data.

* * The version of the OpenAPI document: 1.7.0 * Contact: [email protected] * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ package com.factset.sdk.FactSetGlobalPrices.models; import java.util.Objects; import java.util.Arrays; import java.util.Map; import java.util.HashMap; import com.factset.sdk.FactSetGlobalPrices.models.AnnualizedDividendsObject; import com.factset.sdk.FactSetGlobalPrices.models.CorporateAction; import com.factset.sdk.FactSetGlobalPrices.models.Price; import com.factset.sdk.FactSetGlobalPrices.models.Returns; import com.factset.sdk.FactSetGlobalPrices.models.SharesOutstandingResponseObject; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.time.LocalDate; import org.openapitools.jackson.nullable.JsonNullable; import com.fasterxml.jackson.annotation.JsonIgnore; import org.openapitools.jackson.nullable.JsonNullable; import java.util.NoSuchElementException; import java.io.Serializable; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.factset.sdk.FactSetGlobalPrices.JSON; import jakarta.ws.rs.core.GenericType; import jakarta.ws.rs.core.Response; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.deser.std.StdDeserializer; import com.fasterxml.jackson.databind.ser.std.StdSerializer; import com.factset.sdk.FactSetGlobalPrices.JSON; @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") @JsonDeserialize(using=BatchResult.BatchResultDeserializer.class) @JsonSerialize(using = BatchResult.BatchResultSerializer.class) public class BatchResult extends AbstractOpenApiSchema implements Serializable { private static final Logger log = Logger.getLogger(BatchResult.class.getName()); public static class BatchResultSerializer extends StdSerializer { public BatchResultSerializer(Class t) { super(t); } public BatchResultSerializer() { this(null); } @Override public void serialize(BatchResult value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { jgen.writeObject(value.getActualInstance()); } } public static class BatchResultDeserializer extends StdDeserializer { public BatchResultDeserializer() { this(BatchResult.class); } public BatchResultDeserializer(Class vc) { super(vc); } @Override public BatchResult deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { JsonNode tree = jp.readValueAsTree(); Object deserialized = null; // deserialize Price try { deserialized = tree.traverse(jp.getCodec()).readValueAs(new TypeReference(){}); BatchResult ret = new BatchResult(); ret.setActualInstance(deserialized); return ret; } catch (Exception e) { // deserialization failed, continue, log to help debugging log.log(Level.FINER, "Input data does not match 'BatchResult'", e); } // deserialize Returns try { deserialized = tree.traverse(jp.getCodec()).readValueAs(new TypeReference(){}); BatchResult ret = new BatchResult(); ret.setActualInstance(deserialized); return ret; } catch (Exception e) { // deserialization failed, continue, log to help debugging log.log(Level.FINER, "Input data does not match 'BatchResult'", e); } // deserialize CorporateAction try { deserialized = tree.traverse(jp.getCodec()).readValueAs(new TypeReference(){}); BatchResult ret = new BatchResult(); ret.setActualInstance(deserialized); return ret; } catch (Exception e) { // deserialization failed, continue, log to help debugging log.log(Level.FINER, "Input data does not match 'BatchResult'", e); } // deserialize AnnualizedDividendsObject try { deserialized = tree.traverse(jp.getCodec()).readValueAs(new TypeReference(){}); BatchResult ret = new BatchResult(); ret.setActualInstance(deserialized); return ret; } catch (Exception e) { // deserialization failed, continue, log to help debugging log.log(Level.FINER, "Input data does not match 'BatchResult'", e); } // deserialize SharesOutstandingResponseObject try { deserialized = tree.traverse(jp.getCodec()).readValueAs(new TypeReference(){}); BatchResult ret = new BatchResult(); ret.setActualInstance(deserialized); return ret; } catch (Exception e) { // deserialization failed, continue, log to help debugging log.log(Level.FINER, "Input data does not match 'BatchResult'", e); } throw new IOException(String.format("Failed deserialization for BatchResult: no match found")); } /** * Handle deserialization of the 'null' value. */ @Override public BatchResult getNullValue(DeserializationContext ctxt) throws JsonMappingException { throw new JsonMappingException(ctxt.getParser(), "BatchResult cannot be null"); } } // store a list of schema names defined in anyOf public static final Map schemas = new HashMap(); public BatchResult() { super("anyOf", Boolean.FALSE); } public BatchResult(AnnualizedDividendsObject o) { super("anyOf", Boolean.FALSE); setActualInstance(o); } public BatchResult(CorporateAction o) { super("anyOf", Boolean.FALSE); setActualInstance(o); } public BatchResult(Price o) { super("anyOf", Boolean.FALSE); setActualInstance(o); } public BatchResult(Returns o) { super("anyOf", Boolean.FALSE); setActualInstance(o); } public BatchResult(SharesOutstandingResponseObject o) { super("anyOf", Boolean.FALSE); setActualInstance(o); } static { schemas.put("AnnualizedDividendsObject", new GenericType() { }); schemas.put("CorporateAction", new GenericType() { }); schemas.put("Price", new GenericType() { }); schemas.put("Returns", new GenericType() { }); schemas.put("SharesOutstandingResponseObject", new GenericType() { }); JSON.registerDescendants(BatchResult.class, Collections.unmodifiableMap(schemas)); } @Override public Map getSchemas() { return BatchResult.schemas; } /** * Set the instance that matches the anyOf child schema, check * the instance parameter is valid against the anyOf child schemas: * AnnualizedDividendsObject, CorporateAction, Price, Returns, SharesOutstandingResponseObject * * It could be an instance of the 'anyOf' schemas. * The anyOf child schemas may themselves be a composed schema (allOf, anyOf, anyOf). */ @Override public void setActualInstance(Object instance) { if (JSON.isInstanceOf(Price.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } if (JSON.isInstanceOf(Returns.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } if (JSON.isInstanceOf(CorporateAction.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } if (JSON.isInstanceOf(AnnualizedDividendsObject.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } if (JSON.isInstanceOf(SharesOutstandingResponseObject.class, instance, new HashSet>())) { super.setActualInstance(instance); return; } throw new RuntimeException("Invalid instance type. Must be AnnualizedDividendsObject, CorporateAction, Price, Returns, SharesOutstandingResponseObject"); } /** * Get the actual instance, which can be the following: * AnnualizedDividendsObject, CorporateAction, Price, Returns, SharesOutstandingResponseObject * * @return The actual instance (AnnualizedDividendsObject, CorporateAction, Price, Returns, SharesOutstandingResponseObject) */ @Override public Object getActualInstance() { return super.getActualInstance(); } /** * Get the actual instance of `Price`. * If the actual instance is not `Price`, * the ClassCastException will be thrown. * * @return The actual instance of `Price` * @throws ClassCastException if the instance is not `Price` */ public Price getPrice() throws ClassCastException { return (Price)super.getActualInstance(); } /** * Get the actual instance of `Returns`. * If the actual instance is not `Returns`, * the ClassCastException will be thrown. * * @return The actual instance of `Returns` * @throws ClassCastException if the instance is not `Returns` */ public Returns getReturns() throws ClassCastException { return (Returns)super.getActualInstance(); } /** * Get the actual instance of `CorporateAction`. * If the actual instance is not `CorporateAction`, * the ClassCastException will be thrown. * * @return The actual instance of `CorporateAction` * @throws ClassCastException if the instance is not `CorporateAction` */ public CorporateAction getCorporateAction() throws ClassCastException { return (CorporateAction)super.getActualInstance(); } /** * Get the actual instance of `AnnualizedDividendsObject`. * If the actual instance is not `AnnualizedDividendsObject`, * the ClassCastException will be thrown. * * @return The actual instance of `AnnualizedDividendsObject` * @throws ClassCastException if the instance is not `AnnualizedDividendsObject` */ public AnnualizedDividendsObject getAnnualizedDividendsObject() throws ClassCastException { return (AnnualizedDividendsObject)super.getActualInstance(); } /** * Get the actual instance of `SharesOutstandingResponseObject`. * If the actual instance is not `SharesOutstandingResponseObject`, * the ClassCastException will be thrown. * * @return The actual instance of `SharesOutstandingResponseObject` * @throws ClassCastException if the instance is not `SharesOutstandingResponseObject` */ public SharesOutstandingResponseObject getSharesOutstandingResponseObject() throws ClassCastException { return (SharesOutstandingResponseObject)super.getActualInstance(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy