diff options
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractResultSet.java')
-rw-r--r-- | jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractResultSet.java | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractResultSet.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractResultSet.java deleted file mode 100644 index 4c795b12c..000000000 --- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/query/AbstractResultSet.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Oracle Corporation. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - * - ********************************************************************************/ - -package org.eclipse.jst.jsf.common.metadata.query; - -import java.util.Collections; -import java.util.List; - -/** - * Abstract implementation of {@link IResultSet} that developers may subclass. - * Users should assume that the results are only valid at the time of the query. This may change in the future. - * <p><b>Provisional API - subject to change</b></p> - * @param <T> - */ -public abstract class AbstractResultSet<T> implements IResultSet<T> { - private List _results; - private boolean _isClosed = false; - - public List<T> getResults() throws MetaDataException { - initIfNecessary(); - return _results; - } - - public final void close() throws MetaDataException { - doClose(); - _isClosed = true; - _results = null; - } - - /** - * Overridable method to close resultset. This is called by close() - * @throws MetaDataException - */ - protected void doClose() throws MetaDataException { - //subclasses to provide override - } - - public final boolean isClosed() { - return _isClosed; - } - - /** - * @return List of results. Null is tolerated. - */ - protected abstract List<T> getInternalResults(); - - private void initIfNecessary() throws MetaDataException { - if (_isClosed) - throw new MetaDataException("Attempt to access a closed resultset."); //$NON-NLS-1$ - - if (_results == null) { - List<T> checkNullResults = getInternalResults(); - if (checkNullResults == null){ - checkNullResults = Collections.EMPTY_LIST; - } - _results = Collections.unmodifiableList(checkNullResults); - } - } - -} |