Package javax.jdo

Interface AttributeConverter<A,​D>

  • Type Parameters:
    A - The type of persistent attribute (field or property).
    D - The type to be used in the datastore.
    All Known Implementing Classes:
    AttributeConverter.UseDefault

    public interface AttributeConverter<A,​D>
    Converts persistent attribute values (fields or properties) to different values stored in the underlying datastore and vice versa. [TBD:
    • should we require that converters need access to any other information, e.g metadata? passed into the constructor
    • otherwise we assume there is a default constructor, and is instantiable using the current JDO class loader(s)
    ]
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  AttributeConverter.UseDefault
      Dummy converter to represent "use the implementation default for this type" when using annotations.
    • Method Detail

      • convertToDatastore

        D convertToDatastore​(A attributeValue)
        Converts the given persistent attribute value to its representation in the datastore.
        Parameters:
        attributeValue - Value of attribute
        Returns:
        Value in datastore
      • convertToAttribute

        A convertToAttribute​(D datastoreValue)
        Converts the given datastore value to its representation as a persistent attribute.
        Parameters:
        datastoreValue - Value in datastore
        Returns:
        Value in attribute