Class JsonApiConfiguration
- java.lang.Object
-
- com.toedter.spring.hateoas.jsonapi.JsonApiConfiguration
-
public class JsonApiConfiguration extends java.lang.Object
JSON:API specific configuration.
-
-
Constructor Summary
Constructors Constructor Description JsonApiConfiguration()
Creates a new defaultJsonApiConfiguration
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getTypeForClass(java.lang.Class<?> clazz)
Returns the JSON:API resource object type for a given class, when it was added withwithTypeForClass(Class, String)
.boolean
isJsonApiVersionRendered()
Indicates if the JSON:API version is rendered.boolean
isPageMetaAutomaticallyCreated()
Indicates if page meta data (rendered as top level JSON:API meta) for a paged model is created automatically.boolean
isPluralizedTypeRendered()
Indicates if the JSON:API type attribute of resource objects is pluralized.JsonApiConfiguration
withJsonApiVersionRendered(boolean jsonApiVersionRendered)
Indicates if the JSON:API version is rendered.JsonApiConfiguration
withPageMetaAutomaticallyCreated(boolean pageMetaAutomaticallyCreated)
Indicates if page meta data (rendered as top level JSON:API meta) for a paged model is created automatically.JsonApiConfiguration
withPluralizedTypeRendered(boolean pluralizedTypeRendered)
Indicates if the JSON:API type attribute of resource objects is pluralized.JsonApiConfiguration
withTypeForClass(java.lang.Class<?> clazz, java.lang.String type)
Creates a mapping for a given class to get the JSON:API resource object type when rendered.
-
-
-
Constructor Detail
-
JsonApiConfiguration
public JsonApiConfiguration()
Creates a new defaultJsonApiConfiguration
.
-
-
Method Detail
-
withTypeForClass
public JsonApiConfiguration withTypeForClass(java.lang.Class<?> clazz, java.lang.String type)
Creates a mapping for a given class to get the JSON:API resource object type when rendered.- Parameters:
clazz
- must not be null.type
- must not be null.- Returns:
- a clone of this object, except with this updated property
-
getTypeForClass
@Nullable public java.lang.String getTypeForClass(java.lang.Class<?> clazz)
Returns the JSON:API resource object type for a given class, when it was added withwithTypeForClass(Class, String)
.- Parameters:
clazz
- must not be null.- Returns:
- can return null.
-
withPluralizedTypeRendered
public JsonApiConfiguration withPluralizedTypeRendered(boolean pluralizedTypeRendered)
Indicates if the JSON:API type attribute of resource objects is pluralized.- Parameters:
pluralizedTypeRendered
- The new value of this configuration's pluralizedTypeRendered- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
isPluralizedTypeRendered
public boolean isPluralizedTypeRendered()
Indicates if the JSON:API type attribute of resource objects is pluralized.- Returns:
- The default is true.
-
withJsonApiVersionRendered
public JsonApiConfiguration withJsonApiVersionRendered(boolean jsonApiVersionRendered)
Indicates if the JSON:API version is rendered.If set to true, each rendered JSON:API document will start with
"jsonapi": { "version": "1.0" }
- Parameters:
jsonApiVersionRendered
- The new value of this configuration's jsonApiVersionRendered- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
isJsonApiVersionRendered
public boolean isJsonApiVersionRendered()
Indicates if the JSON:API version is rendered.If set to true, each rendered JSON:API document will start with
"jsonapi": { "version": "1.0" }
- Returns:
- The default is false.
-
withPageMetaAutomaticallyCreated
public JsonApiConfiguration withPageMetaAutomaticallyCreated(boolean pageMetaAutomaticallyCreated)
Indicates if page meta data (rendered as top level JSON:API meta) for a paged model is created automatically.- Parameters:
pageMetaAutomaticallyCreated
- The new value of this configuration's paginationLinksAutomaticallyCreated- Returns:
- a clone of this object, except with this updated property (returns
this
if an identical value is passed).
-
isPageMetaAutomaticallyCreated
public boolean isPageMetaAutomaticallyCreated()
Indicates if page meta data (rendered as top level JSON:API meta) for a paged model is created automatically.- Returns:
- The default is true.
-
-