java.lang.Object
cz.zcu.fav.kiv.mjakubas.saf.parser.mapper.XMLMapper
All Implemented Interfaces:
IMapper

public class XMLMapper extends Object implements IMapper
Serializes objects to JSON. Deserializes JSON to objects.
See Also:
  • Constructor Details

    • XMLMapper

      public XMLMapper()
  • Method Details

    • serialize

      public <T> String serialize(@NotNull @NotNull T[] entities) throws MapperException
      Description copied from interface: IMapper
      Serializes objects to a string representation.
      Specified by:
      serialize in interface IMapper
      Type Parameters:
      T - target of serialization
      Parameters:
      entities - array of objects to be serialized
      Returns:
      serialized objects
      Throws:
      MapperException - if serialization fails
    • serialize

      public <T> String serialize(@NotNull T entity) throws MapperException
      Description copied from interface: IMapper
      Serializes objects to a string representation.
      Specified by:
      serialize in interface IMapper
      Type Parameters:
      T - target of serialization
      Parameters:
      entity - object to be serialized
      Returns:
      serialized objects
      Throws:
      MapperException - if serialization fails
    • deserialize

      public <T> T[] deserialize(@NotNull @NotNull String serialization, @NotNull @NotNull Class<T> entitiesClass) throws MapperException
      Description copied from interface: IMapper
      Deserializes serialized objects in a string format to objects.
      Specified by:
      deserialize in interface IMapper
      Type Parameters:
      T - target of deserialization
      Parameters:
      serialization - serialized string
      entitiesClass - serialized entities object class
      Returns:
      deserialized objects
      Throws:
      MapperException - if deserialization fails
    • deserializeOne

      public <T> T deserializeOne(@NotNull @NotNull String serialization, @NotNull @NotNull Class<T> entitiesClass) throws MapperException
      Description copied from interface: IMapper
      Deserializes only one specific entity.
      Specified by:
      deserializeOne in interface IMapper
      Type Parameters:
      T - entity type
      Parameters:
      serialization - serialization
      entitiesClass - entity class
      Returns:
      deseralized entity
      Throws:
      MapperException - if any exception happens