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 Details

    • CollectionFactory

      public CollectionFactory()
  • Method Details

    • createMap

      public Map<Object,Object> createMap()
      Create a HashMap.
    • createMap

      public Map<?,?> createMap(String p_strClassName)
      Create a Map 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<Object> createSet()
      Create a HashSet.
    • createSet

      public Set<?> createSet(String p_strClassName)
      Create a Set 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 a LinkedList.
    • createList

      public List<?> createList(String p_strClassName)
      Create a List 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 as loadProperties(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.
    • getPrincipalNames

      public TreeSet<String> getPrincipalNames(Subject p_subject)
      Create a collection of principal names for the given subject.
      Parameters:
      p_subject - The subject.
      Returns:
      The principal names.
      Since:
      Intrexx 7.0.