Package org.exolab.castor.mapping.loader
Class CollectionHandlers
java.lang.Object
org.exolab.castor.mapping.loader.CollectionHandlers
Utility class for obtaining collection handlers. Based on the
configuration and supported classes it will return collections
suitable for Java 1.1 and Java 1.2 run times.
- Version:
- $Revision: 8034 $ $Date: 2005-05-02 14:58:59 -0600 (Mon, 02 May 2005) $
- Author:
- Assaf Arkin
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class
Enumerator for a null collection.(package private) static class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
getCollectionName
(Class javaClass) Returns the associated string name for a given collection.static Class
getCollectionType
(String name) Returns the collection's Java class from the collection name.static CollectionHandler
getHandler
(Class javaClass) Returns the collection's handler based on the Java class.static boolean
hasHandler
(Class javaClass) Returns true if the given class has an associated CollectionHandler.static boolean
isGetSetCollection
(Class javaClass) Returns true if the collection requires get/set methods.
-
Constructor Details
-
CollectionHandlers
public CollectionHandlers()
-
-
Method Details
-
getCollectionType
Returns the collection's Java class from the collection name. The collection name may be a short name (e.g. vector) or the collection Java class name (e.g. java.util.Vector). If the collection is not supported, an exception is thrown.- Parameters:
name
- The collection name- Returns:
- The collection Java class
- Throws:
MappingException
- The named collection is not supported
-
hasHandler
Returns true if the given class has an associated CollectionHandler.- Parameters:
javaClass
- the class to search collection handlers for- Returns:
- true if the given class has an associated CollectionHandler, otherwise false.
-
getCollectionName
Returns the associated string name for a given collection.- Parameters:
javaClass
- the class to search collection handlers for- Returns:
- the string name for the given collection type or null if no association has been defined.
-
getHandler
Returns the collection's handler based on the Java class.- Parameters:
javaClass
- The collection's Java class- Returns:
- The collection handler
- Throws:
MappingException
- The collection class is not supported
-
isGetSetCollection
Returns true if the collection requires get/set methods. java.util collections only require a get method, but an array collection required both get and set methods.- Parameters:
javaClass
- The collection's java class- Returns:
- True if collection requires get/set methods, false if collection requires only get method
- Throws:
MappingException
- The collection class is not supported
-