Knopflerfish OSGi 2.4.0

org.ungoverned.osgi.service.bundlerepository
Class PackageDeclaration

java.lang.Object
  extended byorg.ungoverned.osgi.service.bundlerepository.PackageDeclaration

public class PackageDeclaration
extends java.lang.Object

This is a simple class to encapsulate a package declaration for bundle imports and exports for the bundle repository.


Field Summary
static java.lang.String PACKAGE_ATTR
           
static java.lang.String VERSION_ATTR
           
 
Constructor Summary
PackageDeclaration(PackageDeclaration pkg)
          Construct a copy of a package declaration.
PackageDeclaration(java.lang.String name, int[] version)
          Construct a package declaration.
PackageDeclaration(java.lang.String name, java.lang.String versionString)
          Construct a package declaration.
 
Method Summary
 int compareVersion(PackageDeclaration pkg)
          Compares two package declarations.
 boolean doesSatisfy(PackageDeclaration pkg)
          Determines if the current package declaration satisfies the supplied package declaration.
 java.lang.String getName()
          Gets the name of the package.
 java.lang.String getVersion()
          Gets the version of the package represented as a string.
 java.lang.String toString()
          Gets the string representation of the package declaration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PACKAGE_ATTR

public static final java.lang.String PACKAGE_ATTR
See Also:
Constant Field Values

VERSION_ATTR

public static final java.lang.String VERSION_ATTR
See Also:
Constant Field Values
Constructor Detail

PackageDeclaration

public PackageDeclaration(java.lang.String name,
                          java.lang.String versionString)
Construct a package declaration.

Parameters:
name - the name of the package.
versionString - the package version as a string.

PackageDeclaration

public PackageDeclaration(java.lang.String name,
                          int[] version)
Construct a package declaration.

Parameters:
name - the name of the package.
version - the package version as an integer triplet.

PackageDeclaration

public PackageDeclaration(PackageDeclaration pkg)
Construct a copy of a package declaration.

Parameters:
pkg - the package declaration to copy.
Method Detail

getName

public java.lang.String getName()
Gets the name of the package.

Returns:
the package name.

getVersion

public java.lang.String getVersion()
Gets the version of the package represented as a string.

Returns:
the string representation of the package version.

compareVersion

public int compareVersion(PackageDeclaration pkg)
Compares two package declarations.

Parameters:
pkg - the package declaration used for comparison.
Returns:
greater than 0 if the supplied package version is less, less than 0 if the supplied package is is greater, and 0 if the two versions are equal.
Throws:
java.lang.IllegalArgumentException - if the package declarations are not for the same package.

doesSatisfy

public boolean doesSatisfy(PackageDeclaration pkg)
Determines if the current package declaration satisfies the supplied package declaration.

Parameters:
pkg - the package to be checked.
Returns:
true if the current package satisfies the supplied package, false otherwise.

toString

public java.lang.String toString()
Gets the string representation of the package declaration.

Returns:
the string representation of the package declaration.

Knopflerfish OSGi 2.4.0