Class CollectionFactory
- java.lang.Object
-
- de.uplanet.lucy.server.auxiliaries.collections.CollectionFactory
-
@VelocityCallable("singleton") public final class CollectionFactory extends Object
Used to create collections.
-
-
Constructor Summary
Constructors Constructor Description CollectionFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description List<Object>
createList()
Create aLinkedList
.List<?>
createList(String p_strClassName)
Create aList
of the given type.Map<Object,Object>
createMap()
Create aHashMap
.Map<?,?>
createMap(String p_strClassName)
Create aMap
of the given type.Set<Object>
createSet()
Create aHashSet
.Set<?>
createSet(String p_strClassName)
Create aSet
of the given type.TreeSet<String>
getPrincipalNames(Subject p_subject)
Create a collection of principal names for the given subject.Collection<?>
getProperties(Collection<?> p_collection, String p_strMethodName)
Deprecated.Use the getPropertiesAsXxx methods instead.List<?>
getPropertiesAsList(Collection<?> p_collection, String p_strMethodName)
Create a list of object properties from a collection of objects.Set<?>
getPropertiesAsSet(Collection<?> p_collection, String p_strMethodName)
Create a set of object properties from a collection of objects.SortedSet<?>
getPropertiesAsSortedSet(Collection<?> p_collection, String p_strMethodName)
Create a sorted set of object properties from a collection of objects.Properties
loadProperties(String p_strPath)
Load the given properties file.Properties
loadPropertiesSafely(String p_strPath)
Same asloadProperties(String)
but instead of throwing an exception an empty properties collection is returned if an error occurs.
-
-
-
Method Detail
-
createMap
public Map<?,?> createMap(String p_strClassName)
Create aMap
of the given type.Note that the class must provide a public default constructor.
- Parameters:
p_strClassName
- The name of the map class.- Returns:
- The newly created map, or
null
if the map could not be created. In the latter case see the log file for details.
-
createSet
public Set<?> createSet(String p_strClassName)
Create aSet
of the given type.Note that the class must provide a public default constructor.
- Parameters:
p_strClassName
- The name of the set class.- Returns:
- The newly created set, or
null
if the set could not be created. In the latter case see the log file for details.
-
createList
public List<Object> createList()
Create aLinkedList
.
-
createList
public List<?> createList(String p_strClassName)
Create aList
of the given type.Note that the class must provide a public default constructor.
- Parameters:
p_strClassName
- The name of the list class.- Returns:
- The newly created list, or
null
if the list could not be created. In the latter case see the log file for details.
-
loadProperties
public Properties loadProperties(String p_strPath) throws IOException
Load the given properties file.The file may contain UTF-8 encoded characters.
- Parameters:
p_strPath
- The path of the properties file.- Returns:
- The loaded properties.
- Throws:
IOException
- If an I/O error occurs.
-
loadPropertiesSafely
public Properties loadPropertiesSafely(String p_strPath)
Same asloadProperties(String)
but instead of throwing an exception an empty properties collection is returned if an error occurs.- Parameters:
p_strPath
- The path of the properties file.- Returns:
- The loaded properties.
-
getProperties
@Deprecated public Collection<?> getProperties(Collection<?> p_collection, String p_strMethodName) throws Exception
Deprecated.Use the getPropertiesAsXxx methods instead.Create a collection of object properties from a collection of objects.- Parameters:
p_collection
- The object collection.p_strMethodName
- The method that returns the properties that will be in the resultant collection.- Returns:
- The collection of properties.
- Throws:
Exception
- - If an error occurred.
-
getPropertiesAsList
public List<?> getPropertiesAsList(Collection<?> p_collection, String p_strMethodName) throws Exception
Create a list of object properties from a collection of objects.- Parameters:
p_collection
- The object collection.p_strMethodName
- The method that returns the properties that will be in the resultant collection.- Returns:
- The list of properties.
- Throws:
Exception
- - If an error occurred.- Since:
- Intrexx 7.0.
-
getPropertiesAsSet
public Set<?> getPropertiesAsSet(Collection<?> p_collection, String p_strMethodName) throws Exception
Create a set of object properties from a collection of objects.- Parameters:
p_collection
- The object collection.p_strMethodName
- The method that returns the properties that will be in the resultant collection.- Returns:
- The set of properties.
- Throws:
Exception
- - If an error occurred.- Since:
- Intrexx 7.0.
-
getPropertiesAsSortedSet
public SortedSet<?> getPropertiesAsSortedSet(Collection<?> p_collection, String p_strMethodName) throws Exception
Create a sorted set of object properties from a collection of objects.- Parameters:
p_collection
- The object collection.p_strMethodName
- The method that returns the properties that will be in the resultant collection.- Returns:
- The sorted set of properties.
- Throws:
Exception
- - If an error occurred.- Since:
- Intrexx 7.0.
-
-