Qwylt

java.lang.module.spi.query
Class Indexable<T extends ModuleQuery>

java.lang.Object
  extended by java.lang.module.spi.query.Indexable<T>
All Implemented Interfaces:
Matcher<ModuleQuery>

public class Indexable<T extends ModuleQuery>
extends java.lang.Object
implements Matcher<ModuleQuery>

A ModuleQuery Matcher that remembers the first matching instance and supports invalidation.

Since:
Dec 18, 2008
Author:
Bryan Atsatt

Constructor Summary
Indexable(java.lang.Class<T> targetType)
          Constructs an instance that will match only the specified target type.
 
Method Summary
 T getMatch()
          Return the matched instance if it has been set and not invalidated.
 java.lang.Class<T> getTargetType()
          Returns the target type.
 boolean hasMatch()
          Test if this instance has successfully matched a target and has not been invalidated.
 void invalidate(boolean reversible)
          Invalidate any current match.
 boolean matches(ModuleQuery target)
          Tests if the specified target matches this instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Indexable

public Indexable(java.lang.Class<T> targetType)
Constructs an instance that will match only the specified target type.

Parameters:
targetType - The target type to match.
Method Detail

matches

public boolean matches(ModuleQuery target)
Tests if the specified target matches this instance.

Specified by:
matches in interface Matcher<ModuleQuery>
Parameters:
target - The target instance.
Returns:
true if the specified target matches this instance; false otherwise.

hasMatch

public boolean hasMatch()
Test if this instance has successfully matched a target and has not been invalidated.

Returns:
true if this instance has successfully matched a target and has not been invalidated; otherwise, returns false.

invalidate

public void invalidate(boolean reversible)
Invalidate any current match.

Parameters:
reversible - true if any match should remain but be invalidated, false otherwise.

getMatch

public T getMatch()
Return the matched instance if it has been set and not invalidated.

Returns:
The matched instance or null if none or it was invalidated.

getTargetType

public java.lang.Class<T> getTargetType()
Returns the target type.

Returns:
The target type.

Qwylt

Send comments or questions to Bryan Atsatt