
com.commercetools.importapi.models.common.Image Maven / Gradle / Ivy
Show all versions of commercetools-sdk-java-importapi Show documentation
package com.commercetools.importapi.models.common;
import java.time.*;
import java.util.*;
import java.util.function.Function;
import javax.annotation.Nullable;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.*;
import io.vrap.rmf.base.client.utils.Generated;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
/**
* An Image uploaded to commercetools Composable Commerce is stored in a Content Delivery Network and it's available in several pre-defined sizes. If you already have an image stored on an external service, you can save the URL when creating a new product or adding a variant, or you can add it later.
*
*
* Example to create an instance using the builder pattern
*
*
* Image image = Image.builder()
* .url("{url}")
* .dimensions(dimensionsBuilder -> dimensionsBuilder)
* .build()
*
*
*/
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
@JsonDeserialize(as = ImageImpl.class)
public interface Image {
/**
* URL of the image in its original size. The URL must be unique within a single variant. It can be used to obtain the image in different sizes.
* @return url
*/
@NotNull
@JsonProperty("url")
public String getUrl();
/**
* Dimensions of the original image. This can be used by your application, for example, to determine whether the image is large enough to display a zoom view.
* @return dimensions
*/
@NotNull
@Valid
@JsonProperty("dimensions")
public AssetDimensions getDimensions();
/**
* Custom label that can be used, for example, as an image description.
* @return label
*/
@JsonProperty("label")
public String getLabel();
/**
* URL of the image in its original size. The URL must be unique within a single variant. It can be used to obtain the image in different sizes.
* @param url value to be set
*/
public void setUrl(final String url);
/**
* Dimensions of the original image. This can be used by your application, for example, to determine whether the image is large enough to display a zoom view.
* @param dimensions value to be set
*/
public void setDimensions(final AssetDimensions dimensions);
/**
* Custom label that can be used, for example, as an image description.
* @param label value to be set
*/
public void setLabel(final String label);
/**
* factory method
* @return instance of Image
*/
public static Image of() {
return new ImageImpl();
}
/**
* factory method to create a shallow copy Image
* @param template instance to be copied
* @return copy instance
*/
public static Image of(final Image template) {
ImageImpl instance = new ImageImpl();
instance.setUrl(template.getUrl());
instance.setDimensions(template.getDimensions());
instance.setLabel(template.getLabel());
return instance;
}
/**
* factory method to create a deep copy of Image
* @param template instance to be copied
* @return copy instance
*/
@Nullable
public static Image deepCopy(@Nullable final Image template) {
if (template == null) {
return null;
}
ImageImpl instance = new ImageImpl();
instance.setUrl(template.getUrl());
instance.setDimensions(
com.commercetools.importapi.models.common.AssetDimensions.deepCopy(template.getDimensions()));
instance.setLabel(template.getLabel());
return instance;
}
/**
* builder factory method for Image
* @return builder
*/
public static ImageBuilder builder() {
return ImageBuilder.of();
}
/**
* create builder for Image instance
* @param template instance with prefilled values for the builder
* @return builder
*/
public static ImageBuilder builder(final Image template) {
return ImageBuilder.of(template);
}
/**
* accessor map function
* @param mapped type
* @param helper function to map the object
* @return mapped value
*/
default T withImage(Function helper) {
return helper.apply(this);
}
/**
* gives a TypeReference for usage with Jackson DataBind
* @return TypeReference
*/
public static com.fasterxml.jackson.core.type.TypeReference typeReference() {
return new com.fasterxml.jackson.core.type.TypeReference() {
@Override
public String toString() {
return "TypeReference";
}
};
}
}