openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r813659 - in /openjpa/trunk: openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/ openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/ openjpa-persistence/src/main/java/org/apache/openjpa/persist...
Date Fri, 11 Sep 2009 03:24:28 GMT
Author: ppoddar
Date: Fri Sep 11 03:24:27 2009
New Revision: 813659

URL: http://svn.apache.org/viewvc?rev=813659&view=rev
Log:
OPENJPA-1013: Tighten access to instance variables/methods.

Modified:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/TestMetamodel.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaExpressionBuilder.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/FetchPathImpl.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Joins.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/PathImpl.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/PredicateImpl.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/AbstractManagedType.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/MetamodelImpl.java

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/TestMetamodel.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/TestMetamodel.java?rev=813659&r1=813658&r2=813659&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/TestMetamodel.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/meta/TestMetamodel.java
Fri Sep 11 03:24:27 2009
@@ -86,7 +86,7 @@
         Class<?> mCls = m.getJavaType();
         assertSame(ImplicitFieldAccessSubclass.class, mCls);
         
-        Class<?> m2Cls = model.repos.getMetaModel(mCls, true);
+        Class<?> m2Cls = model.getRepository().getMetaModel(mCls, true);
         assertNotNull(m2Cls);
         try {
             Field f2 = getStaticField(m2Cls, "base");

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaExpressionBuilder.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaExpressionBuilder.java?rev=813659&r1=813658&r2=813659&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaExpressionBuilder.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/CriteriaExpressionBuilder.java
Fri Sep 11 03:24:27 2009
@@ -96,14 +96,14 @@
             for (Join<?,?> join : root.getJoins()) {
                 Class<?> cls = join.getAttribute().getJavaType();
                 if (join.getAttribute().isAssociation()) {
-                    ClassMetaData meta = metamodel.repos.getMetaData(cls, null, true);
+                    ClassMetaData meta = metamodel.getRepository().getMetaData(cls, null,
true);
                     PersistenceType type = MetamodelImpl.getPersistenceType(meta);
                     if (type == PersistenceType.ENTITY || type == PersistenceType.EMBEDDABLE)

                         metas.add(meta);
                 }
             }
             for (Fetch<?,?> fetch : root.getFetches()) {
-                metas.add(metamodel.repos.getCachedMetaData(fetch.getAttribute().getJavaType()));
+                metas.add(metamodel.getRepository().getCachedMetaData(fetch.getAttribute().getJavaType()));
             }
         }
         exps.accessPath = metas.toArray(new ClassMetaData[metas.size()]);

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java?rev=813659&r1=813658&r2=813659&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Expressions.java
Fri Sep 11 03:24:27 2009
@@ -1043,7 +1043,7 @@
                 ClassMetaData can = ((Types.Entity<X>)q.getRoot().getModel()).meta;
                 Class<?> candidate = can.getDescribedType();
                 if (candidate.isAssignableFrom((Class)value)) {
-                   lit.setMetaData(model.repos.getMetaData((Class<?>)value, null, true));
+                   lit.setMetaData(model.getRepository().getMetaData((Class<?>)value,
null, true));
                 } else {
                     lit.setMetaData(can);
                 }

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/FetchPathImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/FetchPathImpl.java?rev=813659&r1=813658&r2=813659&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/FetchPathImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/FetchPathImpl.java
Fri Sep 11 03:24:27 2009
@@ -40,8 +40,8 @@
  * @param <X> type of this
  */
 public class FetchPathImpl<Z,X> extends PathImpl<Z,X> implements Fetch<Z,
X> {
-    Set<Fetch<?,?>> _fetches;
-    JoinType joinType;
+    protected Set<Fetch<?,?>> _fetches;
+    protected JoinType joinType;
     
     
     FetchPathImpl(FetchParent<?,Z> parent, Members.Member<? super Z,X> member)
{

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Joins.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Joins.java?rev=813659&r1=813658&r2=813659&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Joins.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/Joins.java
Fri Sep 11 03:24:27 2009
@@ -270,8 +270,8 @@
      * 
      */
     public static abstract class AbstractCollection<Z,C,E> extends FromImpl<Z,E>
implements PluralJoin<Z, C, E> {
-        final JoinType joinType;
-        boolean allowNull = false;
+        private final JoinType joinType;
+        private boolean allowNull = false;
         
         public AbstractCollection(FromImpl<?,Z> from, Members.PluralAttributeImpl<?
super Z, C, E> member, 
             JoinType jt) {
@@ -553,8 +553,8 @@
     
        
    public static class MapKey<Z,K> extends PathImpl<Z,K> {
-       Map<?,K,?> map;
-       MapAttributeImpl<Z, K, ?> attr;
+       private final Map<?,K,?> map;
+       private final MapAttributeImpl<Z, K, ?> attr;
        
        public MapKey(Map<Z,K,?> joinMap){
            super(((MapAttribute<Z, K, ?>)joinMap.getAttribute()).getKeyJavaType());
@@ -588,7 +588,7 @@
    }
        
    public static class MapEntry<K,V> extends ExpressionImpl<java.util.Map.Entry<K,V>>
{
-       Map<?,K,V> map;
+       private final Map<?,K,V> map;
        
        public MapEntry(Map<?,K,V> joinMap){
            super(((MapAttribute)joinMap.getAttribute()).getJavaType());

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/PathImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/PathImpl.java?rev=813659&r1=813658&r2=813659&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/PathImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/PathImpl.java
Fri Sep 11 03:24:27 2009
@@ -181,7 +181,7 @@
             }
         } else if (_parent == null) {
             path = factory.newPath();
-            path.setMetaData(model.repos.getCachedMetaData(getJavaType()));
+            path.setMetaData(model.getRepository().getCachedMetaData(getJavaType()));
         }
         if (_member != null && !_member.isCollection()) {
             path.setImplicitType(getJavaType());

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/PredicateImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/PredicateImpl.java?rev=813659&r1=813658&r2=813659&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/PredicateImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/criteria/PredicateImpl.java
Fri Sep 11 03:24:27 2009
@@ -47,8 +47,8 @@
     public static final Predicate FALSE = new Expressions.NotEqual(ONE,ONE);
     
     protected final List<Predicate> _exps = new ArrayList<Predicate>();
-    protected final BooleanOperator _op;
-    protected boolean _negated = false;
+    private final BooleanOperator _op;
+    private boolean _negated = false;
 
     /**
      * A predicate no arguments representing AND operator.

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/AbstractManagedType.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/AbstractManagedType.java?rev=813659&r1=813658&r2=813659&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/AbstractManagedType.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/AbstractManagedType.java
Fri Sep 11 03:24:27 2009
@@ -783,30 +783,30 @@
         return null;
     }
     
-    public static <T, C extends java.util.Collection<E>, E> C filter(Collection<T>
original, 
+    static <T, C extends java.util.Collection<E>, E> C filter(Collection<T>
original, 
             C result, Filter<T> f1) {
         return filter(original, result, f1, null, null, null);
     }
     
-    public static <T, C extends java.util.Collection<E>, E> C filter(Collection<T>
original, 
+    static <T, C extends java.util.Collection<E>, E> C filter(Collection<T>
original, 
             C result, Filter<T> f1, Filter<T> f2) {
         return filter(original, result, f1, f2, null, null);
     }
     
-    public static <T, C extends java.util.Collection<E>, E> C filter(Collection<T>
original, 
+    static <T, C extends java.util.Collection<E>, E> C filter(Collection<T>
original, 
             C result, Filter<T> f1, Filter<T> f2, Filter<T> f3) {
         return filter(original, result, f1, f2, f3, null);
     }
     
-    public static <T> T pick(Collection<T> original, Filter<T> f1) {
+    static <T> T pick(Collection<T> original, Filter<T> f1) {
         return pick(original, f1, null, null, null);
     }
 
-    public static <T> T pick(Collection<T> original, Filter<T> f1, Filter<T>
f2) {
+    static <T> T pick(Collection<T> original, Filter<T> f1, Filter<T>
f2) {
         return pick(original, f1, f2, null, null);
     }
     
-    public static <T> T pick(Collection<T> original, Filter<T> f1, Filter<T>
f2, Filter<T> f3) {
+    static <T> T pick(Collection<T> original, Filter<T> f1, Filter<T>
f2, Filter<T> f3) {
         return pick(original, f1, f2, f3, null);
     }
     

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/MetamodelImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/MetamodelImpl.java?rev=813659&r1=813658&r2=813659&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/MetamodelImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/meta/MetamodelImpl.java
Fri Sep 11 03:24:27 2009
@@ -65,7 +65,7 @@
  * 
  */
 public class MetamodelImpl implements Metamodel, Resolver {
-    public final MetaDataRepository repos;
+    private final MetaDataRepository repos;
     private Map<Class<?>, Type<?>> _basics = new HashMap<Class<?>,
Type<?>>();
     private Map<Class<?>, EntityType<?>> _entities = new HashMap<Class<?>,
EntityType<?>>();
     private Map<Class<?>, EmbeddableType<?>> _embeddables = new HashMap<Class<?>,
EmbeddableType<?>>();
@@ -100,6 +100,10 @@
             }
         }
     }
+    
+    public MetaDataRepository getRepository() {
+        return repos;
+    }
 
     /**
      *  Return the metamodel embeddable type representing the embeddable class.
@@ -267,7 +271,7 @@
         return result;
     }
 
-    public static CollectionType categorizeCollection(Class<?> cls) {
+    static CollectionType categorizeCollection(Class<?> cls) {
         if (Set.class.isAssignableFrom(cls))
             return CollectionType.SET;
         if (List.class.isAssignableFrom(cls))



Mime
View raw message