additions for testability.
[utils] / support / general / src / main / java / org / wamblee / persistence / PersistentFactory.java
index c633f95532834319c57b0e40ba52309fd422b861..944bd34aa3a028df0543626e86205f70bfb6fcbb 100644 (file)
@@ -29,7 +29,7 @@ import javax.persistence.Version;
 import org.wamblee.reflection.ReflectionUtils;
 
 /**
- * Factory which creates a {@link Persistent} object for a given entity for
+ * Factory which creates a {@link Persistent} object for a given JPA entity for
  * interfacing with the primary key and version of the entity.
  * 
  * This utility only treats primary keys and fields that are annotated with @Id
@@ -46,7 +46,7 @@ public class PersistentFactory {
      */
     private static Map<String, EntityAccessor> CACHE = new ConcurrentHashMap<String, EntityAccessor>();
 
-    static interface Accessor<T> {
+    public static interface Accessor<T> {
         void set(Object aEntity, T aValue);
 
         T get(Object aEntity);
@@ -224,7 +224,8 @@ public class PersistentFactory {
      *            Annotation that must be present.
      * @return Accessor to use or null if the annotation is not present.
      */
-    private static Accessor analyse(Class aClass,
+    // TODO move generic analysis part to the reflection package.
+    public static Accessor analyse(Class aClass,
         Class<? extends Annotation> aAnnotation) {
         List<Field> fields = ReflectionUtils.getAllFields(aClass);
         for (Field field : fields) {