All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.cloudinary.metadata.DateMetadataField Maven / Gradle / Ivy

Go to download

Cloudinary is a cloud service that offers a solution to a web application's entire image management pipeline. Upload images to the cloud. Automatically perform smart image resizing, cropping and conversion without installing any complex software. Integrate Facebook or Twitter profile image extraction in a snap, in any dimension and style to match your website’s graphics requirements. Images are seamlessly delivered through a fast CDN, and much much more. This Java library allows to easily integrate with Cloudinary in Java applications.

The newest version!
package com.cloudinary.metadata;

import com.cloudinary.utils.ObjectUtils;

import java.text.ParseException;
import java.util.Date;

/**
 * Represents a metadata field with type 'date'
 */
public class DateMetadataField extends MetadataField {

    public DateMetadataField() {
        super(MetadataFieldType.DATE);
    }

    /**
     * Sets the default date used for this field.
     * @param defaultValue The date to set. Date only without a time component, UTC assumed.
     */
    @Override
    public void setDefaultValue(Date defaultValue) {
        put(DEFAULT_VALUE, ObjectUtils.toISO8601DateOnly(defaultValue));
    }

    /**
     * Get the default value of this date field.
     * @return The date only without a time component, UTC.
     * @throws ParseException When the underlying value is malformed.
     */
    @Override
    public Date getDefaultValue() throws ParseException {
        Object value = get(DEFAULT_VALUE);
        if (value == null) {
            return null;
        }

        return ObjectUtils.fromISO8601DateOnly(value.toString());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy