elements;
-
- @JsonIgnore
- LinkedItemProvider linkedItemProvider;
-
- @JsonIgnore
- private StronglyTypedContentItemConverter stronglyTypedContentItemConverter;
-
- /**
- * Content type elements in the content item. These are keyed by the codename of the element.
- *
- * Note: The order of the {@link Element} objects might not match the order in the Kontent.ai UI.
- *
- * @param elements New value for this ContentItem's {@link Element} objects.
- */
- public void setElements(Map elements) {
- this.elements = elements;
- elements.forEach((s, element) -> element.setParent(this));
- }
-
- /**
- * Convenience method to get the value of a Text or Rich text element without traversing the Elements map.
- *
- * @param codename The element codename to retrieve the String rendering of from this ContentItem.
- * @return The value of the element. Returns null if the element does not exist, or if it is not a
- * {@link TextElement} or {@link RichTextElement}.
- */
- public String getString(String codename) {
- Element element = elements.get(codename);
- if (element == null) {
- return null;
- }
- if (!(element instanceof TextElement)) {
- return null;
- }
- return ((TextElement) element).getValue();
- }
-
- /**
- * Convenience method to get the value of an Assets element without traversing the Elements map.
- *
- * @param codename The element codename to get the Asset list of from this ContentItem.
- * @return A list of {@link Asset} objects. Returns an empty collection if the element does not exist, or
- * if it is not an {@link AssetsElement}.
- */
- public List getAssets(String codename) {
- Element element = elements.get(codename);
- if (element == null) {
- return Collections.emptyList();
- }
- if (!(element instanceof AssetsElement)) {
- return Collections.emptyList();
- }
- return ((AssetsElement) element).getValue();
- }
-
- /**
- * Convenience method to retrieve the ContentItem from linked items.
- *
- * @param codename The {@link ContentItem} codename of the linked item.
- * @return The {@link ContentItem}. Returns null if it was not included in the response.
- */
- public ContentItem getLinkedItem(String codename) {
- //This shouldn't happen if this is de-serialized from Jackson, but protecting against the NPE for unexpected
- //usages.
- if (linkedItemProvider == null) {
- return null;
- }
- return linkedItemProvider.getLinkedItems().get(codename);
- }
-
- /**
- * Returns a new instance of T by mapping fields to elements in this content item. Element fields are mapped
- * by automatically CamelCasing and checking for equality, unless otherwise annotated by an {@link ElementMapping}
- * annotation. T must have a default constructor and have standard setter methods.
- * When passing in Object.class, the type returned will be an instance of the class registered with the
- * {@link DeliveryClient} that is annotated with {@link ContentItemMapping} that matches the
- * {@link System#type} of this ContentItem (however still returned as type Object).
- *
- * If {@link Object} is passed in, the {@link StronglyTypedContentItemConverter} will cast this ContentItem to a
- * type that is mapped this ContentItem's {@link System#type} from a previous registration via the registration has
- * been done, then this same instance of ContentItem will be returned. Invoking {@link #castToDefault()} is the
- * same as invoking this method with {@link Object}.
- *
- * @param tClass The class which a new instance should be returned from using this ContentItem.
- * @param The type of class which will be returned.
- * @return An instance of T with data mapped from this {@link ContentItem}.
- * @see DeliveryClient#registerType(Class)
- * @see DeliveryClient#registerType(String, Class)
- * @see ContentItemMapping
- * @see ElementMapping
- * @see StronglyTypedContentItemConverter
- */
- public T castTo(Class tClass) {
- return stronglyTypedContentItemConverter.convert(this, linkedItemProvider.getLinkedItems(), tClass);
- }
-
- /**
- * Returns a new instance by mapping fields to elements in this content item. Element fields are mapped
- * by automatically CamelCasing and checking for equality, unless otherwise annotated by an {@link ElementMapping}
- * annotation. The type returned will be an instance of the class registered with the {@link DeliveryClient} that
- * is annotated with {@link ContentItemMapping} that matches the {@link System#type} of this ContentItem
- * (however still returned as type Object).
- *
- * If no registration has been done, then this same instance of ContentItem will be returned.
- *
- * @return An instance with data mapped from this {@link ContentItem}.
- * @see #castTo(Class)
- * @see DeliveryClient#registerType(Class)
- * @see DeliveryClient#registerType(String, Class)
- * @see ContentItemMapping
- * @see ElementMapping
- * @see StronglyTypedContentItemConverter
- */
- public Object castToDefault() {
- return this.castTo(Object.class);
- }
-
- /**
- * Returns a new instance by mapping fields to elements in this content item. Element fields are mapped
- * by automatically CamelCasing and checking for equality, unless otherwise annotated by an {@link ElementMapping}
- * annotation. The type returned will be an instance of the class registered with the {@link DeliveryClient} that
- * that matches the {@link System#type} provided.
- *
- * If no registration has been done, then this same instance of ContentItem will be returned.
- *
- * @param contentItemSystemType The contentItemSystemType to match this ContentItem too.
- * @return An instance with data mapped from this {@link ContentItem}.
- * @see #castTo(Class)
- * @see DeliveryClient#registerType(Class)
- * @see DeliveryClient#registerType(String, Class)
- * @see ContentItemMapping
- * @see ElementMapping
- * @see StronglyTypedContentItemConverter
- */
- public Object castTo(String contentItemSystemType) {
- return stronglyTypedContentItemConverter.convert(
- this, linkedItemProvider.getLinkedItems(), contentItemSystemType);
- }
-
- void setLinkedItemProvider(LinkedItemProvider linkedItemProvider) {
- this.linkedItemProvider = linkedItemProvider;
- }
-
- void setStronglyTypedContentItemConverter(StronglyTypedContentItemConverter stronglyTypedContentItemConverter) {
- this.stronglyTypedContentItemConverter = stronglyTypedContentItemConverter;
- }
-}
+/*
+ * MIT License
+ *
+ * Copyright (c) 2022 Kontent s.r.o.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package kontent.ai.delivery;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Object model description of a single content item object.
+ *
+ * @see
+ * Kontent.ai API reference - Content item object
+ */
+@lombok.Data
+@lombok.NoArgsConstructor
+@lombok.AllArgsConstructor
+@lombok.Builder
+@lombok.EqualsAndHashCode(exclude = {"linkedItemProvider", "stronglyTypedContentItemConverter"})
+@lombok.ToString(exclude = {"linkedItemProvider", "stronglyTypedContentItemConverter"})
+public class ContentItem {
+
+ /**
+ * {@link System} attributes of the content item.
+ *
+ * @param system New value for System attributes of this content item.
+ * @return The System attributes of this content item.
+ */
+ @JsonProperty("system")
+ System system;
+
+ /**
+ * Content type elements in the content item. These are keyed by the codename of the element.
+ *
+ * Note: The order of the {@link Element} objects might not match the order in the Kontent.ai UI.
+ *
+ * @return Map of this ContentItem's {@link Element} objects.
+ */
+ @JsonProperty("elements")
+ Map elements;
+
+ @JsonIgnore
+ LinkedItemProvider linkedItemProvider;
+
+ @JsonIgnore
+ private StronglyTypedContentItemConverter stronglyTypedContentItemConverter;
+
+ /**
+ * Content type elements in the content item. These are keyed by the codename of the element.
+ *
+ * Note: The order of the {@link Element} objects might not match the order in the Kontent.ai UI.
+ *
+ * @param elements New value for this ContentItem's {@link Element} objects.
+ */
+ public void setElements(Map elements) {
+ this.elements = elements;
+ elements.forEach((s, element) -> element.setParent(this));
+ }
+
+ /**
+ * Convenience method to get the value of a Text or Rich text element without traversing the Elements map.
+ *
+ * @param codename The element codename to retrieve the String rendering of from this ContentItem.
+ * @return The value of the element. Returns null if the element does not exist, or if it is not a
+ * {@link TextElement} or {@link RichTextElement}.
+ */
+ public String getString(String codename) {
+ Element element = elements.get(codename);
+ if (element == null) {
+ return null;
+ }
+ if (!(element instanceof TextElement)) {
+ return null;
+ }
+ return ((TextElement) element).getValue();
+ }
+
+ /**
+ * Convenience method to get the value of an Assets element without traversing the Elements map.
+ *
+ * @param codename The element codename to get the Asset list of from this ContentItem.
+ * @return A list of {@link Asset} objects. Returns an empty collection if the element does not exist, or
+ * if it is not an {@link AssetsElement}.
+ */
+ public List getAssets(String codename) {
+ Element element = elements.get(codename);
+ if (element == null) {
+ return Collections.emptyList();
+ }
+ if (!(element instanceof AssetsElement)) {
+ return Collections.emptyList();
+ }
+ return ((AssetsElement) element).getValue();
+ }
+
+ /**
+ * Convenience method to retrieve the ContentItem from linked items.
+ *
+ * @param codename The {@link ContentItem} codename of the linked item.
+ * @return The {@link ContentItem}. Returns null if it was not included in the response.
+ */
+ public ContentItem getLinkedItem(String codename) {
+ //This shouldn't happen if this is de-serialized from Jackson, but protecting against the NPE for unexpected
+ //usages.
+ if (linkedItemProvider == null) {
+ return null;
+ }
+ return linkedItemProvider.getLinkedItems().get(codename);
+ }
+
+ /**
+ * Returns a new instance of T by mapping fields to elements in this content item. Element fields are mapped
+ * by automatically CamelCasing and checking for equality, unless otherwise annotated by an {@link ElementMapping}
+ * annotation. T must have a default constructor and have standard setter methods.
+ * When passing in Object.class, the type returned will be an instance of the class registered with the
+ * {@link DeliveryClient} that is annotated with {@link ContentItemMapping} that matches the
+ * {@link System#type} of this ContentItem (however still returned as type Object).
+ *
+ * If {@link Object} is passed in, the {@link StronglyTypedContentItemConverter} will cast this ContentItem to a
+ * type that is mapped this ContentItem's {@link System#type} from a previous registration via the registration has
+ * been done, then this same instance of ContentItem will be returned. Invoking {@link #castToDefault()} is the
+ * same as invoking this method with {@link Object}.
+ *
+ * @param tClass The class which a new instance should be returned from using this ContentItem.
+ * @param The type of class which will be returned.
+ * @return An instance of T with data mapped from this {@link ContentItem}.
+ * @see DeliveryClient#registerType(Class)
+ * @see DeliveryClient#registerType(String, Class)
+ * @see ContentItemMapping
+ * @see ElementMapping
+ * @see StronglyTypedContentItemConverter
+ */
+ public T castTo(Class tClass) {
+ return stronglyTypedContentItemConverter.convert(this, linkedItemProvider.getLinkedItems(), tClass);
+ }
+
+ /**
+ * Returns a new instance by mapping fields to elements in this content item. Element fields are mapped
+ * by automatically CamelCasing and checking for equality, unless otherwise annotated by an {@link ElementMapping}
+ * annotation. The type returned will be an instance of the class registered with the {@link DeliveryClient} that
+ * is annotated with {@link ContentItemMapping} that matches the {@link System#type} of this ContentItem
+ * (however still returned as type Object).
+ *
+ * If no registration has been done, then this same instance of ContentItem will be returned.
+ *
+ * @return An instance with data mapped from this {@link ContentItem}.
+ * @see #castTo(Class)
+ * @see DeliveryClient#registerType(Class)
+ * @see DeliveryClient#registerType(String, Class)
+ * @see ContentItemMapping
+ * @see ElementMapping
+ * @see StronglyTypedContentItemConverter
+ */
+ public Object castToDefault() {
+ return this.castTo(Object.class);
+ }
+
+ /**
+ * Returns a new instance by mapping fields to elements in this content item. Element fields are mapped
+ * by automatically CamelCasing and checking for equality, unless otherwise annotated by an {@link ElementMapping}
+ * annotation. The type returned will be an instance of the class registered with the {@link DeliveryClient} that
+ * that matches the {@link System#type} provided.
+ *
+ * If no registration has been done, then this same instance of ContentItem will be returned.
+ *
+ * @param contentItemSystemType The contentItemSystemType to match this ContentItem too.
+ * @return An instance with data mapped from this {@link ContentItem}.
+ * @see #castTo(Class)
+ * @see DeliveryClient#registerType(Class)
+ * @see DeliveryClient#registerType(String, Class)
+ * @see ContentItemMapping
+ * @see ElementMapping
+ * @see StronglyTypedContentItemConverter
+ */
+ public Object castTo(String contentItemSystemType) {
+ return stronglyTypedContentItemConverter.convert(
+ this, linkedItemProvider.getLinkedItems(), contentItemSystemType);
+ }
+
+ void setLinkedItemProvider(LinkedItemProvider linkedItemProvider) {
+ this.linkedItemProvider = linkedItemProvider;
+ }
+
+ void setStronglyTypedContentItemConverter(StronglyTypedContentItemConverter stronglyTypedContentItemConverter) {
+ this.stronglyTypedContentItemConverter = stronglyTypedContentItemConverter;
+ }
+}
diff --git a/delivery-sdk/src/main/java/kontent/ai/delivery/ContentItemResponse.java b/delivery-sdk/src/main/java/kontent/ai/delivery/ContentItemResponse.java
index 3c272d0b..1747940b 100644
--- a/delivery-sdk/src/main/java/kontent/ai/delivery/ContentItemResponse.java
+++ b/delivery-sdk/src/main/java/kontent/ai/delivery/ContentItemResponse.java
@@ -1,128 +1,129 @@
-/*
- * MIT License
- *
- * Copyright (c) 2022 Kontent s.r.o.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package kontent.ai.delivery;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Content item listing response from an invocation of {@link DeliveryClient#getItem(String)}, or
- * {@link DeliveryClient#getItem(String, List)}.
- *
- * @see
- * Kontent.ai API reference - Content item object
- * @see
- * Kontent.ai API reference - View a content item
- * @see ContentItem
- * @see DeliveryClient#getItem(String)
- * @see DeliveryClient#getItem(String, List)
- */
-@lombok.Getter
-@lombok.ToString(exclude = "stronglyTypedContentItemConverter")
-@lombok.EqualsAndHashCode(exclude = "stronglyTypedContentItemConverter")
-@lombok.NoArgsConstructor
-@lombok.AllArgsConstructor
-@lombok.Builder
-public class ContentItemResponse implements LinkedItemProvider {
-
- /**
- * The {@link ContentItem} returned by this ContentItemResponse.
- *
- * @see
- * Kontent.ai API reference - Content item object
- * @see
- * Kontent.ai API reference - View a content item
- * @return The {@link ContentItem} of this ContentItemResponse.
- */
- @JsonProperty("item")
- ContentItem item;
-
- /**
- * A map of content items used in linked item and Rich text elements.
- *
- * @see
- * Kontent.ai API reference - Linked items
- * @see
- * Kontent.ai API reference - Content item object
- * @see
- * Kontent.ai API reference - View a content item
- * @return The linked {@link ContentItem}s referenced in this response.
- */
- @JsonProperty("modular_content")
- Map linkedItems;
-
- @JsonIgnore
- private StronglyTypedContentItemConverter stronglyTypedContentItemConverter;
-
- /**
- * Returns a new instance of T by mapping fields to elements in this response's {@link #getItem()}. Element fields
- * are mapped by automatically CamelCasing and checking for equality, unless otherwise annotated by an
- * {@link ElementMapping} annotation. T must have a default constructor and have standard setter methods. When
- * passing in Object.class, the type returned will be an instance of the class registered with the
- * {@link DeliveryClient} that is annotated with {@link ContentItemMapping} that matches the
- * {@link System#type} of this ContentItem (however still returned as type Object).
- *
- * If {@link Object} is passed in, the {@link StronglyTypedContentItemConverter} will cast this ContentItem to a
- * type that is mapped this ContentItem's {@link System#type} from a previous registration via the
- * {@link DeliveryClient#registerType(Class)} or {@link DeliveryClient#registerType(String, Class)} methods. If no
- * registration has been done, then this same instance of ContentItem will be returned.
- *
- * @param tClass The class which a new instance should be returned from using this ContentItem.
- * @param The type of class which will be returned.
- * @return An instance of T with data mapped from the {@link ContentItem} in this response.
- * @see DeliveryClient#registerType(Class)
- * @see DeliveryClient#registerType(String, Class)
- * @see ContentItemMapping
- * @see ElementMapping
- * @see StronglyTypedContentItemConverter
- */
- public T castTo(Class tClass) {
- return stronglyTypedContentItemConverter.convert(item, this.getLinkedItems(), tClass);
- }
-
- void setItem(ContentItem item) {
- this.item = item;
- item.setLinkedItemProvider(this);
- }
-
- void setLinkedItems(Map linkedItems) {
- this.linkedItems = linkedItems;
- linkedItems.values().forEach(contentItem -> contentItem.setLinkedItemProvider(this));
- }
-
- ContentItemResponse setStronglyTypedContentItemConverter(StronglyTypedContentItemConverter stronglyTypedContentItemConverter) {
- this.stronglyTypedContentItemConverter = stronglyTypedContentItemConverter;
- item.setStronglyTypedContentItemConverter(stronglyTypedContentItemConverter);
- if (linkedItems != null) {
- for (ContentItem linkedItem : linkedItems.values()) {
- linkedItem.setStronglyTypedContentItemConverter(stronglyTypedContentItemConverter);
- }
- }
- return this;
- }
-}
+/*
+ * MIT License
+ *
+ * Copyright (c) 2022 Kontent s.r.o.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package kontent.ai.delivery;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Content item listing response from an invocation of {@link DeliveryClient#getItem(String)}, or
+ * {@link DeliveryClient#getItem(String, List)}.
+ *
+ * @see
+ * Kontent.ai API reference - Content item object
+ * @see
+ * Kontent.ai API reference - View a content item
+ * @see ContentItem
+ * @see DeliveryClient#getItem(String)
+ * @see DeliveryClient#getItem(String, List)
+ */
+@lombok.Getter
+@lombok.ToString(exclude = "stronglyTypedContentItemConverter")
+@lombok.EqualsAndHashCode(exclude = "stronglyTypedContentItemConverter")
+@lombok.NoArgsConstructor
+@lombok.AllArgsConstructor
+@lombok.Builder
+public class ContentItemResponse implements LinkedItemProvider {
+
+ /**
+ * The {@link ContentItem} returned by this ContentItemResponse.
+ *
+ * @see
+ * Kontent.ai API reference - Content item object
+ * @see
+ * Kontent.ai API reference - View a content item
+ * @return The {@link ContentItem} of this ContentItemResponse.
+ */
+ @JsonProperty("item")
+ ContentItem item;
+
+ /**
+ * A map of content items used in linked item and Rich text elements.
+ *
+ * @see
+ * Kontent.ai API reference - Linked items
+ * @see
+ * Kontent.ai API reference - Content item object
+ * @see
+ * Kontent.ai API reference - View a content item
+ * @return The linked {@link ContentItem}s referenced in this response.
+ */
+ @JsonProperty("modular_content")
+ Map linkedItems;
+
+ @JsonIgnore
+ private StronglyTypedContentItemConverter stronglyTypedContentItemConverter;
+
+ /**
+ * Returns a new instance of T by mapping fields to elements in this response's {@link #getItem()}. Element fields
+ * are mapped by automatically CamelCasing and checking for equality, unless otherwise annotated by an
+ * {@link ElementMapping} annotation. T must have a default constructor and have standard setter methods. When
+ * passing in Object.class, the type returned will be an instance of the class registered with the
+ * {@link DeliveryClient} that is annotated with {@link ContentItemMapping} that matches the
+ * {@link System#type} of this ContentItem (however still returned as type Object).
+ *
+ * If {@link Object} is passed in, the {@link StronglyTypedContentItemConverter} will cast this ContentItem to a
+ * type that is mapped this ContentItem's {@link System#type} from a previous registration via the
+ * {@link DeliveryClient#registerType(Class)} or {@link DeliveryClient#registerType(String, Class)} methods. If no
+ * registration has been done, then this same instance of ContentItem will be returned.
+ *
+ * @param tClass The class which a new instance should be returned from using this ContentItem.
+ * @param The type of class which will be returned.
+ * @return An instance of T with data mapped from the {@link ContentItem} in this response.
+ * @see DeliveryClient#registerType(Class)
+ * @see DeliveryClient#registerType(String, Class)
+ * @see ContentItemMapping
+ * @see ElementMapping
+ * @see StronglyTypedContentItemConverter
+ */
+ public T castTo(Class tClass) {
+ return stronglyTypedContentItemConverter.convert(item, this.getLinkedItems(), tClass);
+ }
+
+ void setItem(ContentItem item) {
+ this.item = item;
+ item.setLinkedItemProvider(this);
+ }
+
+ void setLinkedItems(Map linkedItems) {
+ this.linkedItems = linkedItems;
+ linkedItems.values().forEach(contentItem -> contentItem.setLinkedItemProvider(this));
+ }
+
+ ContentItemResponse setStronglyTypedContentItemConverter(StronglyTypedContentItemConverter stronglyTypedContentItemConverter) {
+ this.stronglyTypedContentItemConverter = stronglyTypedContentItemConverter;
+ item.setStronglyTypedContentItemConverter(stronglyTypedContentItemConverter);
+ if (linkedItems != null) {
+ for (ContentItem linkedItem : linkedItems.values()) {
+ linkedItem.setStronglyTypedContentItemConverter(stronglyTypedContentItemConverter);
+ }
+ }
+ return this;
+ }
+}
diff --git a/delivery-sdk/src/main/java/kontent/ai/delivery/DateTimeElement.java b/delivery-sdk/src/main/java/kontent/ai/delivery/DateTimeElement.java
index 9d54fed6..a4a135d2 100644
--- a/delivery-sdk/src/main/java/kontent/ai/delivery/DateTimeElement.java
+++ b/delivery-sdk/src/main/java/kontent/ai/delivery/DateTimeElement.java
@@ -1,60 +1,61 @@
-/*
- * MIT License
- *
- * Copyright (c) 2022 Kontent s.r.o.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package kontent.ai.delivery;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.time.ZonedDateTime;
-
-/**
- * Object model for Date & time elements.
- *
- * @see Asset
- * @see
- * Kontent.ai API reference - Date time
- * @see
- * Kontent.ai API reference - Content item object
- */
-@lombok.Getter
-@lombok.Setter
-@lombok.ToString(callSuper = true)
-@lombok.EqualsAndHashCode(callSuper = true)
-public class DateTimeElement extends Element {
-
- static final String TYPE_VALUE = "date_time";
-
- /**
- * The value of a Date & time element is a string in the ISO 8601 format. If empty, the value is null.
- *
- * @param value New value of the {@link ZonedDateTime} of this element.
- * @return A {@link ZonedDateTime} instance representing the original ISO 8601 string.
- */
- @JsonProperty("value")
- ZonedDateTime value;
-
- public DateTimeElement() {
- setType(TYPE_VALUE);
- }
-}
+/*
+ * MIT License
+ *
+ * Copyright (c) 2022 Kontent s.r.o.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package kontent.ai.delivery;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.time.ZonedDateTime;
+
+/**
+ * Object model for Date & time elements.
+ *
+ * @see Asset
+ * @see
+ * Kontent.ai API reference - Date time
+ * @see
+ * Kontent.ai API reference - Content item object
+ */
+@lombok.Getter
+@lombok.Setter
+@lombok.ToString(callSuper = true)
+@lombok.EqualsAndHashCode(callSuper = true)
+public class DateTimeElement extends Element {
+
+ static final String TYPE_VALUE = "date_time";
+
+ /**
+ * The value of a Date & time element is a string in the ISO 8601 format. If empty, the value is null.
+ *
+ * @param value New value of the {@link ZonedDateTime} of this element.
+ * @return A {@link ZonedDateTime} instance representing the original ISO 8601 string.
+ */
+ @JsonProperty("value")
+ ZonedDateTime value;
+
+ public DateTimeElement() {
+ setType(TYPE_VALUE);
+ }
+}
diff --git a/delivery-sdk/src/main/java/kontent/ai/delivery/Element.java b/delivery-sdk/src/main/java/kontent/ai/delivery/Element.java
index bcb2be35..bef3964e 100644
--- a/delivery-sdk/src/main/java/kontent/ai/delivery/Element.java
+++ b/delivery-sdk/src/main/java/kontent/ai/delivery/Element.java
@@ -1,108 +1,109 @@
-/*
- * MIT License
- *
- * Copyright (c) 2022 Kontent s.r.o.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package kontent.ai.delivery;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonSubTypes;
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-
-import java.util.List;
-
-/**
- * Parent object model of individual elements
- *
- * When retrieving content items or content types, you get an elements collection as a part of the retrieved item or
- * type.
- */
-@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
-@JsonSubTypes({
- @JsonSubTypes.Type(value = TextElement.class, name = TextElement.TYPE_VALUE),
- @JsonSubTypes.Type(value = RichTextElement.class, name = RichTextElement.TYPE_VALUE),
- @JsonSubTypes.Type(value = MultipleChoiceElement.class, name = MultipleChoiceElement.TYPE_VALUE),
- @JsonSubTypes.Type(value = NumberElement.class, name = NumberElement.TYPE_VALUE),
- @JsonSubTypes.Type(value = DateTimeElement.class, name = DateTimeElement.TYPE_VALUE),
- @JsonSubTypes.Type(value = AssetsElement.class, name = AssetsElement.TYPE_VALUE),
- @JsonSubTypes.Type(value = LinkedItem.class, name = LinkedItem.TYPE_VALUE),
- @JsonSubTypes.Type(value = TaxonomyElement.class, name = TaxonomyElement.TYPE_VALUE),
- @JsonSubTypes.Type(value = UrlSlugElement.class, name = UrlSlugElement.TYPE_VALUE),
- @JsonSubTypes.Type(value = CustomElement.class, name = CustomElement.TYPE_VALUE)
-})
-@lombok.Getter
-@lombok.Setter
-@lombok.ToString(exclude = "parent")
-@lombok.EqualsAndHashCode(exclude = "parent")
-@lombok.NoArgsConstructor
-public abstract class Element {
-
- /**
- * Type of the element
- *
- * Valid values: text, rich_text, number, multiple_choice, date_time, asset, modular_content
- * ({@link LinkedItem}), taxonomy, url_slug.
- *
- * @param type the type of element
- * @return the codename for this element type
- */
- @JsonProperty("type")
- String type;
-
- /**
- * Display name of the element
- *
- * @param name the name of this element
- * @return the display name of this element
- */
- @JsonProperty("name")
- String name;
-
- /**
- * The codename for this element
- *
- * Note: This is only populated when querying an individual content type element.
- *
- * @param codeName the codename of this element
- * @return codename for this content type element as defined in a content type
- * @see DeliveryClient#getContentTypeElement(String, String)
- * @see DeliveryClient#getContentTypeElement(String, String, List)
- */
- @JsonProperty("codename")
- String codeName;
-
- /**
- * A reference to the parent ContentItem to this element.
- *
- * @param parent the parent to this
- * @return the parent to this
- */
- @JsonIgnore
- ContentItem parent;
-
- /**
- * Returns the value of the element.
- * @return The value of the element.
- */
- public abstract T getValue();
-}
+/*
+ * MIT License
+ *
+ * Copyright (c) 2022 Kontent s.r.o.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package kontent.ai.delivery;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Parent object model of individual elements
+ *
+ * When retrieving content items or content types, you get an elements collection as a part of the retrieved item or
+ * type.
+ */
+@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
+@JsonSubTypes({
+ @JsonSubTypes.Type(value = TextElement.class, name = TextElement.TYPE_VALUE),
+ @JsonSubTypes.Type(value = RichTextElement.class, name = RichTextElement.TYPE_VALUE),
+ @JsonSubTypes.Type(value = MultipleChoiceElement.class, name = MultipleChoiceElement.TYPE_VALUE),
+ @JsonSubTypes.Type(value = NumberElement.class, name = NumberElement.TYPE_VALUE),
+ @JsonSubTypes.Type(value = DateTimeElement.class, name = DateTimeElement.TYPE_VALUE),
+ @JsonSubTypes.Type(value = AssetsElement.class, name = AssetsElement.TYPE_VALUE),
+ @JsonSubTypes.Type(value = LinkedItem.class, name = LinkedItem.TYPE_VALUE),
+ @JsonSubTypes.Type(value = TaxonomyElement.class, name = TaxonomyElement.TYPE_VALUE),
+ @JsonSubTypes.Type(value = UrlSlugElement.class, name = UrlSlugElement.TYPE_VALUE),
+ @JsonSubTypes.Type(value = CustomElement.class, name = CustomElement.TYPE_VALUE)
+})
+@lombok.Getter
+@lombok.Setter
+@lombok.ToString(exclude = "parent")
+@lombok.EqualsAndHashCode(exclude = "parent")
+@lombok.NoArgsConstructor
+public abstract class Element {
+
+ /**
+ * Type of the element
+ *
+ * Valid values: text, rich_text, number, multiple_choice, date_time, asset, modular_content
+ * ({@link LinkedItem}), taxonomy, url_slug.
+ *
+ * @param type the type of element
+ * @return the codename for this element type
+ */
+ @JsonProperty("type")
+ String type;
+
+ /**
+ * Display name of the element
+ *
+ * @param name the name of this element
+ * @return the display name of this element
+ */
+ @JsonProperty("name")
+ String name;
+
+ /**
+ * The codename for this element
+ *
+ * Note: This is only populated when querying an individual content type element.
+ *
+ * @param codeName the codename of this element
+ * @return codename for this content type element as defined in a content type
+ * @see DeliveryClient#getContentTypeElement(String, String)
+ * @see DeliveryClient#getContentTypeElement(String, String, List)
+ */
+ @JsonProperty("codename")
+ String codeName;
+
+ /**
+ * A reference to the parent ContentItem to this element.
+ *
+ * @param parent the parent to this
+ * @return the parent to this
+ */
+ @JsonIgnore
+ ContentItem parent;
+
+ /**
+ * Returns the value of the element.
+ * @return The value of the element.
+ */
+ public abstract T getValue();
+}
diff --git a/delivery-sdk/src/main/java/kontent/ai/delivery/Image.java b/delivery-sdk/src/main/java/kontent/ai/delivery/Image.java
index 6d7fb4d3..e5c62883 100644
--- a/delivery-sdk/src/main/java/kontent/ai/delivery/Image.java
+++ b/delivery-sdk/src/main/java/kontent/ai/delivery/Image.java
@@ -1,72 +1,74 @@
-/*
- * MIT License
- *
- * Copyright (c) 2022 Kontent s.r.o.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package kontent.ai.delivery;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * Object model for Image elements
- *
- * Images associated with rich text elements
- *
- * @see RichTextElement
- */
-@lombok.Getter
-@lombok.Setter
-@lombok.ToString
-@lombok.EqualsAndHashCode
-@lombok.NoArgsConstructor
-public class Image {
-
- /**
- * ID of the image
- *
- * @param imageId Sets the imageId of this
- * @return This imageId
- */
- @JsonProperty("image_id")
- String imageId;
-
- /**
- * Description of the image
- *
- * Used for the alt attribute of an <img> tag.
- *
- * @param description Sets the description of this
- * @return The image description of this
- */
- @JsonProperty("description")
- String description;
-
- /**
- * Absolute URL for the image
- *
- * @param url Sets the url of this
- * @return An absolute URL image hosted by Kontent.ai
- */
- @JsonProperty("url")
- String url;
-
-}
+/*
+ * MIT License
+ *
+ * Copyright (c) 2022 Kontent s.r.o.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package kontent.ai.delivery;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.io.Serializable;
+
+/**
+ * Object model for Image elements
+ *
+ * Images associated with rich text elements
+ *
+ * @see RichTextElement
+ */
+@lombok.Getter
+@lombok.Setter
+@lombok.ToString
+@lombok.EqualsAndHashCode
+@lombok.NoArgsConstructor
+public class Image {
+
+ /**
+ * ID of the image
+ *
+ * @param imageId Sets the imageId of this
+ * @return This imageId
+ */
+ @JsonProperty("image_id")
+ String imageId;
+
+ /**
+ * Description of the image
+ *
+ * Used for the alt attribute of an <img> tag.
+ *
+ * @param description Sets the description of this
+ * @return The image description of this
+ */
+ @JsonProperty("description")
+ String description;
+
+ /**
+ * Absolute URL for the image
+ *
+ * @param url Sets the url of this
+ * @return An absolute URL image hosted by Kontent.ai
+ */
+ @JsonProperty("url")
+ String url;
+
+}
diff --git a/delivery-sdk/src/main/java/kontent/ai/delivery/Link.java b/delivery-sdk/src/main/java/kontent/ai/delivery/Link.java
index 969f1a7c..a57a095f 100644
--- a/delivery-sdk/src/main/java/kontent/ai/delivery/Link.java
+++ b/delivery-sdk/src/main/java/kontent/ai/delivery/Link.java
@@ -1,72 +1,74 @@
-/*
- * MIT License
- *
- * Copyright (c) 2022 Kontent s.r.o.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package kontent.ai.delivery;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * Object model for Link elements
- *
- * Links associated with rich text elements
- *
- * @see RichTextElement
- */
-@lombok.Getter
-@lombok.Setter
-@lombok.ToString
-@lombok.EqualsAndHashCode
-@lombok.NoArgsConstructor
-public class Link {
-
- /**
- * Content type of the content item
- *
- * @param type Sets the type of this.
- * @return The content item type codename.
- */
- @JsonProperty("type")
- String type;
-
- /**
- * Display name of the element
- *
- * @param codename Sets the codename of this.
- * @return The codename of the link element.
- */
- @JsonProperty("codename")
- String codename;
-
- /**
- * URL slug of the content item
- *
- * Empty string if the content item's type does not use a URL slug element
- *
- * @param urlSlug Sets the urlSlug of this.
- * @return URL slug of the content item.
- */
- @JsonProperty("url_slug")
- String urlSlug;
-
-}
+/*
+ * MIT License
+ *
+ * Copyright (c) 2022 Kontent s.r.o.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package kontent.ai.delivery;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.io.Serializable;
+
+/**
+ * Object model for Link elements
+ *
+ * Links associated with rich text elements
+ *
+ * @see RichTextElement
+ */
+@lombok.Getter
+@lombok.Setter
+@lombok.ToString
+@lombok.EqualsAndHashCode
+@lombok.NoArgsConstructor
+public class Link {
+
+ /**
+ * Content type of the content item
+ *
+ * @param type Sets the type of this.
+ * @return The content item type codename.
+ */
+ @JsonProperty("type")
+ String type;
+
+ /**
+ * Display name of the element
+ *
+ * @param codename Sets the codename of this.
+ * @return The codename of the link element.
+ */
+ @JsonProperty("codename")
+ String codename;
+
+ /**
+ * URL slug of the content item
+ *
+ * Empty string if the content item's type does not use a URL slug element
+ *
+ * @param urlSlug Sets the urlSlug of this.
+ * @return URL slug of the content item.
+ */
+ @JsonProperty("url_slug")
+ String urlSlug;
+
+}
diff --git a/delivery-sdk/src/main/java/kontent/ai/delivery/NameValuePair.java b/delivery-sdk/src/main/java/kontent/ai/delivery/NameValuePair.java
index d62214fa..f0cfc206 100644
--- a/delivery-sdk/src/main/java/kontent/ai/delivery/NameValuePair.java
+++ b/delivery-sdk/src/main/java/kontent/ai/delivery/NameValuePair.java
@@ -1,37 +1,37 @@
-/*
- * MIT License
- *
- * Copyright (c) 2022 Kontent s.r.o.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package kontent.ai.delivery;
-
-import lombok.AllArgsConstructor;
-import lombok.Data;
-
-import java.io.Serializable;
-
-@Data
-@AllArgsConstructor
-public class NameValuePair implements Serializable {
- private String name;
- private String value;
-}
+/*
+ * MIT License
+ *
+ * Copyright (c) 2022 Kontent s.r.o.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package kontent.ai.delivery;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+@AllArgsConstructor
+public class NameValuePair {
+ private String name;
+ private String value;
+}
diff --git a/delivery-sdk/src/main/java/kontent/ai/delivery/Option.java b/delivery-sdk/src/main/java/kontent/ai/delivery/Option.java
index b47071bf..2d9414a6 100644
--- a/delivery-sdk/src/main/java/kontent/ai/delivery/Option.java
+++ b/delivery-sdk/src/main/java/kontent/ai/delivery/Option.java
@@ -1,57 +1,59 @@
-/*
- * MIT License
- *
- * Copyright (c) 2022 Kontent s.r.o.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package kontent.ai.delivery;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * Object model for option values in a {@link MultipleChoiceElement}
- */
-@lombok.Getter
-@lombok.Setter
-@lombok.ToString
-@lombok.EqualsAndHashCode
-@lombok.NoArgsConstructor
-public class Option {
-
- /**
- * The display name of the option
- *
- * @param name Sets the display name of this.
- * @return The name of the option.
- */
- @JsonProperty("name")
- String name;
-
- /**
- * The codename of the option
- *
- * @param codename Sets the codename of this.
- * @return The codename of the option.
- */
- @JsonProperty("codename")
- String codename;
-
-}
+/*
+ * MIT License
+ *
+ * Copyright (c) 2022 Kontent s.r.o.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package kontent.ai.delivery;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.io.Serializable;
+
+/**
+ * Object model for option values in a {@link MultipleChoiceElement}
+ */
+@lombok.Getter
+@lombok.Setter
+@lombok.ToString
+@lombok.EqualsAndHashCode
+@lombok.NoArgsConstructor
+public class Option {
+
+ /**
+ * The display name of the option
+ *
+ * @param name Sets the display name of this.
+ * @return The name of the option.
+ */
+ @JsonProperty("name")
+ String name;
+
+ /**
+ * The codename of the option
+ *
+ * @param codename Sets the codename of this.
+ * @return The codename of the option.
+ */
+ @JsonProperty("codename")
+ String codename;
+
+}
diff --git a/delivery-sdk/src/main/java/kontent/ai/delivery/StronglyTypedContentItemConverter.java b/delivery-sdk/src/main/java/kontent/ai/delivery/StronglyTypedContentItemConverter.java
index 6d72dd80..461d7637 100644
--- a/delivery-sdk/src/main/java/kontent/ai/delivery/StronglyTypedContentItemConverter.java
+++ b/delivery-sdk/src/main/java/kontent/ai/delivery/StronglyTypedContentItemConverter.java
@@ -1,362 +1,363 @@
-/*
- * MIT License
- *
- * Copyright (c) 2022 Kontent s.r.o.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package kontent.ai.delivery;
-
-import com.madrobot.beans.BeanInfo;
-import com.madrobot.beans.IntrospectionException;
-import com.madrobot.beans.Introspector;
-import com.madrobot.beans.PropertyDescriptor;
-import io.github.classgraph.ClassGraph;
-import io.github.classgraph.ClassInfoList;
-import io.github.classgraph.ScanResult;
-import org.jetbrains.annotations.NotNull;
-
-import java.lang.reflect.*;
-import java.util.*;
-
-@lombok.extern.slf4j.Slf4j
-public class StronglyTypedContentItemConverter {
-
- private HashMap contentTypeToClassNameMapping = new HashMap<>();
- private HashMap classNameToContentTypeMapping = new HashMap<>();
- private HashMap typeNameToInlineResolverMapping = new HashMap<>();
-
- protected StronglyTypedContentItemConverter() {
- //protected constructor
- }
-
- protected void registerType(String contentType, Class> clazz) {
- contentTypeToClassNameMapping.put(contentType, clazz.getName());
- classNameToContentTypeMapping.put(clazz.getName(), contentType);
- }
-
- protected void registerType(Class> clazz) {
- ContentItemMapping clazzContentItemMapping = clazz.getAnnotation(ContentItemMapping.class);
- if (clazzContentItemMapping == null) {
- throw new IllegalArgumentException("Passed in class must be annotated with @ContentItemMapping, " +
- "if this is not possible, please use registerType(String, Class)");
- }
- registerType(clazzContentItemMapping.value(), clazz);
- log.debug("Registered type for {}", clazz.getSimpleName());
- }
-
- protected String getContentType(Class tClass) {
- if (classNameToContentTypeMapping.containsKey(tClass.getName())) {
- return classNameToContentTypeMapping.get(tClass.getName());
- }
- return null;
- }
-
- protected void registerInlineContentItemsResolver(InlineContentItemsResolver resolver) {
- typeNameToInlineResolverMapping.put(resolver.getType().getTypeName(), resolver);
- }
-
- protected InlineContentItemsResolver getResolverForType(String contentType) {
- if (contentTypeToClassNameMapping.containsKey(contentType) &&
- typeNameToInlineResolverMapping.containsKey(contentTypeToClassNameMapping.get(contentType))) {
- return typeNameToInlineResolverMapping.get(contentTypeToClassNameMapping.get(contentType));
- }
- return null;
- }
-
- protected InlineContentItemsResolver getResolverForType(ContentItem contentItem) {
- System system = contentItem.getSystem();
- if (system != null) {
- return getResolverForType(system.getType());
- }
- return null;
- }
-
- /**
- * Not working on Android platform because of JVM and Dalvik differences, please use {@link DeliveryClient#registerType(Class)} instead
- * @param basePackage name of the base package
- */
- protected void scanClasspathForMappings(String basePackage) {
- try (ScanResult scanResult = new ClassGraph()
- .enableAllInfo()
- .acceptPackages(basePackage)
- .scan()) {
- ClassInfoList mappings = scanResult.getClassesWithAnnotation(ContentItemMapping.class.getName());
- mappings.loadClasses().forEach(classWithAnnotation -> {
- ContentItemMapping contentItemMapping = classWithAnnotation.getAnnotation(ContentItemMapping.class);
- registerType(contentItemMapping.value(), classWithAnnotation);
- });
-
- ClassInfoList inlineResolvers = scanResult.getSubclasses(InlineContentItemsResolver.class.getName());
- inlineResolvers.loadClasses(InlineContentItemsResolver.class).forEach(subclass -> {
- try {
- registerInlineContentItemsResolver(subclass.getConstructor().newInstance());
- } catch (NoSuchMethodException |
- IllegalAccessException |
- InvocationTargetException |
- InstantiationException e) {
- // No default constructor, no InlineContentItemsResolver.
- }
- });
- }
- }
-
- Object convert(ContentItem item, Map linkedItems, String contentType) {
- String className = contentTypeToClassNameMapping.get(contentType);
- Class> mappingClass;
- try {
- mappingClass = Class.forName(className);
- } catch (ClassNotFoundException e) {
- return item;
- }
-
- if (mappingClass == null) {
- return item;
- }
-
- return convert(item, linkedItems, mappingClass);
- }
-
- T convert(ContentItem item, Map linkedItems, Class tClass) {
- if (tClass == Object.class) {
- String className = contentTypeToClassNameMapping.get(item.getSystem().getType());
- if (className == null) {
- return (T) item;
- }
- Class> mappingClass = null;
- try {
- mappingClass = Class.forName(className);
- } catch (ClassNotFoundException e) {
- return (T) item;
- }
- if (mappingClass == null) {
- return (T) item;
- }
- return (T) convert(item, linkedItems, mappingClass);
- }
- if (tClass == ContentItem.class) {
- return (T) item;
- }
- T bean = null;
- try {
- //Invoke the default constructor
- bean = tClass.getConstructor().newInstance();
-
- //Get the bean properties
- Field[] fields = tClass.getDeclaredFields();
-
- //Inject mappings
- for (Field field : fields) {
- Object value = getValueForField(item, linkedItems, bean, field);
- if (value != null) {
- Optional propertyDescriptor = getPropertyDescriptor(bean, field);
- if (propertyDescriptor.isPresent()) {
- propertyDescriptor.get().getWriteMethod().invoke(bean, value);
- }
- }
- }
- } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException e) {
- handleReflectionException(e);
- }
- //Return bean
- return bean;
- }
-
- private Object getValueForField(
- ContentItem item, Map linkedItems, Object bean, Field field) {
- //Inject System object
- if (field.getType() == System.class) {
- return item.getSystem();
- }
- //Explicit checks
- //Check to see if this is an explicitly mapped Element
- ElementMapping elementMapping = field.getAnnotation(ElementMapping.class);
- if (elementMapping != null && item.getElements().containsKey(elementMapping.value())) {
- return item.getElements().get(elementMapping.value()).getValue();
- }
- //Check to see if this is an explicitly mapped ContentItem
- ContentItemMapping contentItemMapping = field.getAnnotation(ContentItemMapping.class);
- if (contentItemMapping != null &&
- isListOrMap(field.getType()) &&
- item.getElements().containsKey(contentItemMapping.value()) &&
- item.getElements().get(contentItemMapping.value()) instanceof LinkedItem) {
- LinkedItem linkedItemElement =
- (LinkedItem) item.getElements().get(contentItemMapping.value());
- Map referencedLinkedItems = new LinkedHashMap<>();
- for (String codename : linkedItemElement.getValue()) {
- referencedLinkedItems.put(codename, linkedItems.get(codename));
- }
- return getCastedLinkedItemsForListOrMap(bean, field, referencedLinkedItems);
- }
- if (contentItemMapping != null && linkedItems.containsKey(contentItemMapping.value())) {
- return getCastedLinkedItemsForField(field.getType(), contentItemMapping.value(), linkedItems);
- }
-
- //Implicit checks
- String candidateCodename = fromCamelCase(field.getName());
- //Check to see if this is an implicitly mapped Element
- if (item.getElements().containsKey(candidateCodename)) {
- return item.getElements().get(candidateCodename).getValue();
- }
- //Check to see if this is an implicitly mapped ContentItem
- if (linkedItems.containsKey(candidateCodename)) {
- return getCastedLinkedItemsForField(field.getType(), candidateCodename, linkedItems);
- }
-
- //Check to see if this is a collection of implicitly mapped ContentItem
- if (isListOrMap(field.getType())) {
- return getCastedLinkedItemsForListOrMap(bean, field, linkedItems);
- }
- return null;
- }
-
- private Object getCastedLinkedItemsForField(
- Class> clazz, String codename, Map linkedItems) {
- ContentItem linkedItemsItem = linkedItems.get(codename);
- if (clazz == ContentItem.class) {
- return linkedItemsItem;
- }
- Map linkedItemsForRecursion =
- copyLinkedItemsWithExclusion(linkedItems, codename);
- return convert(linkedItemsItem, linkedItemsForRecursion, clazz);
- }
-
- private Object getCastedLinkedItemsForListOrMap(
- Object bean, Field field, Map linkedItems) {
- Type type = getType(bean, field);
- if (type == null) {
- // We have failed to get the type, probably due to a missing setter, skip this field
- log.debug("Failed to get type from {} (probably due to a missing setter), {} skipped", bean, field);
- return null;
- }
- if (type == ContentItem.class) {
- return castCollection(field.getType(), linkedItems);
- }
- Class> listClass = (Class>) type;
- String contentType = null;
- ContentItemMapping clazzContentItemMapping = listClass.getAnnotation(ContentItemMapping.class);
- if (clazzContentItemMapping != null) {
- contentType = clazzContentItemMapping.value();
- }
- if (contentType == null && classNameToContentTypeMapping.containsKey(listClass.getName())) {
- contentType = classNameToContentTypeMapping.get(listClass.getName());
- }
- if (contentType != null) {
- HashMap convertedLinkedItems = new HashMap<>();
- for (Map.Entry entry : linkedItems.entrySet()) {
- if (entry.getValue() != null && contentType.equals(entry.getValue().getSystem().getType())) {
- Map linkedItemsForRecursion =
- copyLinkedItemsWithExclusion(linkedItems, entry.getKey());
- convertedLinkedItems.put(entry.getKey(),
- convert(entry.getValue(), linkedItemsForRecursion, listClass));
- }
- }
- return castCollection(field.getType(), convertedLinkedItems);
- }
- return null;
- }
-
- private static String fromCamelCase(String s) {
- String regex = "([a-z])([A-Z]+)";
- String replacement = "$1_$2";
- return s.replaceAll(regex, replacement).toLowerCase();
- }
-
- // This function copies the linked item map while excluding an item, useful for a recursive stack
- protected Map copyLinkedItemsWithExclusion(
- Map orig, String excludedContentItem) {
- HashMap target = new HashMap<>();
- for (Map.Entry entry : orig.entrySet()) {
- if (!excludedContentItem.equals(entry.getKey())) {
- target.put(entry.getKey(), entry.getValue());
- }
- }
- return target;
- }
-
- private static boolean isListOrMap(Class> type) {
- return List.class.isAssignableFrom(type) || Map.class.isAssignableFrom(type);
- }
-
- private static Object castCollection(Class> type, Map items) {
- if (List.class.isAssignableFrom(type)) {
- return new ArrayList(items.values());
- }
- if (Map.class.isAssignableFrom(type)) {
- return items;
- }
- return items;
- }
-
- private static Type getType(Object bean, Field field) {
- //Because of type erasure, we will find the setter method and get the generic types off it's arguments
- Optional propertyDescriptor = getPropertyDescriptor(bean, field);
- if (!propertyDescriptor.isPresent()) {
- //Likely no accessors
- log.debug("Property descriptor for object {} with field {} is null", bean, field);
- return null;
- }
-
- Method writeMethod = propertyDescriptor.get().getWriteMethod();
- if (writeMethod == null) {
- log.debug("No write method for property {}", propertyDescriptor);
- return null;
- }
- Type[] actualTypeArguments = ((ParameterizedType) writeMethod.getGenericParameterTypes()[0])
- .getActualTypeArguments();
-
- Type type = (Map.class.isAssignableFrom(field.getType())) ? actualTypeArguments[1] : actualTypeArguments[0];
-
- log.debug("Got type {} from {}",
- type.getTypeName(),
- String.format("%s#%s", bean.getClass().getSimpleName(), field.getName()));
-
- return type;
- }
-
- @NotNull
- private static Optional getPropertyDescriptor(Object bean, Field field) {
- BeanInfo beanInfo = null;
- try {
- beanInfo = Introspector.getBeanInfo(bean.getClass());
- } catch (IntrospectionException e) {
- log.debug("IntrospectionException from com.madrobot.beans for object {} with field {} is null", bean, field);
- return null;
- }
- PropertyDescriptor[] properties = beanInfo.getPropertyDescriptors();
- Optional propertyDescriptor = Arrays.stream(properties).filter(descriptor -> descriptor.getName().equals(field.getName())).findFirst();
- return propertyDescriptor;
- }
-
- private static void handleReflectionException(Exception ex) {
- log.error("Reflection exception", ex);
- if (ex instanceof NoSuchMethodException) {
- throw new IllegalStateException("Method not found: " + ex.getMessage());
- }
- if (ex instanceof IllegalAccessException) {
- throw new IllegalStateException("Could not access method: " + ex.getMessage());
- }
- if (ex instanceof RuntimeException) {
- throw (RuntimeException) ex;
- }
-
- throw new UndeclaredThrowableException(ex);
- }
-}
+/*
+ * MIT License
+ *
+ * Copyright (c) 2022 Kontent s.r.o.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package kontent.ai.delivery;
+
+import com.madrobot.beans.BeanInfo;
+import com.madrobot.beans.IntrospectionException;
+import com.madrobot.beans.Introspector;
+import com.madrobot.beans.PropertyDescriptor;
+import io.github.classgraph.ClassGraph;
+import io.github.classgraph.ClassInfoList;
+import io.github.classgraph.ScanResult;
+import org.jetbrains.annotations.NotNull;
+
+import java.io.Serializable;
+import java.lang.reflect.*;
+import java.util.*;
+
+@lombok.extern.slf4j.Slf4j
+public class StronglyTypedContentItemConverter {
+
+ private HashMap contentTypeToClassNameMapping = new HashMap<>();
+ private HashMap classNameToContentTypeMapping = new HashMap<>();
+ private HashMap typeNameToInlineResolverMapping = new HashMap<>();
+
+ protected StronglyTypedContentItemConverter() {
+ //protected constructor
+ }
+
+ protected void registerType(String contentType, Class> clazz) {
+ contentTypeToClassNameMapping.put(contentType, clazz.getName());
+ classNameToContentTypeMapping.put(clazz.getName(), contentType);
+ }
+
+ protected void registerType(Class> clazz) {
+ ContentItemMapping clazzContentItemMapping = clazz.getAnnotation(ContentItemMapping.class);
+ if (clazzContentItemMapping == null) {
+ throw new IllegalArgumentException("Passed in class must be annotated with @ContentItemMapping, " +
+ "if this is not possible, please use registerType(String, Class)");
+ }
+ registerType(clazzContentItemMapping.value(), clazz);
+ log.debug("Registered type for {}", clazz.getSimpleName());
+ }
+
+ protected String getContentType(Class tClass) {
+ if (classNameToContentTypeMapping.containsKey(tClass.getName())) {
+ return classNameToContentTypeMapping.get(tClass.getName());
+ }
+ return null;
+ }
+
+ protected void registerInlineContentItemsResolver(InlineContentItemsResolver resolver) {
+ typeNameToInlineResolverMapping.put(resolver.getType().getTypeName(), resolver);
+ }
+
+ protected InlineContentItemsResolver getResolverForType(String contentType) {
+ if (contentTypeToClassNameMapping.containsKey(contentType) &&
+ typeNameToInlineResolverMapping.containsKey(contentTypeToClassNameMapping.get(contentType))) {
+ return typeNameToInlineResolverMapping.get(contentTypeToClassNameMapping.get(contentType));
+ }
+ return null;
+ }
+
+ protected InlineContentItemsResolver getResolverForType(ContentItem contentItem) {
+ System system = contentItem.getSystem();
+ if (system != null) {
+ return getResolverForType(system.getType());
+ }
+ return null;
+ }
+
+ /**
+ * Not working on Android platform because of JVM and Dalvik differences, please use {@link DeliveryClient#registerType(Class)} instead
+ * @param basePackage name of the base package
+ */
+ protected void scanClasspathForMappings(String basePackage) {
+ try (ScanResult scanResult = new ClassGraph()
+ .enableAllInfo()
+ .acceptPackages(basePackage)
+ .scan()) {
+ ClassInfoList mappings = scanResult.getClassesWithAnnotation(ContentItemMapping.class.getName());
+ mappings.loadClasses().forEach(classWithAnnotation -> {
+ ContentItemMapping contentItemMapping = classWithAnnotation.getAnnotation(ContentItemMapping.class);
+ registerType(contentItemMapping.value(), classWithAnnotation);
+ });
+
+ ClassInfoList inlineResolvers = scanResult.getSubclasses(InlineContentItemsResolver.class.getName());
+ inlineResolvers.loadClasses(InlineContentItemsResolver.class).forEach(subclass -> {
+ try {
+ registerInlineContentItemsResolver(subclass.getConstructor().newInstance());
+ } catch (NoSuchMethodException |
+ IllegalAccessException |
+ InvocationTargetException |
+ InstantiationException e) {
+ // No default constructor, no InlineContentItemsResolver.
+ }
+ });
+ }
+ }
+
+ Object convert(ContentItem item, Map linkedItems, String contentType) {
+ String className = contentTypeToClassNameMapping.get(contentType);
+ Class> mappingClass;
+ try {
+ mappingClass = Class.forName(className);
+ } catch (ClassNotFoundException e) {
+ return item;
+ }
+
+ if (mappingClass == null) {
+ return item;
+ }
+
+ return convert(item, linkedItems, mappingClass);
+ }
+
+ T convert(ContentItem item, Map linkedItems, Class tClass) {
+ if (tClass == Object.class) {
+ String className = contentTypeToClassNameMapping.get(item.getSystem().getType());
+ if (className == null) {
+ return (T) item;
+ }
+ Class> mappingClass = null;
+ try {
+ mappingClass = Class.forName(className);
+ } catch (ClassNotFoundException e) {
+ return (T) item;
+ }
+ if (mappingClass == null) {
+ return (T) item;
+ }
+ return (T) convert(item, linkedItems, mappingClass);
+ }
+ if (tClass == ContentItem.class) {
+ return (T) item;
+ }
+ T bean = null;
+ try {
+ //Invoke the default constructor
+ bean = tClass.getConstructor().newInstance();
+
+ //Get the bean properties
+ Field[] fields = tClass.getDeclaredFields();
+
+ //Inject mappings
+ for (Field field : fields) {
+ Object value = getValueForField(item, linkedItems, bean, field);
+ if (value != null) {
+ Optional propertyDescriptor = getPropertyDescriptor(bean, field);
+ if (propertyDescriptor.isPresent()) {
+ propertyDescriptor.get().getWriteMethod().invoke(bean, value);
+ }
+ }
+ }
+ } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException e) {
+ handleReflectionException(e);
+ }
+ //Return bean
+ return bean;
+ }
+
+ private Object getValueForField(
+ ContentItem item, Map linkedItems, Object bean, Field field) {
+ //Inject System object
+ if (field.getType() == System.class) {
+ return item.getSystem();
+ }
+ //Explicit checks
+ //Check to see if this is an explicitly mapped Element
+ ElementMapping elementMapping = field.getAnnotation(ElementMapping.class);
+ if (elementMapping != null && item.getElements().containsKey(elementMapping.value())) {
+ return item.getElements().get(elementMapping.value()).getValue();
+ }
+ //Check to see if this is an explicitly mapped ContentItem
+ ContentItemMapping contentItemMapping = field.getAnnotation(ContentItemMapping.class);
+ if (contentItemMapping != null &&
+ isListOrMap(field.getType()) &&
+ item.getElements().containsKey(contentItemMapping.value()) &&
+ item.getElements().get(contentItemMapping.value()) instanceof LinkedItem) {
+ LinkedItem linkedItemElement =
+ (LinkedItem) item.getElements().get(contentItemMapping.value());
+ Map referencedLinkedItems = new LinkedHashMap<>();
+ for (String codename : linkedItemElement.getValue()) {
+ referencedLinkedItems.put(codename, linkedItems.get(codename));
+ }
+ return getCastedLinkedItemsForListOrMap(bean, field, referencedLinkedItems);
+ }
+ if (contentItemMapping != null && linkedItems.containsKey(contentItemMapping.value())) {
+ return getCastedLinkedItemsForField(field.getType(), contentItemMapping.value(), linkedItems);
+ }
+
+ //Implicit checks
+ String candidateCodename = fromCamelCase(field.getName());
+ //Check to see if this is an implicitly mapped Element
+ if (item.getElements().containsKey(candidateCodename)) {
+ return item.getElements().get(candidateCodename).getValue();
+ }
+ //Check to see if this is an implicitly mapped ContentItem
+ if (linkedItems.containsKey(candidateCodename)) {
+ return getCastedLinkedItemsForField(field.getType(), candidateCodename, linkedItems);
+ }
+
+ //Check to see if this is a collection of implicitly mapped ContentItem
+ if (isListOrMap(field.getType())) {
+ return getCastedLinkedItemsForListOrMap(bean, field, linkedItems);
+ }
+ return null;
+ }
+
+ private Object getCastedLinkedItemsForField(
+ Class> clazz, String codename, Map linkedItems) {
+ ContentItem linkedItemsItem = linkedItems.get(codename);
+ if (clazz == ContentItem.class) {
+ return linkedItemsItem;
+ }
+ Map linkedItemsForRecursion =
+ copyLinkedItemsWithExclusion(linkedItems, codename);
+ return convert(linkedItemsItem, linkedItemsForRecursion, clazz);
+ }
+
+ private Object getCastedLinkedItemsForListOrMap(
+ Object bean, Field field, Map linkedItems) {
+ Type type = getType(bean, field);
+ if (type == null) {
+ // We have failed to get the type, probably due to a missing setter, skip this field
+ log.debug("Failed to get type from {} (probably due to a missing setter), {} skipped", bean, field);
+ return null;
+ }
+ if (type == ContentItem.class) {
+ return castCollection(field.getType(), linkedItems);
+ }
+ Class> listClass = (Class>) type;
+ String contentType = null;
+ ContentItemMapping clazzContentItemMapping = listClass.getAnnotation(ContentItemMapping.class);
+ if (clazzContentItemMapping != null) {
+ contentType = clazzContentItemMapping.value();
+ }
+ if (contentType == null && classNameToContentTypeMapping.containsKey(listClass.getName())) {
+ contentType = classNameToContentTypeMapping.get(listClass.getName());
+ }
+ if (contentType != null) {
+ HashMap convertedLinkedItems = new HashMap<>();
+ for (Map.Entry entry : linkedItems.entrySet()) {
+ if (entry.getValue() != null && contentType.equals(entry.getValue().getSystem().getType())) {
+ Map linkedItemsForRecursion =
+ copyLinkedItemsWithExclusion(linkedItems, entry.getKey());
+ convertedLinkedItems.put(entry.getKey(),
+ convert(entry.getValue(), linkedItemsForRecursion, listClass));
+ }
+ }
+ return castCollection(field.getType(), convertedLinkedItems);
+ }
+ return null;
+ }
+
+ private static String fromCamelCase(String s) {
+ String regex = "([a-z])([A-Z]+)";
+ String replacement = "$1_$2";
+ return s.replaceAll(regex, replacement).toLowerCase();
+ }
+
+ // This function copies the linked item map while excluding an item, useful for a recursive stack
+ protected Map copyLinkedItemsWithExclusion(
+ Map orig, String excludedContentItem) {
+ HashMap target = new HashMap<>();
+ for (Map.Entry entry : orig.entrySet()) {
+ if (!excludedContentItem.equals(entry.getKey())) {
+ target.put(entry.getKey(), entry.getValue());
+ }
+ }
+ return target;
+ }
+
+ private static boolean isListOrMap(Class> type) {
+ return List.class.isAssignableFrom(type) || Map.class.isAssignableFrom(type);
+ }
+
+ private static Object castCollection(Class> type, Map items) {
+ if (List.class.isAssignableFrom(type)) {
+ return new ArrayList(items.values());
+ }
+ if (Map.class.isAssignableFrom(type)) {
+ return items;
+ }
+ return items;
+ }
+
+ private static Type getType(Object bean, Field field) {
+ //Because of type erasure, we will find the setter method and get the generic types off it's arguments
+ Optional propertyDescriptor = getPropertyDescriptor(bean, field);
+ if (!propertyDescriptor.isPresent()) {
+ //Likely no accessors
+ log.debug("Property descriptor for object {} with field {} is null", bean, field);
+ return null;
+ }
+
+ Method writeMethod = propertyDescriptor.get().getWriteMethod();
+ if (writeMethod == null) {
+ log.debug("No write method for property {}", propertyDescriptor);
+ return null;
+ }
+ Type[] actualTypeArguments = ((ParameterizedType) writeMethod.getGenericParameterTypes()[0])
+ .getActualTypeArguments();
+
+ Type type = (Map.class.isAssignableFrom(field.getType())) ? actualTypeArguments[1] : actualTypeArguments[0];
+
+ log.debug("Got type {} from {}",
+ type.getTypeName(),
+ String.format("%s#%s", bean.getClass().getSimpleName(), field.getName()));
+
+ return type;
+ }
+
+ @NotNull
+ private static Optional getPropertyDescriptor(Object bean, Field field) {
+ BeanInfo beanInfo = null;
+ try {
+ beanInfo = Introspector.getBeanInfo(bean.getClass());
+ } catch (IntrospectionException e) {
+ log.debug("IntrospectionException from com.madrobot.beans for object {} with field {} is null", bean, field);
+ return null;
+ }
+ PropertyDescriptor[] properties = beanInfo.getPropertyDescriptors();
+ Optional propertyDescriptor = Arrays.stream(properties).filter(descriptor -> descriptor.getName().equals(field.getName())).findFirst();
+ return propertyDescriptor;
+ }
+
+ private static void handleReflectionException(Exception ex) {
+ log.error("Reflection exception", ex);
+ if (ex instanceof NoSuchMethodException) {
+ throw new IllegalStateException("Method not found: " + ex.getMessage());
+ }
+ if (ex instanceof IllegalAccessException) {
+ throw new IllegalStateException("Could not access method: " + ex.getMessage());
+ }
+ if (ex instanceof RuntimeException) {
+ throw (RuntimeException) ex;
+ }
+
+ throw new UndeclaredThrowableException(ex);
+ }
+}
diff --git a/delivery-sdk/src/main/java/kontent/ai/delivery/Taxonomy.java b/delivery-sdk/src/main/java/kontent/ai/delivery/Taxonomy.java
index ced1a829..4c92c433 100644
--- a/delivery-sdk/src/main/java/kontent/ai/delivery/Taxonomy.java
+++ b/delivery-sdk/src/main/java/kontent/ai/delivery/Taxonomy.java
@@ -1,68 +1,69 @@
-/*
- * MIT License
- *
- * Copyright (c) 2022 Kontent s.r.o.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package kontent.ai.delivery;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.List;
-
-/**
- * Object model for a Taxonomy element
- */
-@lombok.Getter
-@lombok.Setter
-@lombok.ToString
-@lombok.EqualsAndHashCode
-@lombok.NoArgsConstructor
-public class Taxonomy {
-
- /**
- * The display name of the taxonomy
- *
- * @param name Sets the name of this.
- * @return The name of the taxonomy.
- */
- @JsonProperty("name")
- String name;
-
- /**
- * The codename of the taxonomy
- *
- * @param codename Sets the codename of this.
- * @return The codename of the taxonomy.
- */
- @JsonProperty("codename")
- String codename;
-
- /**
- * A list of taxonomically descendant terms
- *
- * @param terms Sets the taxonomy terms of this.
- * @return A list of taxonomically descendant terms.
- */
- @JsonProperty("terms")
- List terms;
-
-}
+/*
+ * MIT License
+ *
+ * Copyright (c) 2022 Kontent s.r.o.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package kontent.ai.delivery;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Object model for a Taxonomy element
+ */
+@lombok.Getter
+@lombok.Setter
+@lombok.ToString
+@lombok.EqualsAndHashCode
+@lombok.NoArgsConstructor
+public class Taxonomy {
+
+ /**
+ * The display name of the taxonomy
+ *
+ * @param name Sets the name of this.
+ * @return The name of the taxonomy.
+ */
+ @JsonProperty("name")
+ String name;
+
+ /**
+ * The codename of the taxonomy
+ *
+ * @param codename Sets the codename of this.
+ * @return The codename of the taxonomy.
+ */
+ @JsonProperty("codename")
+ String codename;
+
+ /**
+ * A list of taxonomically descendant terms
+ *
+ * @param terms Sets the taxonomy terms of this.
+ * @return A list of taxonomically descendant terms.
+ */
+ @JsonProperty("terms")
+ List terms;
+
+}
diff --git a/sample-app-spring-boot/build.gradle b/sample-app-spring-boot/build.gradle
index 327d8cd9..404accde 100644
--- a/sample-app-spring-boot/build.gradle
+++ b/sample-app-spring-boot/build.gradle
@@ -32,6 +32,7 @@ configurations {
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
+ implementation 'org.springframework.boot:spring-boot-starter-data-redis'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
diff --git a/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/controllers/TestController.java b/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/controllers/TestController.java
new file mode 100644
index 00000000..e4eb510f
--- /dev/null
+++ b/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/controllers/TestController.java
@@ -0,0 +1,36 @@
+package kontent.ai.delivery.sample.dancinggoat.controllers;
+
+import kontent.ai.delivery.ContentItem;
+import kontent.ai.delivery.DeliveryClient;
+import kontent.ai.delivery.sample.dancinggoat.models.Home;
+import kontent.ai.delivery.sample.dancinggoat.springboot.TestService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+
+import java.io.Serializable;
+import java.util.concurrent.ExecutionException;
+import java.util.logging.Logger;
+
+@Controller
+public class TestController implements Serializable {
+ @Autowired
+ DeliveryClient deliveryClient;
+
+ @Autowired
+ TestService testService;
+
+ @GetMapping("/test")
+ ResponseEntity getTest(Model model) throws ExecutionException, InterruptedException {
+
+ ContentItem item = testService.fetchContentByCodeName("on_roasts", deliveryClient);
+
+ ContentItem item2 = testService.fetchContentByCodeName("about_us", deliveryClient);
+
+ return new ResponseEntity<>(item.getString("title") + " " + item2.getString("metadata__og_title"), HttpStatus.OK);
+ }
+}
diff --git a/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/AboutUs.java b/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/AboutUs.java
index 396d986a..e6315dce 100644
--- a/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/AboutUs.java
+++ b/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/AboutUs.java
@@ -1,5 +1,6 @@
package kontent.ai.delivery.sample.dancinggoat.models;
+import java.io.Serializable;
import java.lang.String;
import java.util.List;
import kontent.ai.delivery.Asset;
@@ -16,30 +17,33 @@
* For further modifications of the class, create a separate file and extend this class.
*/
@ContentItemMapping("about_us")
-public class AboutUs {
- @ElementMapping("metadata__og_description")
- String metadataOgDescription;
+public class AboutUs implements Serializable {
+ @ContentItemMapping("facts")
+ List facts;
+
+ @ElementMapping("url_pattern")
+ String urlPattern;
+
+ @ElementMapping("sitemap")
+ List sitemap;
@ElementMapping("metadata__meta_title")
String metadataMetaTitle;
- @ElementMapping("metadata__og_title")
- String metadataOgTitle;
-
@ElementMapping("metadata__meta_description")
String metadataMetaDescription;
- @ElementMapping("metadata__twitter_site")
- String metadataTwitterSite;
+ @ElementMapping("metadata__og_title")
+ String metadataOgTitle;
- @ElementMapping("url_pattern")
- String urlPattern;
+ @ElementMapping("metadata__og_description")
+ String metadataOgDescription;
- @ElementMapping("metadata__twitter_image")
- List metadataTwitterImage;
+ @ElementMapping("metadata__og_image")
+ List metadataOgImage;
- @ElementMapping("sitemap")
- List sitemap;
+ @ElementMapping("metadata__twitter_site")
+ String metadataTwitterSite;
@ElementMapping("metadata__twitter_creator")
String metadataTwitterCreator;
@@ -50,36 +54,41 @@ public class AboutUs {
@ElementMapping("metadata__twitter_description")
String metadataTwitterDescription;
- @ElementMapping("metadata__og_image")
- List metadataOgImage;
-
- @ContentItemMapping("facts")
- List facts;
+ @ElementMapping("metadata__twitter_image")
+ List metadataTwitterImage;
System system;
- public String getMetadataOgDescription() {
- return metadataOgDescription;
+ public List getFacts() {
+ return facts;
}
- public void setMetadataOgDescription(String metadataOgDescription) {
- this.metadataOgDescription = metadataOgDescription;
+ public void setFacts(List facts) {
+ this.facts = facts;
}
- public String getMetadataMetaTitle() {
- return metadataMetaTitle;
+ public String getUrlPattern() {
+ return urlPattern;
}
- public void setMetadataMetaTitle(String metadataMetaTitle) {
- this.metadataMetaTitle = metadataMetaTitle;
+ public void setUrlPattern(String urlPattern) {
+ this.urlPattern = urlPattern;
}
- public String getMetadataOgTitle() {
- return metadataOgTitle;
+ public List getSitemap() {
+ return sitemap;
}
- public void setMetadataOgTitle(String metadataOgTitle) {
- this.metadataOgTitle = metadataOgTitle;
+ public void setSitemap(List sitemap) {
+ this.sitemap = sitemap;
+ }
+
+ public String getMetadataMetaTitle() {
+ return metadataMetaTitle;
+ }
+
+ public void setMetadataMetaTitle(String metadataMetaTitle) {
+ this.metadataMetaTitle = metadataMetaTitle;
}
public String getMetadataMetaDescription() {
@@ -90,36 +99,36 @@ public void setMetadataMetaDescription(String metadataMetaDescription) {
this.metadataMetaDescription = metadataMetaDescription;
}
- public String getMetadataTwitterSite() {
- return metadataTwitterSite;
+ public String getMetadataOgTitle() {
+ return metadataOgTitle;
}
- public void setMetadataTwitterSite(String metadataTwitterSite) {
- this.metadataTwitterSite = metadataTwitterSite;
+ public void setMetadataOgTitle(String metadataOgTitle) {
+ this.metadataOgTitle = metadataOgTitle;
}
- public String getUrlPattern() {
- return urlPattern;
+ public String getMetadataOgDescription() {
+ return metadataOgDescription;
}
- public void setUrlPattern(String urlPattern) {
- this.urlPattern = urlPattern;
+ public void setMetadataOgDescription(String metadataOgDescription) {
+ this.metadataOgDescription = metadataOgDescription;
}
- public List getMetadataTwitterImage() {
- return metadataTwitterImage;
+ public List getMetadataOgImage() {
+ return metadataOgImage;
}
- public void setMetadataTwitterImage(List metadataTwitterImage) {
- this.metadataTwitterImage = metadataTwitterImage;
+ public void setMetadataOgImage(List metadataOgImage) {
+ this.metadataOgImage = metadataOgImage;
}
- public List getSitemap() {
- return sitemap;
+ public String getMetadataTwitterSite() {
+ return metadataTwitterSite;
}
- public void setSitemap(List sitemap) {
- this.sitemap = sitemap;
+ public void setMetadataTwitterSite(String metadataTwitterSite) {
+ this.metadataTwitterSite = metadataTwitterSite;
}
public String getMetadataTwitterCreator() {
@@ -146,20 +155,12 @@ public void setMetadataTwitterDescription(String metadataTwitterDescription) {
this.metadataTwitterDescription = metadataTwitterDescription;
}
- public List getMetadataOgImage() {
- return metadataOgImage;
- }
-
- public void setMetadataOgImage(List metadataOgImage) {
- this.metadataOgImage = metadataOgImage;
- }
-
- public List getFacts() {
- return facts;
+ public List getMetadataTwitterImage() {
+ return metadataTwitterImage;
}
- public void setFacts(List facts) {
- this.facts = facts;
+ public void setMetadataTwitterImage(List metadataTwitterImage) {
+ this.metadataTwitterImage = metadataTwitterImage;
}
public System getSystem() {
diff --git a/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/Accessory.java b/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/Accessory.java
index a289f2e0..ee69c454 100644
--- a/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/Accessory.java
+++ b/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/Accessory.java
@@ -1,5 +1,6 @@
package kontent.ai.delivery.sample.dancinggoat.models;
+import java.io.Serializable;
import java.lang.Double;
import java.lang.String;
import java.util.List;
@@ -16,136 +17,120 @@
* For further modifications of the class, create a separate file and extend this class.
*/
@ContentItemMapping("accessory")
-public class Accessory {
- @ElementMapping("metadata__og_description")
- String metadataOgDescription;
+public class Accessory implements Serializable {
+ @ElementMapping("product_name")
+ String productName;
- @ElementMapping("metadata__meta_title")
- String metadataMetaTitle;
+ @ElementMapping("price")
+ Double price;
- @ElementMapping("metadata__og_title")
- String metadataOgTitle;
+ @ElementMapping("image")
+ List image;
+
+ @ElementMapping("manufacturer")
+ String manufacturer;
+
+ @ElementMapping("product_status")
+ List productStatus;
+
+ @ElementMapping("short_description")
+ String shortDescription;
@ElementMapping("long_description")
String longDescription;
+ @ElementMapping("url_pattern")
+ String urlPattern;
+
+ @ElementMapping("sitemap")
+ List sitemap;
+
+ @ElementMapping("metadata__meta_title")
+ String metadataMetaTitle;
+
@ElementMapping("metadata__meta_description")
String metadataMetaDescription;
- @ElementMapping("metadata__twitter_site")
- String metadataTwitterSite;
+ @ElementMapping("metadata__og_title")
+ String metadataOgTitle;
- @ElementMapping("price")
- Double price;
+ @ElementMapping("metadata__og_description")
+ String metadataOgDescription;
- @ElementMapping("metadata__twitter_image")
- List metadataTwitterImage;
+ @ElementMapping("metadata__og_image")
+ List metadataOgImage;
+
+ @ElementMapping("metadata__twitter_site")
+ String metadataTwitterSite;
@ElementMapping("metadata__twitter_creator")
String metadataTwitterCreator;
- @ElementMapping("url_pattern")
- String urlPattern;
-
- @ElementMapping("short_description")
- String shortDescription;
-
- @ElementMapping("manufacturer")
- String manufacturer;
-
@ElementMapping("metadata__twitter_title")
String metadataTwitterTitle;
@ElementMapping("metadata__twitter_description")
String metadataTwitterDescription;
- @ElementMapping("metadata__og_image")
- List metadataOgImage;
-
- @ElementMapping("sitemap")
- List sitemap;
-
- @ElementMapping("product_status")
- List productStatus;
-
- @ElementMapping("image")
- List image;
-
- @ElementMapping("product_name")
- String productName;
+ @ElementMapping("metadata__twitter_image")
+ List metadataTwitterImage;
System system;
- public String getMetadataOgDescription() {
- return metadataOgDescription;
- }
-
- public void setMetadataOgDescription(String metadataOgDescription) {
- this.metadataOgDescription = metadataOgDescription;
- }
-
- public String getMetadataMetaTitle() {
- return metadataMetaTitle;
- }
-
- public void setMetadataMetaTitle(String metadataMetaTitle) {
- this.metadataMetaTitle = metadataMetaTitle;
- }
-
- public String getMetadataOgTitle() {
- return metadataOgTitle;
+ public String getProductName() {
+ return productName;
}
- public void setMetadataOgTitle(String metadataOgTitle) {
- this.metadataOgTitle = metadataOgTitle;
+ public void setProductName(String productName) {
+ this.productName = productName;
}
- public String getLongDescription() {
- return longDescription;
+ public Double getPrice() {
+ return price;
}
- public void setLongDescription(String longDescription) {
- this.longDescription = longDescription;
+ public void setPrice(Double price) {
+ this.price = price;
}
- public String getMetadataMetaDescription() {
- return metadataMetaDescription;
+ public List getImage() {
+ return image;
}
- public void setMetadataMetaDescription(String metadataMetaDescription) {
- this.metadataMetaDescription = metadataMetaDescription;
+ public void setImage(List image) {
+ this.image = image;
}
- public String getMetadataTwitterSite() {
- return metadataTwitterSite;
+ public String getManufacturer() {
+ return manufacturer;
}
- public void setMetadataTwitterSite(String metadataTwitterSite) {
- this.metadataTwitterSite = metadataTwitterSite;
+ public void setManufacturer(String manufacturer) {
+ this.manufacturer = manufacturer;
}
- public Double getPrice() {
- return price;
+ public List getProductStatus() {
+ return productStatus;
}
- public void setPrice(Double price) {
- this.price = price;
+ public void setProductStatus(List productStatus) {
+ this.productStatus = productStatus;
}
- public List getMetadataTwitterImage() {
- return metadataTwitterImage;
+ public String getShortDescription() {
+ return shortDescription;
}
- public void setMetadataTwitterImage(List metadataTwitterImage) {
- this.metadataTwitterImage = metadataTwitterImage;
+ public void setShortDescription(String shortDescription) {
+ this.shortDescription = shortDescription;
}
- public String getMetadataTwitterCreator() {
- return metadataTwitterCreator;
+ public String getLongDescription() {
+ return longDescription;
}
- public void setMetadataTwitterCreator(String metadataTwitterCreator) {
- this.metadataTwitterCreator = metadataTwitterCreator;
+ public void setLongDescription(String longDescription) {
+ this.longDescription = longDescription;
}
public String getUrlPattern() {
@@ -156,36 +141,44 @@ public void setUrlPattern(String urlPattern) {
this.urlPattern = urlPattern;
}
- public String getShortDescription() {
- return shortDescription;
+ public List getSitemap() {
+ return sitemap;
}
- public void setShortDescription(String shortDescription) {
- this.shortDescription = shortDescription;
+ public void setSitemap(List sitemap) {
+ this.sitemap = sitemap;
}
- public String getManufacturer() {
- return manufacturer;
+ public String getMetadataMetaTitle() {
+ return metadataMetaTitle;
}
- public void setManufacturer(String manufacturer) {
- this.manufacturer = manufacturer;
+ public void setMetadataMetaTitle(String metadataMetaTitle) {
+ this.metadataMetaTitle = metadataMetaTitle;
}
- public String getMetadataTwitterTitle() {
- return metadataTwitterTitle;
+ public String getMetadataMetaDescription() {
+ return metadataMetaDescription;
}
- public void setMetadataTwitterTitle(String metadataTwitterTitle) {
- this.metadataTwitterTitle = metadataTwitterTitle;
+ public void setMetadataMetaDescription(String metadataMetaDescription) {
+ this.metadataMetaDescription = metadataMetaDescription;
}
- public String getMetadataTwitterDescription() {
- return metadataTwitterDescription;
+ public String getMetadataOgTitle() {
+ return metadataOgTitle;
}
- public void setMetadataTwitterDescription(String metadataTwitterDescription) {
- this.metadataTwitterDescription = metadataTwitterDescription;
+ public void setMetadataOgTitle(String metadataOgTitle) {
+ this.metadataOgTitle = metadataOgTitle;
+ }
+
+ public String getMetadataOgDescription() {
+ return metadataOgDescription;
+ }
+
+ public void setMetadataOgDescription(String metadataOgDescription) {
+ this.metadataOgDescription = metadataOgDescription;
}
public List getMetadataOgImage() {
@@ -196,36 +189,44 @@ public void setMetadataOgImage(List metadataOgImage) {
this.metadataOgImage = metadataOgImage;
}
- public List getSitemap() {
- return sitemap;
+ public String getMetadataTwitterSite() {
+ return metadataTwitterSite;
}
- public void setSitemap(List sitemap) {
- this.sitemap = sitemap;
+ public void setMetadataTwitterSite(String metadataTwitterSite) {
+ this.metadataTwitterSite = metadataTwitterSite;
}
- public List getProductStatus() {
- return productStatus;
+ public String getMetadataTwitterCreator() {
+ return metadataTwitterCreator;
}
- public void setProductStatus(List productStatus) {
- this.productStatus = productStatus;
+ public void setMetadataTwitterCreator(String metadataTwitterCreator) {
+ this.metadataTwitterCreator = metadataTwitterCreator;
}
- public List getImage() {
- return image;
+ public String getMetadataTwitterTitle() {
+ return metadataTwitterTitle;
}
- public void setImage(List image) {
- this.image = image;
+ public void setMetadataTwitterTitle(String metadataTwitterTitle) {
+ this.metadataTwitterTitle = metadataTwitterTitle;
}
- public String getProductName() {
- return productName;
+ public String getMetadataTwitterDescription() {
+ return metadataTwitterDescription;
}
- public void setProductName(String productName) {
- this.productName = productName;
+ public void setMetadataTwitterDescription(String metadataTwitterDescription) {
+ this.metadataTwitterDescription = metadataTwitterDescription;
+ }
+
+ public List getMetadataTwitterImage() {
+ return metadataTwitterImage;
+ }
+
+ public void setMetadataTwitterImage(List metadataTwitterImage) {
+ this.metadataTwitterImage = metadataTwitterImage;
}
public System getSystem() {
diff --git a/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/Article.java b/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/Article.java
index 45c786b0..34209693 100644
--- a/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/Article.java
+++ b/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/Article.java
@@ -1,5 +1,6 @@
package kontent.ai.delivery.sample.dancinggoat.models;
+import java.io.Serializable;
import java.lang.String;
import java.time.ZonedDateTime;
import java.util.List;
@@ -17,51 +18,60 @@
* For further modifications of the class, create a separate file and extend this class.
*/
@ContentItemMapping("article")
-public class Article {
- @ElementMapping("metadata__og_description")
- String metadataOgDescription;
+public class Article implements Serializable {
+ @ElementMapping("title")
+ String title;
- @ElementMapping("metadata__meta_title")
- String metadataMetaTitle;
+ @ElementMapping("teaser_image")
+ List teaserImage;
- @ElementMapping("personas")
- List personas;
+ @ElementMapping("post_date")
+ ZonedDateTime postDate;
+
+ @ElementMapping("summary")
+ String summary;
@ElementMapping("body_copy")
String bodyCopy;
- @ElementMapping("metadata__og_title")
- String metadataOgTitle;
+ @ContentItemMapping("related_articles")
+ List relatedArticles;
- @ElementMapping("metadata__meta_description")
- String metadataMetaDescription;
+ @ElementMapping("meta_keywords")
+ String metaKeywords;
- @ElementMapping("metadata__twitter_site")
- String metadataTwitterSite;
+ @ElementMapping("personas")
+ List personas;
- @ElementMapping("post_date")
- ZonedDateTime postDate;
+ @ElementMapping("meta_description")
+ String metaDescription;
- @ElementMapping("meta_keywords")
- String metaKeywords;
+ @ElementMapping("url_pattern")
+ String urlPattern;
- @ElementMapping("teaser_image")
- List teaserImage;
+ @ElementMapping("sitemap")
+ List sitemap;
- @ElementMapping("metadata__twitter_image")
- List metadataTwitterImage;
+ @ElementMapping("metadata__meta_title")
+ String metadataMetaTitle;
- @ElementMapping("metadata__twitter_creator")
- String metadataTwitterCreator;
+ @ElementMapping("metadata__meta_description")
+ String metadataMetaDescription;
- @ElementMapping("title")
- String title;
+ @ElementMapping("metadata__og_title")
+ String metadataOgTitle;
- @ElementMapping("summary")
- String summary;
+ @ElementMapping("metadata__og_description")
+ String metadataOgDescription;
- @ElementMapping("sitemap")
- List sitemap;
+ @ElementMapping("metadata__og_image")
+ List metadataOgImage;
+
+ @ElementMapping("metadata__twitter_site")
+ String metadataTwitterSite;
+
+ @ElementMapping("metadata__twitter_creator")
+ String metadataTwitterCreator;
@ElementMapping("metadata__twitter_title")
String metadataTwitterTitle;
@@ -69,42 +79,41 @@ public class Article {
@ElementMapping("metadata__twitter_description")
String metadataTwitterDescription;
- @ElementMapping("meta_description")
- String metaDescription;
-
- @ElementMapping("metadata__og_image")
- List metadataOgImage;
+ @ElementMapping("metadata__twitter_image")
+ List metadataTwitterImage;
- @ContentItemMapping("related_articles")
- List relatedArticles;
+ System system;
- @ElementMapping("url_pattern")
- String urlPattern;
+ public String getTitle() {
+ return title;
+ }
- System system;
+ public void setTitle(String title) {
+ this.title = title;
+ }
- public String getMetadataOgDescription() {
- return metadataOgDescription;
+ public List getTeaserImage() {
+ return teaserImage;
}
- public void setMetadataOgDescription(String metadataOgDescription) {
- this.metadataOgDescription = metadataOgDescription;
+ public void setTeaserImage(List teaserImage) {
+ this.teaserImage = teaserImage;
}
- public String getMetadataMetaTitle() {
- return metadataMetaTitle;
+ public ZonedDateTime getPostDate() {
+ return postDate;
}
- public void setMetadataMetaTitle(String metadataMetaTitle) {
- this.metadataMetaTitle = metadataMetaTitle;
+ public void setPostDate(ZonedDateTime postDate) {
+ this.postDate = postDate;
}
- public List getPersonas() {
- return personas;
+ public String getSummary() {
+ return summary;
}
- public void setPersonas(List personas) {
- this.personas = personas;
+ public void setSummary(String summary) {
+ this.summary = summary;
}
public String getBodyCopy() {
@@ -115,140 +124,132 @@ public void setBodyCopy(String bodyCopy) {
this.bodyCopy = bodyCopy;
}
- public String getMetadataOgTitle() {
- return metadataOgTitle;
- }
-
- public void setMetadataOgTitle(String metadataOgTitle) {
- this.metadataOgTitle = metadataOgTitle;
- }
-
- public String getMetadataMetaDescription() {
- return metadataMetaDescription;
+ public List getRelatedArticles() {
+ return relatedArticles;
}
- public void setMetadataMetaDescription(String metadataMetaDescription) {
- this.metadataMetaDescription = metadataMetaDescription;
+ public void setRelatedArticles(List relatedArticles) {
+ this.relatedArticles = relatedArticles;
}
- public String getMetadataTwitterSite() {
- return metadataTwitterSite;
+ public String getMetaKeywords() {
+ return metaKeywords;
}
- public void setMetadataTwitterSite(String metadataTwitterSite) {
- this.metadataTwitterSite = metadataTwitterSite;
+ public void setMetaKeywords(String metaKeywords) {
+ this.metaKeywords = metaKeywords;
}
- public ZonedDateTime getPostDate() {
- return postDate;
+ public List getPersonas() {
+ return personas;
}
- public void setPostDate(ZonedDateTime postDate) {
- this.postDate = postDate;
+ public void setPersonas(List personas) {
+ this.personas = personas;
}
- public String getMetaKeywords() {
- return metaKeywords;
+ public String getMetaDescription() {
+ return metaDescription;
}
- public void setMetaKeywords(String metaKeywords) {
- this.metaKeywords = metaKeywords;
+ public void setMetaDescription(String metaDescription) {
+ this.metaDescription = metaDescription;
}
- public List getTeaserImage() {
- return teaserImage;
+ public String getUrlPattern() {
+ return urlPattern;
}
- public void setTeaserImage(List teaserImage) {
- this.teaserImage = teaserImage;
+ public void setUrlPattern(String urlPattern) {
+ this.urlPattern = urlPattern;
}
- public List getMetadataTwitterImage() {
- return metadataTwitterImage;
+ public List getSitemap() {
+ return sitemap;
}
- public void setMetadataTwitterImage(List metadataTwitterImage) {
- this.metadataTwitterImage = metadataTwitterImage;
+ public void setSitemap(List sitemap) {
+ this.sitemap = sitemap;
}
- public String getMetadataTwitterCreator() {
- return metadataTwitterCreator;
+ public String getMetadataMetaTitle() {
+ return metadataMetaTitle;
}
- public void setMetadataTwitterCreator(String metadataTwitterCreator) {
- this.metadataTwitterCreator = metadataTwitterCreator;
+ public void setMetadataMetaTitle(String metadataMetaTitle) {
+ this.metadataMetaTitle = metadataMetaTitle;
}
- public String getTitle() {
- return title;
+ public String getMetadataMetaDescription() {
+ return metadataMetaDescription;
}
- public void setTitle(String title) {
- this.title = title;
+ public void setMetadataMetaDescription(String metadataMetaDescription) {
+ this.metadataMetaDescription = metadataMetaDescription;
}
- public String getSummary() {
- return summary;
+ public String getMetadataOgTitle() {
+ return metadataOgTitle;
}
- public void setSummary(String summary) {
- this.summary = summary;
+ public void setMetadataOgTitle(String metadataOgTitle) {
+ this.metadataOgTitle = metadataOgTitle;
}
- public List getSitemap() {
- return sitemap;
+ public String getMetadataOgDescription() {
+ return metadataOgDescription;
}
- public void setSitemap(List sitemap) {
- this.sitemap = sitemap;
+ public void setMetadataOgDescription(String metadataOgDescription) {
+ this.metadataOgDescription = metadataOgDescription;
}
- public String getMetadataTwitterTitle() {
- return metadataTwitterTitle;
+ public List getMetadataOgImage() {
+ return metadataOgImage;
}
- public void setMetadataTwitterTitle(String metadataTwitterTitle) {
- this.metadataTwitterTitle = metadataTwitterTitle;
+ public void setMetadataOgImage(List metadataOgImage) {
+ this.metadataOgImage = metadataOgImage;
}
- public String getMetadataTwitterDescription() {
- return metadataTwitterDescription;
+ public String getMetadataTwitterSite() {
+ return metadataTwitterSite;
}
- public void setMetadataTwitterDescription(String metadataTwitterDescription) {
- this.metadataTwitterDescription = metadataTwitterDescription;
+ public void setMetadataTwitterSite(String metadataTwitterSite) {
+ this.metadataTwitterSite = metadataTwitterSite;
}
- public String getMetaDescription() {
- return metaDescription;
+ public String getMetadataTwitterCreator() {
+ return metadataTwitterCreator;
}
- public void setMetaDescription(String metaDescription) {
- this.metaDescription = metaDescription;
+ public void setMetadataTwitterCreator(String metadataTwitterCreator) {
+ this.metadataTwitterCreator = metadataTwitterCreator;
}
- public List getMetadataOgImage() {
- return metadataOgImage;
+ public String getMetadataTwitterTitle() {
+ return metadataTwitterTitle;
}
- public void setMetadataOgImage(List metadataOgImage) {
- this.metadataOgImage = metadataOgImage;
+ public void setMetadataTwitterTitle(String metadataTwitterTitle) {
+ this.metadataTwitterTitle = metadataTwitterTitle;
}
- public List getRelatedArticles() {
- return relatedArticles;
+ public String getMetadataTwitterDescription() {
+ return metadataTwitterDescription;
}
- public void setRelatedArticles(List relatedArticles) {
- this.relatedArticles = relatedArticles;
+ public void setMetadataTwitterDescription(String metadataTwitterDescription) {
+ this.metadataTwitterDescription = metadataTwitterDescription;
}
- public String getUrlPattern() {
- return urlPattern;
+ public List getMetadataTwitterImage() {
+ return metadataTwitterImage;
}
- public void setUrlPattern(String urlPattern) {
- this.urlPattern = urlPattern;
+ public void setMetadataTwitterImage(List metadataTwitterImage) {
+ this.metadataTwitterImage = metadataTwitterImage;
}
public System getSystem() {
diff --git a/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/Brewer.java b/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/Brewer.java
index f90a397e..dee928f8 100644
--- a/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/Brewer.java
+++ b/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/Brewer.java
@@ -1,5 +1,6 @@
package kontent.ai.delivery.sample.dancinggoat.models;
+import java.io.Serializable;
import java.lang.Double;
import java.lang.String;
import java.util.List;
@@ -16,63 +17,63 @@
* For further modifications of the class, create a separate file and extend this class.
*/
@ContentItemMapping("brewer")
-public class Brewer {
+public class Brewer implements Serializable {
@ElementMapping("product_name")
String productName;
- @ElementMapping("metadata__og_description")
- String metadataOgDescription;
+ @ElementMapping("price")
+ Double price;
- @ElementMapping("metadata__meta_title")
- String metadataMetaTitle;
+ @ElementMapping("image")
+ List image;
+
+ @ElementMapping("product_status")
+ List productStatus;
+
+ @ElementMapping("short_description")
+ String shortDescription;
@ElementMapping("long_description")
String longDescription;
- @ElementMapping("metadata__og_title")
- String metadataOgTitle;
+ @ElementMapping("url_pattern")
+ String urlPattern;
+
+ @ElementMapping("manufacturer")
+ List manufacturer;
+
+ @ElementMapping("sitemap")
+ List sitemap;
+
+ @ElementMapping("metadata__meta_title")
+ String metadataMetaTitle;
@ElementMapping("metadata__meta_description")
String metadataMetaDescription;
- @ElementMapping("metadata__twitter_site")
- String metadataTwitterSite;
+ @ElementMapping("metadata__og_title")
+ String metadataOgTitle;
- @ElementMapping("price")
- Double price;
+ @ElementMapping("metadata__og_description")
+ String metadataOgDescription;
- @ElementMapping("manufacturer")
- List manufacturer;
+ @ElementMapping("metadata__og_image")
+ List metadataOgImage;
- @ElementMapping("metadata__twitter_image")
- List metadataTwitterImage;
+ @ElementMapping("metadata__twitter_site")
+ String metadataTwitterSite;
@ElementMapping("metadata__twitter_creator")
String metadataTwitterCreator;
- @ElementMapping("url_pattern")
- String urlPattern;
-
- @ElementMapping("sitemap")
- List sitemap;
-
- @ElementMapping("short_description")
- String shortDescription;
-
- @ElementMapping("product_status")
- List productStatus;
-
@ElementMapping("metadata__twitter_title")
String metadataTwitterTitle;
@ElementMapping("metadata__twitter_description")
String metadataTwitterDescription;
- @ElementMapping("metadata__og_image")
- List metadataOgImage;
-
- @ElementMapping("image")
- List image;
+ @ElementMapping("metadata__twitter_image")
+ List metadataTwitterImage;
System system;
@@ -84,60 +85,52 @@ public void setProductName(String productName) {
this.productName = productName;
}
- public String getMetadataOgDescription() {
- return metadataOgDescription;
- }
-
- public void setMetadataOgDescription(String metadataOgDescription) {
- this.metadataOgDescription = metadataOgDescription;
- }
-
- public String getMetadataMetaTitle() {
- return metadataMetaTitle;
+ public Double getPrice() {
+ return price;
}
- public void setMetadataMetaTitle(String metadataMetaTitle) {
- this.metadataMetaTitle = metadataMetaTitle;
+ public void setPrice(Double price) {
+ this.price = price;
}
- public String getLongDescription() {
- return longDescription;
+ public List getImage() {
+ return image;
}
- public void setLongDescription(String longDescription) {
- this.longDescription = longDescription;
+ public void setImage(List image) {
+ this.image = image;
}
- public String getMetadataOgTitle() {
- return metadataOgTitle;
+ public List getProductStatus() {
+ return productStatus;
}
- public void setMetadataOgTitle(String metadataOgTitle) {
- this.metadataOgTitle = metadataOgTitle;
+ public void setProductStatus(List productStatus) {
+ this.productStatus = productStatus;
}
- public String getMetadataMetaDescription() {
- return metadataMetaDescription;
+ public String getShortDescription() {
+ return shortDescription;
}
- public void setMetadataMetaDescription(String metadataMetaDescription) {
- this.metadataMetaDescription = metadataMetaDescription;
+ public void setShortDescription(String shortDescription) {
+ this.shortDescription = shortDescription;
}
- public String getMetadataTwitterSite() {
- return metadataTwitterSite;
+ public String getLongDescription() {
+ return longDescription;
}
- public void setMetadataTwitterSite(String metadataTwitterSite) {
- this.metadataTwitterSite = metadataTwitterSite;
+ public void setLongDescription(String longDescription) {
+ this.longDescription = longDescription;
}
- public Double getPrice() {
- return price;
+ public String getUrlPattern() {
+ return urlPattern;
}
- public void setPrice(Double price) {
- this.price = price;
+ public void setUrlPattern(String urlPattern) {
+ this.urlPattern = urlPattern;
}
public List getManufacturer() {
@@ -148,52 +141,68 @@ public void setManufacturer(List manufacturer) {
this.manufacturer = manufacturer;
}
- public List getMetadataTwitterImage() {
- return metadataTwitterImage;
+ public List getSitemap() {
+ return sitemap;
}
- public void setMetadataTwitterImage(List metadataTwitterImage) {
- this.metadataTwitterImage = metadataTwitterImage;
+ public void setSitemap(List sitemap) {
+ this.sitemap = sitemap;
}
- public String getMetadataTwitterCreator() {
- return metadataTwitterCreator;
+ public String getMetadataMetaTitle() {
+ return metadataMetaTitle;
}
- public void setMetadataTwitterCreator(String metadataTwitterCreator) {
- this.metadataTwitterCreator = metadataTwitterCreator;
+ public void setMetadataMetaTitle(String metadataMetaTitle) {
+ this.metadataMetaTitle = metadataMetaTitle;
}
- public String getUrlPattern() {
- return urlPattern;
+ public String getMetadataMetaDescription() {
+ return metadataMetaDescription;
}
- public void setUrlPattern(String urlPattern) {
- this.urlPattern = urlPattern;
+ public void setMetadataMetaDescription(String metadataMetaDescription) {
+ this.metadataMetaDescription = metadataMetaDescription;
}
- public List getSitemap() {
- return sitemap;
+ public String getMetadataOgTitle() {
+ return metadataOgTitle;
}
- public void setSitemap(List sitemap) {
- this.sitemap = sitemap;
+ public void setMetadataOgTitle(String metadataOgTitle) {
+ this.metadataOgTitle = metadataOgTitle;
}
- public String getShortDescription() {
- return shortDescription;
+ public String getMetadataOgDescription() {
+ return metadataOgDescription;
}
- public void setShortDescription(String shortDescription) {
- this.shortDescription = shortDescription;
+ public void setMetadataOgDescription(String metadataOgDescription) {
+ this.metadataOgDescription = metadataOgDescription;
}
- public List getProductStatus() {
- return productStatus;
+ public List getMetadataOgImage() {
+ return metadataOgImage;
}
- public void setProductStatus(List productStatus) {
- this.productStatus = productStatus;
+ public void setMetadataOgImage(List metadataOgImage) {
+ this.metadataOgImage = metadataOgImage;
+ }
+
+ public String getMetadataTwitterSite() {
+ return metadataTwitterSite;
+ }
+
+ public void setMetadataTwitterSite(String metadataTwitterSite) {
+ this.metadataTwitterSite = metadataTwitterSite;
+ }
+
+ public String getMetadataTwitterCreator() {
+ return metadataTwitterCreator;
+ }
+
+ public void setMetadataTwitterCreator(String metadataTwitterCreator) {
+ this.metadataTwitterCreator = metadataTwitterCreator;
}
public String getMetadataTwitterTitle() {
@@ -212,20 +221,12 @@ public void setMetadataTwitterDescription(String metadataTwitterDescription) {
this.metadataTwitterDescription = metadataTwitterDescription;
}
- public List getMetadataOgImage() {
- return metadataOgImage;
- }
-
- public void setMetadataOgImage(List metadataOgImage) {
- this.metadataOgImage = metadataOgImage;
- }
-
- public List getImage() {
- return image;
+ public List getMetadataTwitterImage() {
+ return metadataTwitterImage;
}
- public void setImage(List image) {
- this.image = image;
+ public void setMetadataTwitterImage(List metadataTwitterImage) {
+ this.metadataTwitterImage = metadataTwitterImage;
}
public System getSystem() {
diff --git a/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/Cafe.java b/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/Cafe.java
index 0a12f239..c73419fd 100644
--- a/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/Cafe.java
+++ b/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/Cafe.java
@@ -1,5 +1,6 @@
package kontent.ai.delivery.sample.dancinggoat.models;
+import java.io.Serializable;
import java.lang.String;
import java.util.List;
import kontent.ai.delivery.Asset;
@@ -15,42 +16,42 @@
* For further modifications of the class, create a separate file and extend this class.
*/
@ContentItemMapping("cafe")
-public class Cafe {
- @ElementMapping("phone")
- String phone;
+public class Cafe implements Serializable {
+ @ElementMapping("street")
+ String street;
@ElementMapping("city")
String city;
- @ElementMapping("photo")
- List photo;
-
- @ElementMapping("email")
- String email;
-
@ElementMapping("country")
String country;
- @ElementMapping("street")
- String street;
-
@ElementMapping("state")
String state;
@ElementMapping("zip_code")
String zipCode;
+ @ElementMapping("phone")
+ String phone;
+
+ @ElementMapping("email")
+ String email;
+
+ @ElementMapping("photo")
+ List photo;
+
@ElementMapping("sitemap")
List sitemap;
System system;
- public String getPhone() {
- return phone;
+ public String getStreet() {
+ return street;
}
- public void setPhone(String phone) {
- this.phone = phone;
+ public void setStreet(String street) {
+ this.street = street;
}
public String getCity() {
@@ -61,22 +62,6 @@ public void setCity(String city) {
this.city = city;
}
- public List getPhoto() {
- return photo;
- }
-
- public void setPhoto(List photo) {
- this.photo = photo;
- }
-
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
public String getCountry() {
return country;
}
@@ -85,14 +70,6 @@ public void setCountry(String country) {
this.country = country;
}
- public String getStreet() {
- return street;
- }
-
- public void setStreet(String street) {
- this.street = street;
- }
-
public String getState() {
return state;
}
@@ -109,6 +86,30 @@ public void setZipCode(String zipCode) {
this.zipCode = zipCode;
}
+ public String getPhone() {
+ return phone;
+ }
+
+ public void setPhone(String phone) {
+ this.phone = phone;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public List getPhoto() {
+ return photo;
+ }
+
+ public void setPhoto(List photo) {
+ this.photo = photo;
+ }
+
public List getSitemap() {
return sitemap;
}
diff --git a/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/Coffee.java b/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/Coffee.java
index 39ee3730..ba9a35ef 100644
--- a/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/Coffee.java
+++ b/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/Coffee.java
@@ -1,5 +1,6 @@
package kontent.ai.delivery.sample.dancinggoat.models;
+import java.io.Serializable;
import java.lang.Double;
import java.lang.String;
import java.util.List;
@@ -16,100 +17,116 @@
* For further modifications of the class, create a separate file and extend this class.
*/
@ContentItemMapping("coffee")
-public class Coffee {
- @ElementMapping("metadata__og_description")
- String metadataOgDescription;
+public class Coffee implements Serializable {
+ @ElementMapping("product_name")
+ String productName;
- @ElementMapping("metadata__meta_title")
- String metadataMetaTitle;
+ @ElementMapping("price")
+ Double price;
- @ElementMapping("metadata__og_title")
- String metadataOgTitle;
+ @ElementMapping("image")
+ List image;
+
+ @ElementMapping("short_description")
+ String shortDescription;
+
+ @ElementMapping("long_description")
+ String longDescription;
@ElementMapping("product_status")
List productStatus;
- @ElementMapping("altitude")
- String altitude;
+ @ElementMapping("farm")
+ String farm;
- @ElementMapping("metadata__meta_description")
- String metadataMetaDescription;
+ @ElementMapping("country")
+ String country;
@ElementMapping("variety")
String variety;
- @ElementMapping("image")
- List image;
-
- @ElementMapping("metadata__twitter_site")
- String metadataTwitterSite;
+ @ElementMapping("altitude")
+ String altitude;
@ElementMapping("url_pattern")
String urlPattern;
- @ElementMapping("price")
- Double price;
-
- @ElementMapping("metadata__twitter_image")
- List metadataTwitterImage;
-
- @ElementMapping("metadata__twitter_creator")
- String metadataTwitterCreator;
-
- @ElementMapping("country")
- String country;
+ @ElementMapping("processing")
+ List processing;
@ElementMapping("sitemap")
List sitemap;
- @ElementMapping("metadata__twitter_title")
- String metadataTwitterTitle;
+ @ElementMapping("metadata__meta_title")
+ String metadataMetaTitle;
- @ElementMapping("short_description")
- String shortDescription;
+ @ElementMapping("metadata__meta_description")
+ String metadataMetaDescription;
- @ElementMapping("processing")
- List processing;
+ @ElementMapping("metadata__og_title")
+ String metadataOgTitle;
- @ElementMapping("metadata__twitter_description")
- String metadataTwitterDescription;
+ @ElementMapping("metadata__og_description")
+ String metadataOgDescription;
@ElementMapping("metadata__og_image")
List metadataOgImage;
- @ElementMapping("long_description")
- String longDescription;
+ @ElementMapping("metadata__twitter_site")
+ String metadataTwitterSite;
- @ElementMapping("farm")
- String farm;
+ @ElementMapping("metadata__twitter_creator")
+ String metadataTwitterCreator;
- @ElementMapping("product_name")
- String productName;
+ @ElementMapping("metadata__twitter_title")
+ String metadataTwitterTitle;
+
+ @ElementMapping("metadata__twitter_description")
+ String metadataTwitterDescription;
+
+ @ElementMapping("metadata__twitter_image")
+ List metadataTwitterImage;
System system;
- public String getMetadataOgDescription() {
- return metadataOgDescription;
+ public String getProductName() {
+ return productName;
}
- public void setMetadataOgDescription(String metadataOgDescription) {
- this.metadataOgDescription = metadataOgDescription;
+ public void setProductName(String productName) {
+ this.productName = productName;
}
- public String getMetadataMetaTitle() {
- return metadataMetaTitle;
+ public Double getPrice() {
+ return price;
}
- public void setMetadataMetaTitle(String metadataMetaTitle) {
- this.metadataMetaTitle = metadataMetaTitle;
+ public void setPrice(Double price) {
+ this.price = price;
}
- public String getMetadataOgTitle() {
- return metadataOgTitle;
+ public List getImage() {
+ return image;
}
- public void setMetadataOgTitle(String metadataOgTitle) {
- this.metadataOgTitle = metadataOgTitle;
+ public void setImage(List image) {
+ this.image = image;
+ }
+
+ public String getShortDescription() {
+ return shortDescription;
+ }
+
+ public void setShortDescription(String shortDescription) {
+ this.shortDescription = shortDescription;
+ }
+
+ public String getLongDescription() {
+ return longDescription;
+ }
+
+ public void setLongDescription(String longDescription) {
+ this.longDescription = longDescription;
}
public List getProductStatus() {
@@ -120,20 +137,20 @@ public void setProductStatus(List productStatus) {
this.productStatus = productStatus;
}
- public String getAltitude() {
- return altitude;
+ public String getFarm() {
+ return farm;
}
- public void setAltitude(String altitude) {
- this.altitude = altitude;
+ public void setFarm(String farm) {
+ this.farm = farm;
}
- public String getMetadataMetaDescription() {
- return metadataMetaDescription;
+ public String getCountry() {
+ return country;
}
- public void setMetadataMetaDescription(String metadataMetaDescription) {
- this.metadataMetaDescription = metadataMetaDescription;
+ public void setCountry(String country) {
+ this.country = country;
}
public String getVariety() {
@@ -144,20 +161,12 @@ public void setVariety(String variety) {
this.variety = variety;
}
- public List getImage() {
- return image;
- }
-
- public void setImage(List image) {
- this.image = image;
- }
-
- public String getMetadataTwitterSite() {
- return metadataTwitterSite;
+ public String getAltitude() {
+ return altitude;
}
- public void setMetadataTwitterSite(String metadataTwitterSite) {
- this.metadataTwitterSite = metadataTwitterSite;
+ public void setAltitude(String altitude) {
+ this.altitude = altitude;
}
public String getUrlPattern() {
@@ -168,36 +177,12 @@ public void setUrlPattern(String urlPattern) {
this.urlPattern = urlPattern;
}
- public Double getPrice() {
- return price;
- }
-
- public void setPrice(Double price) {
- this.price = price;
- }
-
- public List getMetadataTwitterImage() {
- return metadataTwitterImage;
- }
-
- public void setMetadataTwitterImage(List metadataTwitterImage) {
- this.metadataTwitterImage = metadataTwitterImage;
- }
-
- public String getMetadataTwitterCreator() {
- return metadataTwitterCreator;
- }
-
- public void setMetadataTwitterCreator(String metadataTwitterCreator) {
- this.metadataTwitterCreator = metadataTwitterCreator;
- }
-
- public String getCountry() {
- return country;
+ public List getProcessing() {
+ return processing;
}
- public void setCountry(String country) {
- this.country = country;
+ public void setProcessing(List processing) {
+ this.processing = processing;
}
public List getSitemap() {
@@ -208,36 +193,36 @@ public void setSitemap(List sitemap) {
this.sitemap = sitemap;
}
- public String getMetadataTwitterTitle() {
- return metadataTwitterTitle;
+ public String getMetadataMetaTitle() {
+ return metadataMetaTitle;
}
- public void setMetadataTwitterTitle(String metadataTwitterTitle) {
- this.metadataTwitterTitle = metadataTwitterTitle;
+ public void setMetadataMetaTitle(String metadataMetaTitle) {
+ this.metadataMetaTitle = metadataMetaTitle;
}
- public String getShortDescription() {
- return shortDescription;
+ public String getMetadataMetaDescription() {
+ return metadataMetaDescription;
}
- public void setShortDescription(String shortDescription) {
- this.shortDescription = shortDescription;
+ public void setMetadataMetaDescription(String metadataMetaDescription) {
+ this.metadataMetaDescription = metadataMetaDescription;
}
- public List getProcessing() {
- return processing;
+ public String getMetadataOgTitle() {
+ return metadataOgTitle;
}
- public void setProcessing(List processing) {
- this.processing = processing;
+ public void setMetadataOgTitle(String metadataOgTitle) {
+ this.metadataOgTitle = metadataOgTitle;
}
- public String getMetadataTwitterDescription() {
- return metadataTwitterDescription;
+ public String getMetadataOgDescription() {
+ return metadataOgDescription;
}
- public void setMetadataTwitterDescription(String metadataTwitterDescription) {
- this.metadataTwitterDescription = metadataTwitterDescription;
+ public void setMetadataOgDescription(String metadataOgDescription) {
+ this.metadataOgDescription = metadataOgDescription;
}
public List getMetadataOgImage() {
@@ -248,28 +233,44 @@ public void setMetadataOgImage(List metadataOgImage) {
this.metadataOgImage = metadataOgImage;
}
- public String getLongDescription() {
- return longDescription;
+ public String getMetadataTwitterSite() {
+ return metadataTwitterSite;
}
- public void setLongDescription(String longDescription) {
- this.longDescription = longDescription;
+ public void setMetadataTwitterSite(String metadataTwitterSite) {
+ this.metadataTwitterSite = metadataTwitterSite;
}
- public String getFarm() {
- return farm;
+ public String getMetadataTwitterCreator() {
+ return metadataTwitterCreator;
}
- public void setFarm(String farm) {
- this.farm = farm;
+ public void setMetadataTwitterCreator(String metadataTwitterCreator) {
+ this.metadataTwitterCreator = metadataTwitterCreator;
}
- public String getProductName() {
- return productName;
+ public String getMetadataTwitterTitle() {
+ return metadataTwitterTitle;
}
- public void setProductName(String productName) {
- this.productName = productName;
+ public void setMetadataTwitterTitle(String metadataTwitterTitle) {
+ this.metadataTwitterTitle = metadataTwitterTitle;
+ }
+
+ public String getMetadataTwitterDescription() {
+ return metadataTwitterDescription;
+ }
+
+ public void setMetadataTwitterDescription(String metadataTwitterDescription) {
+ this.metadataTwitterDescription = metadataTwitterDescription;
+ }
+
+ public List getMetadataTwitterImage() {
+ return metadataTwitterImage;
+ }
+
+ public void setMetadataTwitterImage(List metadataTwitterImage) {
+ this.metadataTwitterImage = metadataTwitterImage;
}
public System getSystem() {
diff --git a/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/FactAboutUs.java b/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/FactAboutUs.java
index 2d602ef6..5b124bb0 100644
--- a/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/FactAboutUs.java
+++ b/sample-app-spring-boot/src/main/java/kontent/ai/delivery/sample/dancinggoat/models/FactAboutUs.java
@@ -1,5 +1,6 @@
package kontent.ai.delivery.sample.dancinggoat.models;
+import java.io.Serializable;
import java.lang.String;
import java.util.List;
import kontent.ai.delivery.Asset;
@@ -15,28 +16,20 @@
* For further modifications of the class, create a separate file and extend this class.
*/
@ContentItemMapping("fact_about_us")
-public class FactAboutUs {
- @ElementMapping("description")
- String description;
-
+public class FactAboutUs implements Serializable {
@ElementMapping("title")
String title;
- @ElementMapping("sitemap")
- List sitemap;
+ @ElementMapping("description")
+ String description;
@ElementMapping("image")
List image;
- System system;
-
- public String getDescription() {
- return description;
- }
+ @ElementMapping("sitemap")
+ List