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

io.katharsis.request.dto.RequestBody Maven / Gradle / Ivy

There is a newer version: 3.0.2
Show newest version
package io.katharsis.request.dto;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.katharsis.jackson.deserializer.RequestBodyDeserializer;

@JsonDeserialize(using = RequestBodyDeserializer.class)
public class RequestBody {

    /**
     * Can be either of type {@link DataBody} or {@link Iterable} of {@link DataBody}.
     */
    private Object data;

    public Object getData() {
        return data;
    }

    public DataBody getSingleData() {
        return (DataBody) data;
    }

    public Iterable getMultipleData() {
        //noinspection unchecked
        return (Iterable) data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public boolean isMultiple() {
        return data != null &&
                Iterable.class.isAssignableFrom(data.getClass());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy