public class ConverterConfiguration extends Object
This class exposes contracts needed to handle JSON API spec serialization/deserialization.
| Constructor and Description |
|---|
ConverterConfiguration(Class<?>... classes)
Creates new ConverterConfiguration.
|
| Modifier and Type | Method and Description |
|---|---|
Relationship |
getFieldRelationship(Field field)
Resolves
Relationship instance for given field. |
Field |
getIdField(Class<?> clazz)
Returns the id field for given type.
|
ResourceIdHandler |
getIdHandler(Class<?> clazz)
Returns handler registered for given type's id field.
|
Field |
getLinksField(Class<?> clazz)
Resolves link field for given type.
|
Field |
getMetaField(Class<?> clazz)
Returns field annotated with meta annotation for given type.
|
Class<?> |
getMetaType(Class<?> clazz)
Returns meta-data type for given class.
|
Field |
getRelationshipField(Class<?> clazz,
String fieldName)
Returns relationship field.
|
List<Field> |
getRelationshipFields(Class<?> clazz)
Returns list of all fields annotated with
Relationship annotation for given class. |
Field |
getRelationshipLinksField(Class<?> clazz,
String relationshipName)
Returns relationship links field.
|
Field |
getRelationshipMetaField(Class<?> clazz,
String relationshipName)
Returns relationship meta field.
|
Class<?> |
getRelationshipMetaType(Class<?> clazz,
String relationshipName)
Returns a type of a relationship meta field.
|
Class<?> |
getRelationshipType(Class<?> clazz,
String fieldName)
Returns a type of a relationship.
|
Type |
getType(Class<?> clazz)
Resolves and returns the type given to provided class.
|
Class<?> |
getTypeClass(String typeName)
Resolves a type for given type name.
|
String |
getTypeName(Class<?> clazz)
Resolves and returns name of the type given to provided class.
|
static boolean |
isEligibleType(Class<?> type)
|
boolean |
isRegisteredType(Class<?> clazz)
Checks if provided class was registered with this configuration instance.
|
boolean |
registerType(Class<?> type)
Registers new type with this configuration instance.
|
public ConverterConfiguration(Class<?>... classes)
classes - list of mapped classespublic Field getMetaField(Class<?> clazz)
public ResourceIdHandler getIdHandler(Class<?> clazz)
clazz - Class type to resolve id handler forpublic Field getRelationshipField(Class<?> clazz, String fieldName)
public Class<?> getRelationshipType(Class<?> clazz, String fieldName)
public Relationship getFieldRelationship(Field field)
Relationship instance for given field.
This works for fields that were found to be annotated with Relationship annotation.
field - Field to get relationship forRelationship anotation or nullpublic List<Field> getRelationshipFields(Class<?> clazz)
Relationship annotation for given class.clazz - Class to get relationship fields forpublic boolean isRegisteredType(Class<?> clazz)
clazz - Class to checktrue if class was registed else falsepublic String getTypeName(Class<?> clazz)
clazz - Class to resolve type name fornull if type was not registeredpublic Type getType(Class<?> clazz)
clazz - Class to resolve type name fornull if type was not registeredpublic boolean registerType(Class<?> type)
type - Class type to registertrue in case type was registered, false in case type was registered alreadypublic static boolean isEligibleType(Class<?> type)
Type annotation and field annotated with
Id.type - type to testtrue if type is eligiblepublic Field getRelationshipMetaField(Class<?> clazz, String relationshipName)
public Class<?> getRelationshipMetaType(Class<?> clazz, String relationshipName)
Copyright © 2017. All rights reserved.