io.katharsis.response.DataLinksContainer Maven / Gradle / Ivy
package io.katharsis.response;
import io.katharsis.jackson.serializer.DataLinksContainerSerializer;
import io.katharsis.queryParams.params.IncludedRelationsParams;
import io.katharsis.resource.field.ResourceField;
import java.util.Objects;
import java.util.Set;
/**
* A class responsible for storing information about links within resource object, that is link to the resource itself
* and relationships. The resulting JSON serialized using {@link DataLinksContainerSerializer} is
* shown below:
*
* {@code
* {
* self: "url to the resource"
* }
* }
*
*
* @see DataLinksContainerSerializer
*/
public class DataLinksContainer {
private final Object data;
private final Set relationshipFields;
private final IncludedRelationsParams includedRelations;
private final ContainerType containerType;
private final String includedFieldName;
public DataLinksContainer(Object data, Set relationshipFields, IncludedRelationsParams includedRelations, ContainerType containerType, String includedFieldName) {
this.data = data;
this.relationshipFields = relationshipFields;
this.includedRelations = includedRelations;
this.containerType = containerType;
this.includedFieldName = includedFieldName;
}
public Object getData() {
return data;
}
public Set getRelationshipFields() {
return relationshipFields;
}
public IncludedRelationsParams getIncludedRelations() {
return includedRelations;
}
public ContainerType getContainerType() {
return containerType;
}
public String getIncludedFieldName() {
return includedFieldName;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DataLinksContainer that = (DataLinksContainer) o;
return Objects.equals(data, that.data) &&
Objects.equals(relationshipFields, that.relationshipFields) &&
Objects.equals(includedRelations, that.includedRelations);
}
@Override
public int hashCode() {
return Objects.hash(data, relationshipFields, includedRelations);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy