OPENJPA-1013: Tighten access to instance variables/methods.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@813659 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Pinaki Poddar 2009-09-11 03:24:27 +00:00
parent df860912a7
commit b573799fc3
9 changed files with 26 additions and 22 deletions

View File

@ -86,7 +86,7 @@ public class TestMetamodel extends SingleEMFTestCase {
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");

View File

@ -96,14 +96,14 @@ public class CriteriaExpressionBuilder {
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()]);

View File

@ -1043,7 +1043,7 @@ public class Expressions {
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);
}

View File

@ -40,8 +40,8 @@ import org.apache.openjpa.persistence.meta.Members;
* @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) {

View File

@ -270,8 +270,8 @@ public abstract class Joins {
*
*/
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 abstract class Joins {
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 abstract class Joins {
}
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());

View File

@ -181,7 +181,7 @@ public class PathImpl<Z,X> extends ExpressionImpl<X> implements Path<X> {
}
} 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());

View File

@ -47,8 +47,8 @@ public abstract class PredicateImpl extends ExpressionImpl<Boolean> implements P
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.

View File

@ -783,30 +783,30 @@ public abstract class AbstractManagedType<X> extends Types.BaseType<X>
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);
}

View File

@ -65,7 +65,7 @@ import org.apache.openjpa.util.InternalException;
*
*/
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 class MetamodelImpl implements Metamodel, Resolver {
}
}
}
public MetaDataRepository getRepository() {
return repos;
}
/**
* Return the metamodel embeddable type representing the embeddable class.
@ -267,7 +271,7 @@ public class MetamodelImpl implements Metamodel, Resolver {
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))