ca.gc.aafc.dina.dto.JsonApiDto Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dina-base-api Show documentation
Show all versions of dina-base-api Show documentation
Base DINA API package for Java built on SpringBoot and Crnk
The newest version!
package ca.gc.aafc.dina.dto;
import java.util.List;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.Singular;
/**
* Contains a DTO with its optional relationships.
*/
@AllArgsConstructor
@Builder
@Getter
public class JsonApiDto {
private final D dto;
@Singular
private final Map relationships;
/**
* Sealed interface since there is only 4 expected type of relationships.
*/
public sealed interface RelationshipBase permits
RelationshipToOne, RelationshipToMany, RelationshipToOneExternal, RelationshipManyExternal {
}
@AllArgsConstructor
@Builder
@Getter
public static final class RelationshipToOne implements RelationshipBase {
private JsonApiResource included;
}
@AllArgsConstructor
@Builder
@Getter
public static final class RelationshipToMany implements RelationshipBase {
private List included;
}
@AllArgsConstructor
@Builder
@Getter
public static final class RelationshipToOneExternal implements RelationshipBase {
private JsonApiExternalResource included;
}
@AllArgsConstructor
@Builder
@Getter
public static final class RelationshipManyExternal implements RelationshipBase {
private List included;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy