diff options
author | bvosburgh | 2009-10-07 13:38:04 +0000 |
---|---|---|
committer | bvosburgh | 2009-10-07 13:38:04 +0000 |
commit | 6d2be8047c96aa5149b39f561773b752b8caec9a (patch) | |
tree | 10ba84433caab1351eb5ffe30d8b7d8849f546ae /jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal | |
parent | f3655ffe9e987bd1ff6b7189450ccd9272ffe107 (diff) | |
download | webtools.dali-6d2be8047c96aa5149b39f561773b752b8caec9a.tar.gz webtools.dali-6d2be8047c96aa5149b39f561773b752b8caec9a.tar.xz webtools.dali-6d2be8047c96aa5149b39f561773b752b8caec9a.zip |
add getIterable()
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal')
2 files changed, 20 insertions, 5 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/AspectCollectionValueModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/AspectCollectionValueModelAdapter.java index 30ab640507..5976a55adc 100644 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/AspectCollectionValueModelAdapter.java +++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/AspectCollectionValueModelAdapter.java @@ -29,13 +29,18 @@ import org.eclipse.jpt.utility.model.value.PropertyValueModel; * implement this method to add the appropriate listener to the subject * <li>{@link #disengageSubject_()}<p> * implement this method to remove the appropriate listener from the subject - * <li>{@link #iterator_()}<p> - * at the very minimum, override this method to return an iterator on the - * subject's collection aspect; it does not need to be overridden if - * {@link #iterator()} is overridden and its behavior changed + * <li>{@link #getIterable()}<p> + * at the very minimum, override this method to return an iterable containing the + * subject's collection aspect; it does not need to be overridden if either + * {@link #iterator_()} or {@link #iterator()} is overridden and its behavior changed * <li>{@link #size_()}<p> * override this method to improve performance; it does not need to be overridden if * {@link #size()} is overridden and its behavior changed + * <li>{@link #iterator_()}<p> + * override this method to return an iterator on the + * subject's collection aspect if it is not possible to implement {@link #getIterable()}; + * it does not need to be overridden if + * {@link #iterator()} is overridden and its behavior changed * <li>{@link #iterator()}<p> * override this method only if returning an empty iterator when the * subject is null is unacceptable @@ -77,6 +82,15 @@ public abstract class AspectCollectionValueModelAdapter<S, E> * @see #iterator() */ protected Iterator<E> iterator_() { + return this.getIterable().iterator(); + } + + /** + * Return the elements of the subject's collection aspect. + * At this point we can be sure the subject is not null. + * @see #iterator_() + */ + protected Iterable<E> getIterable() { throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ } diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionAspectAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionAspectAdapter.java index 2387f50d0f..bdcf4b41ee 100644 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionAspectAdapter.java +++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionAspectAdapter.java @@ -28,8 +28,9 @@ import org.eclipse.jpt.utility.model.value.PropertyValueModel; * <p> * The typical subclass will override the following methods (see the descriptions * in {@link AspectCollectionValueModelAdapter}):<ul> - * <li>{@link #iterator_()} + * <li>{@link #getIterable()} * <li>{@link #size_()} + * <li>{@link #iterator_()} * <li>{@link #iterator()} * <li>{@link #size()} * </ul> |