de.smartics.properties.resource.domain
Class ClassPathEnvironment

Package class diagram package ClassPathEnvironment
java.lang.Object
  extended by de.smartics.properties.resource.domain.ClassPathEnvironment
All Implemented Interfaces:
Serializable

@NotThreadSafe
public final class ClassPathEnvironment
     
     
extends Object
implements Serializable

Defines the environment of class path resources to access.

See Also:
Serialized Form

Constructor Summary
ClassPathEnvironment()
          Default constructor.
ClassPathEnvironment(ArtifactRef... artifactRefs)
          Convenience constructor that allows to add artifact references to create an initial list.
ClassPathEnvironment(List<ArtifactRef> artifactRefs)
          Convenience constructor that allows to add artifact references to create an initial list.
 
Method Summary
 void addAnyArtifactRef(ArtifactRef artifactRef)
          Adds the given artifact reference to the list of artifact references.
 void addArchiveArtifactRef(ArtifactRef archiveArtifactRef)
          Adds the given artifact reference to the list of artifact references.
 ArtifactRef getArtifactRef(String artifactId)
          Returns the artifact reference by its short ID.
 List<ArtifactRef> getArtifactRefs()
          Returns a list of artifact references.
 List<URL> getUrls()
          Returns a list of URLs that point to the physical locations of the artifacts.
 String toString()
          Returns the string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClassPathEnvironment

public ClassPathEnvironment()
Default constructor.


ClassPathEnvironment

public ClassPathEnvironment(ArtifactRef... artifactRefs)
Convenience constructor that allows to add artifact references to create an initial list.

Parameters:
artifactRefs - the initial collection of artifact references to add as roots.

ClassPathEnvironment

public ClassPathEnvironment(List<ArtifactRef> artifactRefs)
Convenience constructor that allows to add artifact references to create an initial list.

Parameters:
artifactRefs - the initial collection of artifact references to add as roots.
Method Detail

getArtifactRefs

public List<ArtifactRef> getArtifactRefs()
Returns a list of artifact references.

Returns:
an unmodifiable list of artifact references registered in this environment.

getUrls

public List<URL> getUrls()
Returns a list of URLs that point to the physical locations of the artifacts.

Returns:
a list of URLs that point to the physical locations of the artifacts.

getArtifactRef

@CheckForNull
public ArtifactRef getArtifactRef(String artifactId)
                           throws NullPointerException
Returns the artifact reference by its short ID.

Parameters:
artifactId - the GAV concatenated and separated by colons.
Returns:
the associated artifact reference or null if there is no artifact reference with the given artifactId registered.
Throws:
NullPointerException - if artifactId is null.

addArchiveArtifactRef

public void addArchiveArtifactRef(ArtifactRef archiveArtifactRef)
                           throws NullPointerException
Adds the given artifact reference to the list of artifact references. All references are considered to be roots to search for class path resources.

If archiveArtifactRef is not an archive, it will not be added.

Parameters:
archiveArtifactRef - the artifact reference to add.
Throws:
NullPointerException - if archiveArtifactRef is null.

addAnyArtifactRef

public void addAnyArtifactRef(ArtifactRef artifactRef)
                       throws NullPointerException
Adds the given artifact reference to the list of artifact references. All references are considered to be roots to search for class path resources.

Parameters:
artifactRef - the artifact reference to add.
Throws:
NullPointerException - if artifactRef is null.

toString

public String toString()
Returns the string representation of the object.

Overrides:
toString in class Object
Returns:
the string representation of the object.


Copyright © 2012-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.