Purge deprecated classes
Issue: SWF-1694
This commit is contained in:
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright 2004-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.binding.collection;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Iterator that combines multiple other iterators. This is a simple implementation that just maintains a list of
|
||||
* iterators which are invoked in sequence untill all iterators are exhausted.
|
||||
*
|
||||
* @author Erwin Vervaet
|
||||
* @deprecated in favor of {@link org.springframework.util.CompositeIterator}
|
||||
*/
|
||||
@Deprecated
|
||||
public class CompositeIterator<E> implements Iterator<E> {
|
||||
|
||||
private List<Iterator<E>> iterators = new LinkedList<Iterator<E>>();
|
||||
|
||||
private boolean inUse = false;
|
||||
|
||||
/**
|
||||
* Create a new composite iterator. Add iterators using the {@link #add(Iterator)} method.
|
||||
*/
|
||||
public CompositeIterator() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add given iterator to this composite.
|
||||
*/
|
||||
public void add(Iterator<E> iterator) {
|
||||
Assert.state(!inUse, "You can no longer add iterator to a composite iterator that's already in use");
|
||||
if (iterators.contains(iterator)) {
|
||||
throw new IllegalArgumentException("You cannot add the same iterator twice");
|
||||
}
|
||||
iterators.add(iterator);
|
||||
}
|
||||
|
||||
public boolean hasNext() {
|
||||
inUse = true;
|
||||
for (Iterator<E> iterator : iterators) {
|
||||
if (iterator.hasNext()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public E next() {
|
||||
inUse = true;
|
||||
for (Iterator<E> iterator : iterators) {
|
||||
if (iterator.hasNext()) {
|
||||
return iterator.next();
|
||||
}
|
||||
}
|
||||
throw new NoSuchElementException("Exhaused all iterators");
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException("Remove is not supported");
|
||||
}
|
||||
}
|
||||
@@ -132,9 +132,6 @@ public class GenericConversionService implements ConversionService {
|
||||
*
|
||||
* @param id the id of the custom converter instance
|
||||
* @param converter the converter
|
||||
*
|
||||
* @deprecated use {@link #addConverter(Converter)} instead or better yet use Spring 3 type conversion and
|
||||
* formatting options (see Spring Documentation).
|
||||
*/
|
||||
public void addConverter(String id, Converter converter) {
|
||||
customConverters.put(id, converter);
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
/*
|
||||
* Copyright 2004-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.binding.collection;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* Test case for {@link CompositeIterator}.
|
||||
*
|
||||
* @author Erwin Vervaet
|
||||
*/
|
||||
@Deprecated
|
||||
public class CompositeIteratorTests extends TestCase {
|
||||
|
||||
public void testNoIterators() {
|
||||
CompositeIterator<Object> it = new CompositeIterator<Object>();
|
||||
assertFalse(it.hasNext());
|
||||
try {
|
||||
it.next();
|
||||
fail();
|
||||
} catch (NoSuchElementException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testSingleIterator() {
|
||||
CompositeIterator<String> it = new CompositeIterator<String>();
|
||||
it.add(Arrays.asList(new String[] { "0", "1" }).iterator());
|
||||
for (int i = 0; i < 2; i++) {
|
||||
assertTrue(it.hasNext());
|
||||
assertEquals(String.valueOf(i), it.next());
|
||||
}
|
||||
assertFalse(it.hasNext());
|
||||
try {
|
||||
it.next();
|
||||
fail();
|
||||
} catch (NoSuchElementException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testMultipleIterators() {
|
||||
CompositeIterator<String> it = new CompositeIterator<String>();
|
||||
it.add(Arrays.asList(new String[] { "0", "1" }).iterator());
|
||||
it.add(Arrays.asList(new String[] { "2" }).iterator());
|
||||
it.add(Arrays.asList(new String[] { "3", "4" }).iterator());
|
||||
for (int i = 0; i < 5; i++) {
|
||||
assertTrue(it.hasNext());
|
||||
assertEquals(String.valueOf(i), it.next());
|
||||
}
|
||||
assertFalse(it.hasNext());
|
||||
try {
|
||||
it.next();
|
||||
fail();
|
||||
} catch (NoSuchElementException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testInUse() {
|
||||
List<String> list = Arrays.asList(new String[] { "0", "1" });
|
||||
CompositeIterator<String> it = new CompositeIterator<String>();
|
||||
it.add(list.iterator());
|
||||
it.hasNext();
|
||||
try {
|
||||
it.add(list.iterator());
|
||||
fail();
|
||||
} catch (IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
it = new CompositeIterator<String>();
|
||||
it.add(list.iterator());
|
||||
it.next();
|
||||
try {
|
||||
it.add(list.iterator());
|
||||
fail();
|
||||
} catch (IllegalStateException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
public void testDuplicateIterators() {
|
||||
List<String> list = Arrays.asList(new String[] { "0", "1" });
|
||||
Iterator<String> iterator = list.iterator();
|
||||
CompositeIterator<String> it = new CompositeIterator<String>();
|
||||
it.add(iterator);
|
||||
it.add(list.iterator());
|
||||
try {
|
||||
it.add(iterator);
|
||||
fail();
|
||||
} catch (IllegalArgumentException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -45,7 +45,6 @@ import org.springframework.binding.format.DefaultNumberFormatFactory;
|
||||
*
|
||||
* @author Keith Donald
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class DefaultConversionServiceTests extends TestCase {
|
||||
|
||||
public void testConvertCompatibleTypes() {
|
||||
|
||||
Reference in New Issue
Block a user