[COLLECTIONS-451] Hide constructors for *Utils classes.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1457508 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas Neidhart 2013-03-17 18:21:58 +00:00
parent 7ec6ca6814
commit a2be810bb5
14 changed files with 18 additions and 42 deletions

View File

@ -47,11 +47,9 @@ public class BagUtils {
UnmodifiableSortedBag.unmodifiableSortedBag(new TreeBag<Object>()); UnmodifiableSortedBag.unmodifiableSortedBag(new TreeBag<Object>());
/** /**
* Instantiation of BagUtils is not intended or required. However, some * Instantiation of BagUtils is not intended or required.
* tools require an instance to operate.
*/ */
public BagUtils() { private BagUtils() {}
}
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
/** /**

View File

@ -55,9 +55,7 @@ public class ClosureUtils {
/** /**
* This class is not normally instantiated. * This class is not normally instantiated.
*/ */
public ClosureUtils() { private ClosureUtils() {}
super();
}
/** /**
* Gets a Closure that always throws an exception. * Gets a Closure that always throws an exception.

View File

@ -195,8 +195,7 @@ public class CollectionUtils {
/** /**
* <code>CollectionUtils</code> should not normally be instantiated. * <code>CollectionUtils</code> should not normally be instantiated.
*/ */
public CollectionUtils() { private CollectionUtils() {}
}
/** /**
* Returns the immutable EMPTY_COLLECTION with generic type safety. * Returns the immutable EMPTY_COLLECTION with generic type safety.

View File

@ -43,8 +43,7 @@ public class ComparatorUtils {
/** /**
* ComparatorUtils should not normally be instantiated. * ComparatorUtils should not normally be instantiated.
*/ */
public ComparatorUtils() { private ComparatorUtils() {}
}
/** /**
* Comparator for natural sort order. * Comparator for natural sort order.

View File

@ -34,9 +34,7 @@ public class EnumerationUtils {
/** /**
* EnumerationUtils is not normally instantiated. * EnumerationUtils is not normally instantiated.
*/ */
public EnumerationUtils() { private EnumerationUtils() {}
// no init.
}
/** /**
* Creates a list based on an enumeration. * Creates a list based on an enumeration.

View File

@ -41,9 +41,7 @@ public class FactoryUtils {
/** /**
* This class is not normally instantiated. * This class is not normally instantiated.
*/ */
public FactoryUtils() { private FactoryUtils() {}
super();
}
/** /**
* Gets a Factory that always throws an exception. * Gets a Factory that always throws an exception.

View File

@ -112,8 +112,7 @@ public class IteratorUtils {
/** /**
* IteratorUtils is not normally instantiated. * IteratorUtils is not normally instantiated.
*/ */
public IteratorUtils() { private IteratorUtils() {}
}
// Empty // Empty
//----------------------------------------------------------------------- //-----------------------------------------------------------------------

View File

@ -50,8 +50,7 @@ public class ListUtils {
/** /**
* <code>ListUtils</code> should not normally be instantiated. * <code>ListUtils</code> should not normally be instantiated.
*/ */
public ListUtils() { private ListUtils() {}
}
//----------------------------------------------------------------------- //-----------------------------------------------------------------------

View File

@ -97,8 +97,7 @@ public class MapUtils {
/** /**
* <code>MapUtils</code> should not normally be instantiated. * <code>MapUtils</code> should not normally be instantiated.
*/ */
public MapUtils() { private MapUtils() {}
}
// Type safe getters // Type safe getters
//------------------------------------------------------------------------- //-------------------------------------------------------------------------

View File

@ -74,9 +74,7 @@ public class PredicateUtils {
/** /**
* This class is not normally instantiated. * This class is not normally instantiated.
*/ */
public PredicateUtils() { private PredicateUtils() {}
super();
}
// Simple predicates // Simple predicates
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -77,8 +77,7 @@ public class SetUtils {
/** /**
* <code>SetUtils</code> should not normally be instantiated. * <code>SetUtils</code> should not normally be instantiated.
*/ */
public SetUtils() { private SetUtils() {}
}
//----------------------------------------------------------------------- //-----------------------------------------------------------------------

View File

@ -41,8 +41,9 @@ public class SplitMapUtils {
/** /**
* <code>SplitMapUtils</code> should not normally be instantiated. * <code>SplitMapUtils</code> should not normally be instantiated.
*/ */
public SplitMapUtils() { private SplitMapUtils() {}
}
//-----------------------------------------------------------------------
private static class WrappedGet<K, V> implements IterableMap<K, V>, Unmodifiable { private static class WrappedGet<K, V> implements IterableMap<K, V>, Unmodifiable {
private final Get<K, V> get; private final Get<K, V> get;
@ -193,6 +194,8 @@ public class SplitMapUtils {
} }
} }
//-----------------------------------------------------------------------
/** /**
* Get the specified {@link Get} as an instance of {@link IterableMap}. * Get the specified {@link Get} as an instance of {@link IterableMap}.
* If <code>get</code> implements {@link IterableMap} directly, no conversion will take place. * If <code>get</code> implements {@link IterableMap} directly, no conversion will take place.

View File

@ -64,9 +64,7 @@ public class TransformerUtils {
/** /**
* This class is not normally instantiated. * This class is not normally instantiated.
*/ */
public TransformerUtils() { private TransformerUtils() {}
super();
}
/** /**
* Gets a transformer that always throws an exception. * Gets a transformer that always throws an exception.

View File

@ -1523,15 +1523,6 @@ public class CollectionUtilsTest extends MockTestCase {
(Object)map, 0)); (Object)map, 0));
} }
/**
* TODO: Should {@link CollectionUtils} be able to be extended? If it is extended, subclasses must 'override' the static methods with
* call-throughs anyhow, otherwise java compiler warnings will result
*/
@Test
public void ensureCollectionUtilsCanBeExtended() {
new CollectionUtils() {};
}
@Test @Test
public void reverse() { public void reverse() {
CollectionUtils.reverseArray(new Object[] {}); CollectionUtils.reverseArray(new Object[] {});