
com.sdl.dxa.api.datamodel.package-info Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dxa-data-model Show documentation
Show all versions of dxa-data-model Show documentation
DXA Data Model artifact provides API for de-/serializing CM JSON content into a DXA model
/**
* DXA Data Model project contains R2 model and its related classes.
* DXA data model is extensible but there are some details of implementation that are important for you if you implement custom polymorphic classes:
*
* - {@link com.fasterxml.jackson.annotation.JsonTypeName} annotation will automatically add your class as a supported for DXA polymorphic mapping
* - {@link com.sdl.dxa.api.datamodel.json.Polymorphic} annotation tells DXA mapper that this is a polymorphic class and its type is any subtype of the current class
* - {@link com.sdl.dxa.api.datamodel.model.util.HandlesHierarchyTypeInformation} is required on the parent if you have a parent-children class structure
* - Interfaces and abstract classes cannot be polymorphic, you need concrete classes as parents.
* - Your Data Model classes should be in this package or its subpackages.
*
* Here there are some examples of different class structure:
*
* - A single class that is supported by polymorphic mapping:
* package com.sdl.dxa.api.datamodel;
* import com.fasterxml.jackson.annotation.JsonTypeName;
* {@literal @}JsonTypeName
* public class SingleClass { }
*
* - A class structure for parent-children hierarchy for polymorphic mapping:
* package com.sdl.dxa.api.datamodel;
* import com.fasterxml.jackson.annotation.JsonTypeName;
* import com.sdl.dxa.api.datamodel.json.Polymorphic;
* import com.sdl.dxa.api.datamodel.model.util.HandlesHierarchyTypeInformation;
* {@literal @}JsonTypeName
* {@literal @}Polymorphic // means can by any of subclasses
* public class ParentClass implements HandlesHierarchyTypeInformation {
* {@literal @}Override
* public String getTypeId() { return "ParentClass"; }
* }
* {@literal @}JsonTypeName
* public class FirstClass extends ParentClass { }
* {@literal @}JsonTypeName
* public class SecondClass extends ParentClass { }
*
*
*
*/
package com.sdl.dxa.api.datamodel;
© 2015 - 2025 Weber Informatics LLC | Privacy Policy