OPENJPA-357, OPENJPA-358: Adding @since tag/comments to new additions to FetchGroup inclusion

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@574289 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Pinaki Poddar 2007-09-10 16:01:40 +00:00
parent cd66165d76
commit 6d5fe3bb8a
2 changed files with 21 additions and 12 deletions

View File

@ -20,6 +20,7 @@ package org.apache.openjpa.meta;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@ -108,6 +109,9 @@ public class FetchGroup
if (fg._includes != null)
for (Iterator itr = fg._includes.iterator(); itr.hasNext();)
addDeclaredInclude((String) itr.next());
if (fg._containedBy != null)
this._containedBy = new HashSet(fg._containedBy);
if (fg._depths != null) {
Map.Entry entry;
for (Iterator itr = fg._depths.entrySet().iterator();
@ -155,7 +159,7 @@ public class FetchGroup
if (_includes != null) {
if (_includes.contains(fgName))
return true;
if (recurse) {
if (recurse && _meta!=null) {
FetchGroup fg;
for (Iterator i = _includes.iterator(); i.hasNext();) {
fg = _meta.getFetchGroup((String) i.next());
@ -177,14 +181,18 @@ public class FetchGroup
}
/**
* Sets this receiver as one of the included fetch groups of the given
* Adds this receiver as one of the included fetch groups of the given
* parent.
* The parent fecth grop must include this receiver before this call.
* The parent fecth group will include this receiver as a side-effect of
* this call.
*
* @see #includes(String, boolean)
* @see #addDeclaredInclude(String)
*
* @return true if given parent is a new addition. false othrwise.
* @since 1.1.1
*/
public boolean setContainedBy(FetchGroup parent) {
public boolean addContainedBy(FetchGroup parent) {
parent.addDeclaredInclude(this.getName());
if (_containedBy==null)
_containedBy = new HashSet();
@ -195,11 +203,12 @@ public class FetchGroup
* Gets the name of the fetch groups in which this receiver has been
* included.
*
* @see #setContainedBy(FetchGroup)
* @see #addContainedBy(FetchGroup)
* @since 1.1.1
*/
public String[] getContainedBy() {
return (_containedBy == null) ? new String[0]
: (String[]) _containedBy.toArray(new String[_containedBy.size()]);
public Set getContainedBy() {
return (_containedBy == null) ? Collections.EMPTY_SET :
Collections.unmodifiableSet(_containedBy);
}
/**

View File

@ -902,7 +902,7 @@ public class AnnotationPersistenceMetaDataParser
fg = meta.getFetchGroup(group.name());
String[] includedFetchGropNames = fg.getDeclaredIncludes();
for (String includedFectchGroupName:includedFetchGropNames)
meta.getFetchGroup(includedFectchGroupName).setContainedBy(fg);
meta.getFetchGroup(includedFectchGroupName).addContainedBy(fg);
}
for (FetchGroup group : groups) {
@ -925,9 +925,9 @@ public class AnnotationPersistenceMetaDataParser
meta, attr.name()));
field.setInFetchGroup(fg.getName(), true);
String[] parentFetchGroups = fg.getContainedBy();
for (String parentFetchGroup:parentFetchGroups)
field.setInFetchGroup(parentFetchGroup, true);
Set parentFetchGroups = fg.getContainedBy();
for (Object parentFetchGroup:parentFetchGroups)
field.setInFetchGroup(parentFetchGroup.toString(), true);
if (attr.recursionDepth() != Integer.MIN_VALUE)
fg.setRecursionDepth(field, attr.recursionDepth());
}