ca.gc.aafc.dina.dto.JsonApiMeta 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.function.BiFunction;
import lombok.AllArgsConstructor;
import lombok.Builder;
/**
* Represents the meta section of a JSON:API response.
*
*/
@Builder
@AllArgsConstructor
public final class JsonApiMeta {
public static final String RESOURCE_COUNT = "totalResourceCount";
public static final String MODULE_VERSION = "moduleVersion";
private Integer totalResourceCount = null;
private String moduleVersion = null;
private JsonApiMeta() {
}
/**
* Call the provided method to set the metadata per key/value.
* @param metaSetter
*/
public void populateMeta(BiFunction metaSetter) {
if (totalResourceCount != null) {
metaSetter.apply(RESOURCE_COUNT, totalResourceCount);
}
if (moduleVersion != null) {
metaSetter.apply(MODULE_VERSION, moduleVersion);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy