GroovyRunner interface.
This registry makes use of the ServiceLoader facility. The
preferred method for registering new GroovyRunner providers
is to place them in a provider-configuration file in the resource
directory META-INF/services. The preferred method for accessing
the registered runners is by making use of the Iterable
interface using an enhanced for-loop.
For compatibility with previous versions, this registry implements the
Map interface. All null keys and values will be ignored
and no exception thrown, except where noted.
By default the registry contains runners that are capable of running
JUnit 3 and JUnit 4 test classes if those libraries
are available to the class loader.
| Modifier and Type | Field and Description |
|---|---|
| private volatile List | |
| private static final GroovyRunnerRegistry | |
| private static final Logger | |
| private final Lock | |
| private volatile Map | |
| private final ReadWriteLock | |
| private final Lock |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | clear()
Implements java. |
| public boolean | Returns: true if a runner was registered with given keyfor the registered runner key)Implements java. true if a runner was registered with the
specified key.
|
| public boolean | Returns: true if the given runner is registeredinstance of a GroovyRunner runner)Implements java. true if registry contains the given
runner instance.
|
| public Set | Returns: an unmodifiable set of registered runner entriesImplements java. |
| public GroovyRunner | Returns: the runner registered with the given keyused to lookup the runner key)Implements java. |
| public static GroovyRunnerRegistry | |
| private Map | |
| public boolean | Returns: true if no runners are registeredImplements java. true if the registry contains no runners, else
false.
|
| public Iterator | Returns: iterator for all registered runnersImplements java. |
| public Set | Returns: an unmodifiable set of keys for registered runnersImplements java. |
| public void | load(ClassLoader
used to locate provider-configuration files and classes classLoader)Loads |
| private void | |
| private void | |
| public GroovyRunner | Returns: the previously registered runner for the given key, if no runner was previously registered for the key thennullto associate with the runner key, GroovyRunner the runner to register runner)Implements java. |
| public void | putAll(Map<? extends String, ? extends GroovyRunner>
entries to add to the registry m)Implements java. |
| private void | register(GroovyRunner
the instance to add to the registry runner)Registers the given instance with the registry. |
| public GroovyRunner | Returns: the runner instance that was removed, if no runner instance was removed thennullof the runner to remove key)Implements java. |
| public int | Returns: number of registered runnersImplements java. |
| public String | |
| public Collection | Returns: an unmodifiable collection of registered runner instancesImplements java. |
| cachedValues | back to summary |
|---|---|
| private volatile List<GroovyRunner> cachedValues | |
| INSTANCE | back to summary |
|---|---|
| private static final GroovyRunnerRegistry INSTANCE | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| readLock | back to summary |
|---|---|
| private final Lock readLock | |
| runnerMap | back to summary |
|---|---|
| private volatile Map<String, GroovyRunner> runnerMap | |
| rwLock | back to summary |
|---|---|
| private final ReadWriteLock rwLock | |
| writeLock | back to summary |
|---|---|
| private final Lock writeLock | |
| GroovyRunnerRegistry | back to summary |
|---|---|
| pack-priv GroovyRunnerRegistry(Map<? extends String, ? extends GroovyRunner> runners) | |
| GroovyRunnerRegistry | back to summary |
|---|---|
| private GroovyRunnerRegistry() | |
| clear | back to summary |
|---|---|
| public void clear() Implements java. Clears all registered runners from the registry and resets the registry so that it contains only the default set of runners.
| |
| containsKey | back to summary |
|---|---|
| public boolean containsKey(Object key) Implements java. Returns | |
| containsValue | back to summary |
|---|---|
| public boolean containsValue(Object runner) Implements java. Returns | |
| entrySet | back to summary |
|---|---|
| public Set Implements java. Returns a set of entries for registered runners. This is a snapshot of the registry and any subsequent registry changes will not be reflected in the set. | |
| get | back to summary |
|---|---|
| public GroovyRunner get(Object key) Implements java. Returns the registered runner for the specified key.
| |
| getInstance | back to summary |
|---|---|
| public static GroovyRunnerRegistry getInstance() Returns a reference to the one and only registry instance.
| |
| getMap | back to summary |
|---|---|
| private Map Lazily initialize and load the backing Map. A Do not call while holding a read lock.
| |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Implements java. Returns
| |
| iterator | back to summary |
|---|---|
| public Iterator Implements java. Returns an iterator for all runners that are registered. The returned iterator is a snapshot of the registry at the time the iterator is created. This iterator does not support removal.
| |
| keySet | back to summary |
|---|---|
| public Set Implements java. Set of all keys associated with registered runners. This is a snapshot of the registry and any subsequent registry changes will not be reflected in the set. | |
| load | back to summary |
|---|---|
| public void load(ClassLoader classLoader) Loads
| |
| loadDefaultRunners | back to summary |
|---|---|
| private void loadDefaultRunners() | |
| loadWithLock | back to summary |
|---|---|
| private void loadWithLock(ClassLoader classLoader) | |
| put | back to summary |
|---|---|
| public GroovyRunner put(String key, GroovyRunner runner) Implements java. Registers a runner with the specified key.
| |
| putAll | back to summary |
|---|---|
| public void putAll(Map<? extends String, ? extends GroovyRunner> m) Implements java. Adds all entries from the given Map to the registry.
Any entries in the provided Map that contain a
| |
| register | back to summary |
|---|---|
| private void register(GroovyRunner runner) Registers the given instance with the registry. This is
equivalent to
| |
| remove | back to summary |
|---|---|
| public GroovyRunner remove(Object key) Implements java. Removes a registered runner from the registry.
| |
| size | back to summary |
|---|---|
| public int size() Implements java. Returns the number of registered runners.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| values | back to summary |
|---|---|
| public Collection Implements java. Returns a collection of all registered runners. This is a snapshot of the registry and any subsequent registry changes will not be reflected in the collection.
| |