All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.adobe.cq.commerce.magento.graphql.BillingCartAddress Maven / Gradle / Ivy
/*******************************************************************************
*
* Copyright 2019 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
******************************************************************************/
package com.adobe.cq.commerce.magento.graphql;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.shopify.graphql.support.AbstractResponse;
import com.shopify.graphql.support.SchemaViolationError;
/**
*
*/
public class BillingCartAddress extends AbstractResponse implements CartAddressInterface {
public BillingCartAddress() {
}
public BillingCartAddress(JsonObject fields) throws SchemaViolationError {
for (Map.Entry field : fields.entrySet()) {
String key = field.getKey();
String fieldName = getFieldName(key);
switch (fieldName) {
case "city": {
String optional1 = null;
if (!field.getValue().isJsonNull()) {
optional1 = jsonAsString(field.getValue(), key);
}
responseData.put(key, optional1);
break;
}
case "company": {
String optional1 = null;
if (!field.getValue().isJsonNull()) {
optional1 = jsonAsString(field.getValue(), key);
}
responseData.put(key, optional1);
break;
}
case "country": {
CartAddressCountry optional1 = null;
if (!field.getValue().isJsonNull()) {
optional1 = new CartAddressCountry(jsonAsObject(field.getValue(), key));
}
responseData.put(key, optional1);
break;
}
case "customer_notes": {
String optional1 = null;
if (!field.getValue().isJsonNull()) {
optional1 = jsonAsString(field.getValue(), key);
}
responseData.put(key, optional1);
break;
}
case "firstname": {
String optional1 = null;
if (!field.getValue().isJsonNull()) {
optional1 = jsonAsString(field.getValue(), key);
}
responseData.put(key, optional1);
break;
}
case "lastname": {
String optional1 = null;
if (!field.getValue().isJsonNull()) {
optional1 = jsonAsString(field.getValue(), key);
}
responseData.put(key, optional1);
break;
}
case "postcode": {
String optional1 = null;
if (!field.getValue().isJsonNull()) {
optional1 = jsonAsString(field.getValue(), key);
}
responseData.put(key, optional1);
break;
}
case "region": {
CartAddressRegion optional1 = null;
if (!field.getValue().isJsonNull()) {
optional1 = new CartAddressRegion(jsonAsObject(field.getValue(), key));
}
responseData.put(key, optional1);
break;
}
case "street": {
List optional1 = null;
if (!field.getValue().isJsonNull()) {
List list1 = new ArrayList<>();
for (JsonElement element1 : jsonAsArray(field.getValue(), key)) {
String optional2 = null;
if (!element1.isJsonNull()) {
optional2 = jsonAsString(element1, key);
}
list1.add(optional2);
}
optional1 = list1;
}
responseData.put(key, optional1);
break;
}
case "telephone": {
String optional1 = null;
if (!field.getValue().isJsonNull()) {
optional1 = jsonAsString(field.getValue(), key);
}
responseData.put(key, optional1);
break;
}
case "__typename": {
responseData.put(key, jsonAsString(field.getValue(), key));
break;
}
default: {
readCustomField(fieldName, field.getValue());
}
}
}
}
public String getGraphQlTypeName() {
return "BillingCartAddress";
}
public String getCity() {
return (String) get("city");
}
public BillingCartAddress setCity(String arg) {
optimisticData.put(getKey("city"), arg);
return this;
}
public String getCompany() {
return (String) get("company");
}
public BillingCartAddress setCompany(String arg) {
optimisticData.put(getKey("company"), arg);
return this;
}
public CartAddressCountry getCountry() {
return (CartAddressCountry) get("country");
}
public BillingCartAddress setCountry(CartAddressCountry arg) {
optimisticData.put(getKey("country"), arg);
return this;
}
public String getCustomerNotes() {
return (String) get("customer_notes");
}
public BillingCartAddress setCustomerNotes(String arg) {
optimisticData.put(getKey("customer_notes"), arg);
return this;
}
public String getFirstname() {
return (String) get("firstname");
}
public BillingCartAddress setFirstname(String arg) {
optimisticData.put(getKey("firstname"), arg);
return this;
}
public String getLastname() {
return (String) get("lastname");
}
public BillingCartAddress setLastname(String arg) {
optimisticData.put(getKey("lastname"), arg);
return this;
}
public String getPostcode() {
return (String) get("postcode");
}
public BillingCartAddress setPostcode(String arg) {
optimisticData.put(getKey("postcode"), arg);
return this;
}
public CartAddressRegion getRegion() {
return (CartAddressRegion) get("region");
}
public BillingCartAddress setRegion(CartAddressRegion arg) {
optimisticData.put(getKey("region"), arg);
return this;
}
public List getStreet() {
return (List) get("street");
}
public BillingCartAddress setStreet(List arg) {
optimisticData.put(getKey("street"), arg);
return this;
}
public String getTelephone() {
return (String) get("telephone");
}
public BillingCartAddress setTelephone(String arg) {
optimisticData.put(getKey("telephone"), arg);
return this;
}
public boolean unwrapsToObject(String key) {
switch (getFieldName(key)) {
case "city": return false;
case "company": return false;
case "country": return true;
case "customer_notes": return false;
case "firstname": return false;
case "lastname": return false;
case "postcode": return false;
case "region": return true;
case "street": return false;
case "telephone": return false;
default: return false;
}
}
}