Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.liferay.headless.delivery.dto.v1_0.PageFragmentInstanceDefinition Maven / Gradle / Ivy
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
package com.liferay.headless.delivery.dto.v1_0;
import com.fasterxml.jackson.annotation.JsonFilter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.liferay.petra.function.UnsafeSupplier;
import com.liferay.petra.string.StringBundler;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.vulcan.graphql.annotation.GraphQLField;
import com.liferay.portal.vulcan.graphql.annotation.GraphQLName;
import com.liferay.portal.vulcan.util.ObjectMapperUtil;
import jakarta.annotation.Generated;
import jakarta.validation.Valid;
import jakarta.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.function.Supplier;
/**
* @author Javier Gamarra
* @generated
*/
@Generated("")
@GraphQLName(
description = "Represents a definition of a Page Fragment Instance.",
value = "PageFragmentInstanceDefinition"
)
@JsonFilter("Liferay.Vulcan")
@XmlRootElement(name = "PageFragmentInstanceDefinition")
public class PageFragmentInstanceDefinition implements Serializable {
public static PageFragmentInstanceDefinition toDTO(String json) {
return ObjectMapperUtil.readValue(
PageFragmentInstanceDefinition.class, json);
}
public static PageFragmentInstanceDefinition unsafeToDTO(String json) {
return ObjectMapperUtil.unsafeReadValue(
PageFragmentInstanceDefinition.class, json);
}
@io.swagger.v3.oas.annotations.media.Schema(
description = "A list of CSS Classes that are applied to the element."
)
public String[] getCssClasses() {
if (_cssClassesSupplier != null) {
cssClasses = _cssClassesSupplier.get();
_cssClassesSupplier = null;
}
return cssClasses;
}
public void setCssClasses(String[] cssClasses) {
this.cssClasses = cssClasses;
_cssClassesSupplier = null;
}
@JsonIgnore
public void setCssClasses(
UnsafeSupplier cssClassesUnsafeSupplier) {
_cssClassesSupplier = () -> {
try {
return cssClassesUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@GraphQLField(
description = "A list of CSS Classes that are applied to the element."
)
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected String[] cssClasses;
@JsonIgnore
private Supplier _cssClassesSupplier;
@io.swagger.v3.oas.annotations.media.Schema(
description = "Custom CSS that is applied on the fragment."
)
public String getCustomCSS() {
if (_customCSSSupplier != null) {
customCSS = _customCSSSupplier.get();
_customCSSSupplier = null;
}
return customCSS;
}
public void setCustomCSS(String customCSS) {
this.customCSS = customCSS;
_customCSSSupplier = null;
}
@JsonIgnore
public void setCustomCSS(
UnsafeSupplier customCSSUnsafeSupplier) {
_customCSSSupplier = () -> {
try {
return customCSSUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@GraphQLField(description = "Custom CSS that is applied on the fragment.")
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected String customCSS;
@JsonIgnore
private Supplier _customCSSSupplier;
@io.swagger.v3.oas.annotations.media.Schema(
description = "The custom CSS viewports of the page collection."
)
@Valid
public CustomCSSViewport[] getCustomCSSViewports() {
if (_customCSSViewportsSupplier != null) {
customCSSViewports = _customCSSViewportsSupplier.get();
_customCSSViewportsSupplier = null;
}
return customCSSViewports;
}
public void setCustomCSSViewports(CustomCSSViewport[] customCSSViewports) {
this.customCSSViewports = customCSSViewports;
_customCSSViewportsSupplier = null;
}
@JsonIgnore
public void setCustomCSSViewports(
UnsafeSupplier
customCSSViewportsUnsafeSupplier) {
_customCSSViewportsSupplier = () -> {
try {
return customCSSViewportsUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@GraphQLField(
description = "The custom CSS viewports of the page collection."
)
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected CustomCSSViewport[] customCSSViewports;
@JsonIgnore
private Supplier _customCSSViewportsSupplier;
@io.swagger.v3.oas.annotations.media.Schema(
description = "The fragment of the page fragment instance."
)
@Valid
public Fragment getFragment() {
if (_fragmentSupplier != null) {
fragment = _fragmentSupplier.get();
_fragmentSupplier = null;
}
return fragment;
}
public void setFragment(Fragment fragment) {
this.fragment = fragment;
_fragmentSupplier = null;
}
@JsonIgnore
public void setFragment(
UnsafeSupplier fragmentUnsafeSupplier) {
_fragmentSupplier = () -> {
try {
return fragmentUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@GraphQLField(description = "The fragment of the page fragment instance.")
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected Fragment fragment;
@JsonIgnore
private Supplier _fragmentSupplier;
@io.swagger.v3.oas.annotations.media.Schema(
description = "The page fragment instance's configuration."
)
@Valid
public Map getFragmentConfig() {
if (_fragmentConfigSupplier != null) {
fragmentConfig = _fragmentConfigSupplier.get();
_fragmentConfigSupplier = null;
}
return fragmentConfig;
}
public void setFragmentConfig(Map fragmentConfig) {
this.fragmentConfig = fragmentConfig;
_fragmentConfigSupplier = null;
}
@JsonIgnore
public void setFragmentConfig(
UnsafeSupplier, Exception>
fragmentConfigUnsafeSupplier) {
_fragmentConfigSupplier = () -> {
try {
return fragmentConfigUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@GraphQLField(description = "The page fragment instance's configuration.")
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected Map fragmentConfig;
@JsonIgnore
private Supplier> _fragmentConfigSupplier;
@io.swagger.v3.oas.annotations.media.Schema(
description = "The fragment fields of the page fragment instance."
)
@Valid
public FragmentField[] getFragmentFields() {
if (_fragmentFieldsSupplier != null) {
fragmentFields = _fragmentFieldsSupplier.get();
_fragmentFieldsSupplier = null;
}
return fragmentFields;
}
public void setFragmentFields(FragmentField[] fragmentFields) {
this.fragmentFields = fragmentFields;
_fragmentFieldsSupplier = null;
}
@JsonIgnore
public void setFragmentFields(
UnsafeSupplier
fragmentFieldsUnsafeSupplier) {
_fragmentFieldsSupplier = () -> {
try {
return fragmentFieldsUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@GraphQLField(
description = "The fragment fields of the page fragment instance."
)
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected FragmentField[] fragmentFields;
@JsonIgnore
private Supplier _fragmentFieldsSupplier;
@io.swagger.v3.oas.annotations.media.Schema(
description = "The fragment style of the page fragment instance."
)
@Valid
public FragmentStyle getFragmentStyle() {
if (_fragmentStyleSupplier != null) {
fragmentStyle = _fragmentStyleSupplier.get();
_fragmentStyleSupplier = null;
}
return fragmentStyle;
}
public void setFragmentStyle(FragmentStyle fragmentStyle) {
this.fragmentStyle = fragmentStyle;
_fragmentStyleSupplier = null;
}
@JsonIgnore
public void setFragmentStyle(
UnsafeSupplier fragmentStyleUnsafeSupplier) {
_fragmentStyleSupplier = () -> {
try {
return fragmentStyleUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@GraphQLField(
description = "The fragment style of the page fragment instance."
)
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected FragmentStyle fragmentStyle;
@JsonIgnore
private Supplier _fragmentStyleSupplier;
@io.swagger.v3.oas.annotations.media.Schema(
description = "A list of fragment viewports of the page fragment instance."
)
@Valid
public FragmentViewport[] getFragmentViewports() {
if (_fragmentViewportsSupplier != null) {
fragmentViewports = _fragmentViewportsSupplier.get();
_fragmentViewportsSupplier = null;
}
return fragmentViewports;
}
public void setFragmentViewports(FragmentViewport[] fragmentViewports) {
this.fragmentViewports = fragmentViewports;
_fragmentViewportsSupplier = null;
}
@JsonIgnore
public void setFragmentViewports(
UnsafeSupplier
fragmentViewportsUnsafeSupplier) {
_fragmentViewportsSupplier = () -> {
try {
return fragmentViewportsUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@GraphQLField(
description = "A list of fragment viewports of the page fragment instance."
)
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected FragmentViewport[] fragmentViewports;
@JsonIgnore
private Supplier _fragmentViewportsSupplier;
@io.swagger.v3.oas.annotations.media.Schema(
description = "A flag that indicates whether the page fragment instance is indexed or not."
)
public Boolean getIndexed() {
if (_indexedSupplier != null) {
indexed = _indexedSupplier.get();
_indexedSupplier = null;
}
return indexed;
}
public void setIndexed(Boolean indexed) {
this.indexed = indexed;
_indexedSupplier = null;
}
@JsonIgnore
public void setIndexed(
UnsafeSupplier indexedUnsafeSupplier) {
_indexedSupplier = () -> {
try {
return indexedUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@GraphQLField(
description = "A flag that indicates whether the page fragment instance is indexed or not."
)
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected Boolean indexed;
@JsonIgnore
private Supplier _indexedSupplier;
@io.swagger.v3.oas.annotations.media.Schema(
description = "The custom name of a Page Fragment Instance."
)
public String getName() {
if (_nameSupplier != null) {
name = _nameSupplier.get();
_nameSupplier = null;
}
return name;
}
public void setName(String name) {
this.name = name;
_nameSupplier = null;
}
@JsonIgnore
public void setName(UnsafeSupplier nameUnsafeSupplier) {
_nameSupplier = () -> {
try {
return nameUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@GraphQLField(description = "The custom name of a Page Fragment Instance.")
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected String name;
@JsonIgnore
private Supplier _nameSupplier;
@io.swagger.v3.oas.annotations.media.Schema(
description = "A list of widget instances of the page fragment instance."
)
@Valid
public WidgetInstance[] getWidgetInstances() {
if (_widgetInstancesSupplier != null) {
widgetInstances = _widgetInstancesSupplier.get();
_widgetInstancesSupplier = null;
}
return widgetInstances;
}
public void setWidgetInstances(WidgetInstance[] widgetInstances) {
this.widgetInstances = widgetInstances;
_widgetInstancesSupplier = null;
}
@JsonIgnore
public void setWidgetInstances(
UnsafeSupplier
widgetInstancesUnsafeSupplier) {
_widgetInstancesSupplier = () -> {
try {
return widgetInstancesUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}
@GraphQLField(
description = "A list of widget instances of the page fragment instance."
)
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected WidgetInstance[] widgetInstances;
@JsonIgnore
private Supplier _widgetInstancesSupplier;
@Override
public boolean equals(Object object) {
if (this == object) {
return true;
}
if (!(object instanceof PageFragmentInstanceDefinition)) {
return false;
}
PageFragmentInstanceDefinition pageFragmentInstanceDefinition =
(PageFragmentInstanceDefinition)object;
return Objects.equals(
toString(), pageFragmentInstanceDefinition.toString());
}
@Override
public int hashCode() {
String string = toString();
return string.hashCode();
}
public String toString() {
StringBundler sb = new StringBundler();
sb.append("{");
String[] cssClasses = getCssClasses();
if (cssClasses != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"cssClasses\": ");
sb.append("[");
for (int i = 0; i < cssClasses.length; i++) {
sb.append("\"");
sb.append(_escape(cssClasses[i]));
sb.append("\"");
if ((i + 1) < cssClasses.length) {
sb.append(", ");
}
}
sb.append("]");
}
String customCSS = getCustomCSS();
if (customCSS != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"customCSS\": ");
sb.append("\"");
sb.append(_escape(customCSS));
sb.append("\"");
}
CustomCSSViewport[] customCSSViewports = getCustomCSSViewports();
if (customCSSViewports != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"customCSSViewports\": ");
sb.append("[");
for (int i = 0; i < customCSSViewports.length; i++) {
sb.append(String.valueOf(customCSSViewports[i]));
if ((i + 1) < customCSSViewports.length) {
sb.append(", ");
}
}
sb.append("]");
}
Fragment fragment = getFragment();
if (fragment != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"fragment\": ");
sb.append(String.valueOf(fragment));
}
Map fragmentConfig = getFragmentConfig();
if (fragmentConfig != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"fragmentConfig\": ");
sb.append(_toJSON(fragmentConfig));
}
FragmentField[] fragmentFields = getFragmentFields();
if (fragmentFields != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"fragmentFields\": ");
sb.append("[");
for (int i = 0; i < fragmentFields.length; i++) {
sb.append(String.valueOf(fragmentFields[i]));
if ((i + 1) < fragmentFields.length) {
sb.append(", ");
}
}
sb.append("]");
}
FragmentStyle fragmentStyle = getFragmentStyle();
if (fragmentStyle != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"fragmentStyle\": ");
sb.append(String.valueOf(fragmentStyle));
}
FragmentViewport[] fragmentViewports = getFragmentViewports();
if (fragmentViewports != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"fragmentViewports\": ");
sb.append("[");
for (int i = 0; i < fragmentViewports.length; i++) {
sb.append(String.valueOf(fragmentViewports[i]));
if ((i + 1) < fragmentViewports.length) {
sb.append(", ");
}
}
sb.append("]");
}
Boolean indexed = getIndexed();
if (indexed != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"indexed\": ");
sb.append(indexed);
}
String name = getName();
if (name != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"name\": ");
sb.append("\"");
sb.append(_escape(name));
sb.append("\"");
}
WidgetInstance[] widgetInstances = getWidgetInstances();
if (widgetInstances != null) {
if (sb.length() > 1) {
sb.append(", ");
}
sb.append("\"widgetInstances\": ");
sb.append("[");
for (int i = 0; i < widgetInstances.length; i++) {
sb.append(String.valueOf(widgetInstances[i]));
if ((i + 1) < widgetInstances.length) {
sb.append(", ");
}
}
sb.append("]");
}
sb.append("}");
return sb.toString();
}
@io.swagger.v3.oas.annotations.media.Schema(
accessMode = io.swagger.v3.oas.annotations.media.Schema.AccessMode.READ_ONLY,
defaultValue = "com.liferay.headless.delivery.dto.v1_0.PageFragmentInstanceDefinition",
name = "x-class-name"
)
public String xClassName;
private static String _escape(Object object) {
return StringUtil.replace(
String.valueOf(object), _JSON_ESCAPE_STRINGS[0],
_JSON_ESCAPE_STRINGS[1]);
}
private static boolean _isArray(Object value) {
if (value == null) {
return false;
}
Class> clazz = value.getClass();
return clazz.isArray();
}
private static String _toJSON(Map map) {
StringBuilder sb = new StringBuilder("{");
@SuppressWarnings("unchecked")
Set set = map.entrySet();
@SuppressWarnings("unchecked")
Iterator> iterator = set.iterator();
while (iterator.hasNext()) {
Map.Entry entry = iterator.next();
sb.append("\"");
sb.append(_escape(entry.getKey()));
sb.append("\": ");
Object value = entry.getValue();
if (_isArray(value)) {
sb.append("[");
Object[] valueArray = (Object[])value;
for (int i = 0; i < valueArray.length; i++) {
if (valueArray[i] instanceof Map) {
sb.append(_toJSON((Map)valueArray[i]));
}
else if (valueArray[i] instanceof String) {
sb.append("\"");
sb.append(valueArray[i]);
sb.append("\"");
}
else {
sb.append(valueArray[i]);
}
if ((i + 1) < valueArray.length) {
sb.append(", ");
}
}
sb.append("]");
}
else if (value instanceof Map) {
sb.append(_toJSON((Map)value));
}
else if (value instanceof String) {
sb.append("\"");
sb.append(_escape(value));
sb.append("\"");
}
else {
sb.append(value);
}
if (iterator.hasNext()) {
sb.append(", ");
}
}
sb.append("}");
return sb.toString();
}
private static final String[][] _JSON_ESCAPE_STRINGS = {
{"\\", "\"", "\b", "\f", "\n", "\r", "\t"},
{"\\\\", "\\\"", "\\b", "\\f", "\\n", "\\r", "\\t"}
};
private Map _extendedProperties;
}