[Japi-cvs] SF.net SVN: japi: [507] historic/trunk/src/app/net/sf/japi/lang/ SuperClassIterator.java
Status: Beta
Brought to you by:
christianhujer
From: <chr...@us...> - 2007-07-07 08:57:46
|
Revision: 507 http://svn.sourceforge.net/japi/?rev=507&view=rev Author: christianhujer Date: 2007-07-07 01:57:44 -0700 (Sat, 07 Jul 2007) Log Message: ----------- Removed SuperClassIterator from historic - it's now in libs-lang. Removed Paths: ------------- historic/trunk/src/app/net/sf/japi/lang/SuperClassIterator.java Deleted: historic/trunk/src/app/net/sf/japi/lang/SuperClassIterator.java =================================================================== --- historic/trunk/src/app/net/sf/japi/lang/SuperClassIterator.java 2007-07-07 08:48:43 UTC (rev 506) +++ historic/trunk/src/app/net/sf/japi/lang/SuperClassIterator.java 2007-07-07 08:57:44 UTC (rev 507) @@ -1,70 +0,0 @@ -/* JAPI - (Yet another (hopefully) useful) Java API - * - * Copyright (C) 2004-2006 Christian Hujer - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - */ - -package net.sf.japi.lang; - -import java.util.Iterator; -import java.util.NoSuchElementException; -import org.jetbrains.annotations.Nullable; - -/** An Iterator for iterating through the superclasses (subclasses to superclasses) of a class. - * Note: The supplied class is included in iteration. If you want to omit it, you'll have to invoke getSuperclass() once, e.g. use <code>new SuperClassIterator(clazz.getSuperClass())</code> instead of <code>new SuperClassIterator(clazz)</code>. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public class SuperClassIterator implements Iterator<Class<?>>, Iterable<Class<?>> { - - /** The current class. */ - @Nullable private Class<?> nextClass; - - /** Create a SuperClassIterator. - * @param clazz Class to create Iterator for - */ - public SuperClassIterator(@Nullable final Class<?> clazz) { - nextClass = clazz; - } - - /** {@inheritDoc} */ - public boolean hasNext() { - return nextClass != null; - } - - /** {@inheritDoc} */ - public Class<?> next() { - if (nextClass == null) { - throw new NoSuchElementException(); - } - try { - return nextClass; - } finally { - nextClass = nextClass.getSuperclass(); - } - } - - /** {@inheritDoc} */ - public void remove() { - throw new UnsupportedOperationException(); - } - - /** {@inheritDoc} */ - public Iterator<Class<?>> iterator() { - return this; - } - -} // class ClassIterator This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |