001package com.box.sdkgen.schemas.v2025r0.shieldlistcontentrequestv2025r0; 002 003import com.box.sdkgen.internal.OneOfFour; 004import com.box.sdkgen.schemas.v2025r0.shieldlistcontentcountryv2025r0.ShieldListContentCountryV2025R0; 005import com.box.sdkgen.schemas.v2025r0.shieldlistcontentdomainv2025r0.ShieldListContentDomainV2025R0; 006import com.box.sdkgen.schemas.v2025r0.shieldlistcontentemailv2025r0.ShieldListContentEmailV2025R0; 007import com.box.sdkgen.schemas.v2025r0.shieldlistcontentipv2025r0.ShieldListContentIpV2025R0; 008import com.box.sdkgen.serialization.json.EnumWrapper; 009import com.box.sdkgen.serialization.json.JsonManager; 010import com.fasterxml.jackson.core.JsonParser; 011import com.fasterxml.jackson.databind.DeserializationContext; 012import com.fasterxml.jackson.databind.JsonDeserializer; 013import com.fasterxml.jackson.databind.JsonMappingException; 014import com.fasterxml.jackson.databind.JsonNode; 015import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 016import com.fasterxml.jackson.databind.annotation.JsonSerialize; 017import java.io.IOException; 018 019@JsonDeserialize( 020 using = ShieldListContentRequestV2025R0.ShieldListContentRequestV2025R0Deserializer.class) 021@JsonSerialize(using = OneOfFour.OneOfFourSerializer.class) 022public class ShieldListContentRequestV2025R0 023 extends OneOfFour< 024 ShieldListContentCountryV2025R0, 025 ShieldListContentDomainV2025R0, 026 ShieldListContentEmailV2025R0, 027 ShieldListContentIpV2025R0> { 028 029 protected final String type; 030 031 public ShieldListContentRequestV2025R0( 032 ShieldListContentCountryV2025R0 shieldListContentCountryV2025R0) { 033 super(shieldListContentCountryV2025R0, null, null, null); 034 this.type = EnumWrapper.convertToString(shieldListContentCountryV2025R0.getType()); 035 } 036 037 public ShieldListContentRequestV2025R0( 038 ShieldListContentDomainV2025R0 shieldListContentDomainV2025R0) { 039 super(null, shieldListContentDomainV2025R0, null, null); 040 this.type = EnumWrapper.convertToString(shieldListContentDomainV2025R0.getType()); 041 } 042 043 public ShieldListContentRequestV2025R0( 044 ShieldListContentEmailV2025R0 shieldListContentEmailV2025R0) { 045 super(null, null, shieldListContentEmailV2025R0, null); 046 this.type = EnumWrapper.convertToString(shieldListContentEmailV2025R0.getType()); 047 } 048 049 public ShieldListContentRequestV2025R0(ShieldListContentIpV2025R0 shieldListContentIpV2025R0) { 050 super(null, null, null, shieldListContentIpV2025R0); 051 this.type = EnumWrapper.convertToString(shieldListContentIpV2025R0.getType()); 052 } 053 054 public boolean isShieldListContentCountryV2025R0() { 055 return value0 != null; 056 } 057 058 public ShieldListContentCountryV2025R0 getShieldListContentCountryV2025R0() { 059 return value0; 060 } 061 062 public boolean isShieldListContentDomainV2025R0() { 063 return value1 != null; 064 } 065 066 public ShieldListContentDomainV2025R0 getShieldListContentDomainV2025R0() { 067 return value1; 068 } 069 070 public boolean isShieldListContentEmailV2025R0() { 071 return value2 != null; 072 } 073 074 public ShieldListContentEmailV2025R0 getShieldListContentEmailV2025R0() { 075 return value2; 076 } 077 078 public boolean isShieldListContentIpV2025R0() { 079 return value3 != null; 080 } 081 082 public ShieldListContentIpV2025R0 getShieldListContentIpV2025R0() { 083 return value3; 084 } 085 086 public String getType() { 087 return type; 088 } 089 090 static class ShieldListContentRequestV2025R0Deserializer 091 extends JsonDeserializer<ShieldListContentRequestV2025R0> { 092 093 public ShieldListContentRequestV2025R0Deserializer() { 094 super(); 095 } 096 097 @Override 098 public ShieldListContentRequestV2025R0 deserialize(JsonParser jp, DeserializationContext ctxt) 099 throws IOException { 100 JsonNode node = JsonManager.jsonToSerializedData(jp); 101 JsonNode discriminant0 = node.get("type"); 102 if (!(discriminant0 == null)) { 103 switch (discriminant0.asText()) { 104 case "country": 105 return new ShieldListContentRequestV2025R0( 106 JsonManager.deserialize(node, ShieldListContentCountryV2025R0.class)); 107 case "domain": 108 return new ShieldListContentRequestV2025R0( 109 JsonManager.deserialize(node, ShieldListContentDomainV2025R0.class)); 110 case "email": 111 return new ShieldListContentRequestV2025R0( 112 JsonManager.deserialize(node, ShieldListContentEmailV2025R0.class)); 113 case "ip": 114 return new ShieldListContentRequestV2025R0( 115 JsonManager.deserialize(node, ShieldListContentIpV2025R0.class)); 116 } 117 } 118 throw new JsonMappingException(jp, "Unable to deserialize ShieldListContentRequestV2025R0"); 119 } 120 } 121}