net.sourceforge.argval.packageinfo.impl
Class PackageInfoManagerImpl

java.lang.Object
  extended by net.sourceforge.argval.packageinfo.impl.PackageInfoManagerImpl
All Implemented Interfaces:
PackageInfoManager, PackageInfoVisitorAcceptor

public final class PackageInfoManagerImpl
extends Object
implements PackageInfoVisitorAcceptor, PackageInfoManager

Utility for visiting the added Package instances. First add the Package instances. Then use a PackageVisitor instance to visit all the PackageInfo instances.

Usage:

 PackageVisitor visitor = new SimplePackageVisitor();
 PackageInfoManager manager = new PackageInfoManager();
 manager.addPackage(Package.getPackages());
 manager.accept(visitor);
 System.out.println(visitor);

Author:
T. Verhagen

Field Summary
protected static org.slf4j.Logger logger
          The logging instance.
 
Constructor Summary
PackageInfoManagerImpl()
          Default constructor.
 
Method Summary
 void accept(PackageInfoVisitor visitor)
          Called through the client, which send the visitor along.
 void acceptRuntime(PackageInfoVisitor visitor)
          Entry point for the visitor of this class.
 void addPackage(JarFile jarFile)
           
 void addPackage(Package pckg)
          Add a Package instance.
 void addPackage(Package[] packageArray)
          Adds all the Package instances.
 void addPackageInfo(PackageInfo packageInfo)
           
 void addPackageInfo(PackageInfo packageInfo, String packageName)
           
 PackageInfo getPackage(String title)
          Returns a PackageInfo, or null when nothing is found.
 Set<String> getTitleSet()
          Returns a Set instance containing all the titles of the added Package instances.
 String toString()
          Returns a plain text showing all the added Package instances.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected static org.slf4j.Logger logger
The logging instance.

Constructor Detail

PackageInfoManagerImpl

public PackageInfoManagerImpl()
Default constructor.

Method Detail

addPackage

public void addPackage(Package[] packageArray)
Description copied from interface: PackageInfoManager
Adds all the Package instances.

Specified by:
addPackage in interface PackageInfoManager
Parameters:
packageArray - Array containing Package instances.

addPackage

public void addPackage(Package pckg)
Description copied from interface: PackageInfoManager
Add a Package instance.

Specified by:
addPackage in interface PackageInfoManager
Parameters:
pckg - The Package instance.

addPackage

public void addPackage(JarFile jarFile)
Specified by:
addPackage in interface PackageInfoManager

addPackageInfo

public void addPackageInfo(PackageInfo packageInfo)
Specified by:
addPackageInfo in interface PackageInfoManager

addPackageInfo

public void addPackageInfo(PackageInfo packageInfo,
                           String packageName)
Specified by:
addPackageInfo in interface PackageInfoManager

getTitleSet

public Set<String> getTitleSet()
Description copied from interface: PackageInfoManager
Returns a Set instance containing all the titles of the added Package instances.

Specified by:
getTitleSet in interface PackageInfoManager
Returns:
A Set containing the titles of the Package instances.

getPackage

public PackageInfo getPackage(String title)
Description copied from interface: PackageInfoManager
Returns a PackageInfo, or null when nothing is found.

Specified by:
getPackage in interface PackageInfoManager
Parameters:
title - The title of the Package which should be returned.
Returns:
A PackageInfo instance, or null if nothing is found.

acceptRuntime

public void acceptRuntime(PackageInfoVisitor visitor)
Entry point for the visitor of this class. All added PackageInfo instance are visited through their PackageInfo.accept(PackageInfoVisitor) method.

Parameters:
visitor - The visitor.

accept

public void accept(PackageInfoVisitor visitor)
Description copied from interface: PackageInfoVisitorAcceptor
Called through the client, which send the visitor along.

Specified by:
accept in interface PackageInfoVisitorAcceptor
Parameters:
visitor - The visitor.
See Also:
acceptRuntime(PackageInfoVisitor)

toString

public String toString()
Returns a plain text showing all the added Package instances.

Overrides:
toString in class Object
Returns:
A plain text showing all Package instances added to this PackageInfoManager.


Copyright © 2013 Verhagen Software. All Rights Reserved.