com.springsource.bundlor.internal.transformer
Class PackageDeclarationMap

java.lang.Object
  extended by com.springsource.bundlor.internal.transformer.PackageDeclarationMap

final class PackageDeclarationMap
extends java.lang.Object

Intermediate data structure that holds a loosely structured mapping of (PackageName +> Attributes x Directives).

Concurrent Semantics
Not threadsafe.

Author:
Rob Harrop

Nested Class Summary
private static class PackageDeclarationMap.ImmutablePackageDeclaration
          Immutable implementation of PackageDeclarationMap.PackageDeclaration.
static interface PackageDeclarationMap.PackageDeclaration
          Defines (PackageName x Directives x Attributes).
 
Field Summary
private  java.util.Set<PackageDeclarationMap.PackageDeclaration> declarations
           
 
Constructor Summary
PackageDeclarationMap()
           
 
Method Summary
 void declare(java.lang.String packageName, java.util.Map<java.lang.String,java.lang.String> attributes, java.util.Map<java.lang.String,java.lang.String> directives)
          Declares a package with the supplied name, attributes and directives.
 PackageDeclarationMap.PackageDeclaration getDeclaration(java.lang.String packageName)
          Gets the {@link PackageDeclaration) for the supplied package name.
 java.util.Set<PackageDeclarationMap.PackageDeclaration> getDeclarations()
          Gets all the package declarations.
 void override(PackageDeclarationMap with)
          Override the declarations in this mapping with those of the supplied mapping.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

declarations

private final java.util.Set<PackageDeclarationMap.PackageDeclaration> declarations
Constructor Detail

PackageDeclarationMap

PackageDeclarationMap()
Method Detail

declare

public void declare(java.lang.String packageName,
                    java.util.Map<java.lang.String,java.lang.String> attributes,
                    java.util.Map<java.lang.String,java.lang.String> directives)
Declares a package with the supplied name, attributes and directives.

Parameters:
packageName - the name of the package.
attributes - the attributes.
directives - the directives.

getDeclaration

public PackageDeclarationMap.PackageDeclaration getDeclaration(java.lang.String packageName)
Gets the {@link PackageDeclaration) for the supplied package name.

Parameters:
packageName - the name of the package.
Returns:
the matching PackageDeclaration or null if no match is found.

getDeclarations

public java.util.Set<PackageDeclarationMap.PackageDeclaration> getDeclarations()
Gets all the package declarations.

Returns:
the package declarations.

override

public void override(PackageDeclarationMap with)
Override the declarations in this mapping with those of the supplied mapping.

Parameters:
with - the declarations to override with.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object