org.fuin.units4j.dependency
Class Utils

java.lang.Object
  extended by org.fuin.units4j.dependency.Utils

public final class Utils
extends Object

Utilities for the package.


Method Summary
static com.thoughtworks.xstream.XStream createXStream()
          Creates a ready configured XStream instance.
static DependsOn findAllowedByName(List<DependsOn> allowed, String pkgName)
          Find a dependency in a list by a package name.
static NotDependsOn findForbiddenByName(List<NotDependsOn> forbidden, String pkgName)
          Find a dependency in a list by a package name.
static Dependencies load(Class<?> clasz, String resourcePathAndName)
          Load dependencies from a resource.
static Dependencies load(File file)
          Load dependencies from a file.
static Dependencies load(InputStream inputStream)
          Load dependencies from an input stream.
static void save(File file, Dependencies dependencies)
          Write the dependencies to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createXStream

public static com.thoughtworks.xstream.XStream createXStream()
Creates a ready configured XStream instance.

Returns:
New XStream instance.

load

public static Dependencies load(File file)
Load dependencies from a file.

Parameters:
file - XML File to load - Cannot be null and must be a valid file.
Returns:
New dependencies instance.

load

public static Dependencies load(InputStream inputStream)
Load dependencies from an input stream.

Parameters:
inputStream - XML input stream to read - Cannot be null.
Returns:
New dependencies instance.

load

public static Dependencies load(Class<?> clasz,
                                String resourcePathAndName)
Load dependencies from a resource.

Parameters:
clasz - Class to use for loading the resource - Cannot be null.
resourcePathAndName - Name and path of the XML file (in the class path) - Cannot be null.
Returns:
New dependencies instance.

save

public static void save(File file,
                        Dependencies dependencies)
Write the dependencies to a file.

Parameters:
file - XML File - Cannot be null and must be a valid file.
dependencies - Dependencies to save.

findAllowedByName

public static DependsOn findAllowedByName(List<DependsOn> allowed,
                                          String pkgName)
Find a dependency in a list by a package name.

Parameters:
allowed - List to search.
pkgName - Name of the package to find - Cannot be null.
Returns:
Entry or null if nothing was found.

findForbiddenByName

public static NotDependsOn findForbiddenByName(List<NotDependsOn> forbidden,
                                               String pkgName)
Find a dependency in a list by a package name.

Parameters:
forbidden - List to search.
pkgName - Name of the package to find - Cannot be null.
Returns:
Entry or null if nothing was found.


Copyright © 2011 Future Invent Informationsmanagement GmbH. All Rights Reserved.