Skip to content

Commit

Permalink
Revert "GJF reformat (#55)" (#56)
Browse files Browse the repository at this point in the history
This reverts commit 846f460.
  • Loading branch information
mboapache authored Aug 25, 2022
1 parent 846f460 commit a72c727
Show file tree
Hide file tree
Showing 1,114 changed files with 170,926 additions and 174,803 deletions.
68 changes: 31 additions & 37 deletions api/src/main/java/javax/jdo/AttributeConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,50 +17,44 @@
package javax.jdo;

/**
* Converts persistent attribute values (fields or properties) to different values stored in the
* underlying datastore and vice versa. [TBD:
*
* Converts persistent attribute values (fields or properties) to different
* values stored in the underlying datastore and vice versa.
* [TBD:
* <ul>
* <li>should we require that converters need access to any other information, e.g metadata?
* passed into the constructor
* <li>otherwise we assume there is a default constructor, and is instantiable using the current
* JDO class loader(s)
* </ul>
*
* ]
*
* <li>should we require that converters need access to any other information, e.g metadata? passed into the constructor</li>
* <li>otherwise we assume there is a default constructor, and is instantiable using the current JDO class loader(s)</li>
* </ul>]
*
* @param <A> The type of persistent attribute (field or property).
* @param <D> The type to be used in the datastore.
*/
public interface AttributeConverter<A, D> {

/**
* Converts the given persistent attribute value to its representation in the datastore.
*
* @param attributeValue Value of attribute
* @return Value in datastore
*/
D convertToDatastore(A attributeValue);
/**
* Converts the given persistent attribute value to its representation in the datastore.
* @param attributeValue Value of attribute
* @return Value in datastore
*/
D convertToDatastore(A attributeValue);

/**
* Converts the given datastore value to its representation as a persistent attribute.
*
* @param datastoreValue Value in datastore
* @return Value in attribute
*/
A convertToAttribute(D datastoreValue);
/**
* Converts the given datastore value to its representation as a persistent attribute.
* @param datastoreValue Value in datastore
* @return Value in attribute
*/
A convertToAttribute(D datastoreValue);

/**
* Dummy converter to represent "use the implementation default for this type" when using
* annotations.
*/
public static class UseDefault implements AttributeConverter<Object, Object> {
public Object convertToDatastore(Object attributeValue) {
throw new JDOUserException("This converter is not usable.");
}
/**
* Dummy converter to represent "use the implementation default for this type" when using annotations.
*/
public static class UseDefault implements AttributeConverter<Object, Object>
{
public Object convertToDatastore(Object attributeValue) {
throw new JDOUserException("This converter is not usable.");
}

public Object convertToAttribute(Object datastoreValue) {
throw new JDOUserException("This converter is not usable.");
}
}
public Object convertToAttribute(Object datastoreValue) {
throw new JDOUserException("This converter is not usable.");
}
}
}
Loading

0 comments on commit a72c727

Please sign in to comment.