org.ops4j.peaberry.util
Class StaticImport<T>

java.lang.Object
  extended by org.ops4j.peaberry.util.StaticImport<T>
All Implemented Interfaces:
Import<T>

public final class StaticImport<T>
extends Object
implements Import<T>

An Import consisting of a fixed instance and optional attribute map.

Author:
mcculls@gmail.com (Stuart McCulloch)

Constructor Summary
StaticImport(T instance)
          Create a static Import for the given instance.
StaticImport(T instance, Map<String,?> attributes)
          Create a static Import for the given instance and attribute map.
 
Method Summary
 Map<String,?> attributes()
          Get the attributes associated with the service.
 boolean available()
          Is the service instance available?
 T get()
          Start using the imported service instance.
 void unget()
          Stop using the imported service instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaticImport

public StaticImport(T instance)
Create a static Import for the given instance.

Parameters:
instance - service instance

StaticImport

public StaticImport(T instance,
                    Map<String,?> attributes)
Create a static Import for the given instance and attribute map.

Parameters:
instance - service instance
attributes - service attributes
Method Detail

get

public T get()
Description copied from interface: Import
Start using the imported service instance.

Specified by:
get in interface Import<T>
Returns:
service instance

attributes

public Map<String,?> attributes()
Description copied from interface: Import
Get the attributes associated with the service.

Specified by:
attributes in interface Import<T>
Returns:
current attribute map

unget

public void unget()
Description copied from interface: Import
Stop using the imported service instance.

Specified by:
unget in interface Import<T>

available

public boolean available()
Description copied from interface: Import
Is the service instance available?

Specified by:
available in interface Import<T>
Returns:
true if the service is available, otherwise false


Copyright © 2006-2012 OPS4J - Open Participation Software for Java. All Rights Reserved.