|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gcube.dir.master.contexts.Registry
public class Registry
Registry of Prototyped
processors for runtime input binding.
Nested Class Summary | |
---|---|
static class |
Registry.ProcessorNotFoundException
|
Constructor Summary | |
---|---|
Registry()
|
Method Summary | ||
---|---|---|
static
|
findProcessor(java.lang.Class<PROCESSOR> processorClass,
java.lang.Object input)
Returns one or more objects of a given type that can process another given object. |
|
static void |
registerProcessor(java.lang.Class<? extends Prototyped<?>> processorClass)
Registers a class as a processor for another class, with the implication that instances of the processor class have one or more methods which take instances of the input class as one of their parameters. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Registry()
Method Detail |
---|
public static void registerProcessor(java.lang.Class<? extends Prototyped<?>> processorClass) throws java.lang.Exception
The existence of such method or the details of its signature rest with the caller and
are neither checked nor of relevance to the registration process.
The only requirements for the processor class are: (i) to be reflectively instantiable, and
(ii) to implement the Prototyped
interface and thus return a prototypical example
of its input.
processorClass
- the class of a processor which implements the Prototyped
interface.
Registry.ProcessorNotFoundException
- if the processor class cannot be reflectively instantiated.
java.lang.Exception
public static <PROCESSOR> java.util.List<PROCESSOR> findProcessor(java.lang.Class<PROCESSOR> processorClass, java.lang.Object input) throws Registry.ProcessorNotFoundException, java.lang.Exception
The implication is that each processor object has one or more methods which can take the input object as one of their parameters. The existence of such methods or the details of their signature rest with the caller and are neither checked nor of relevance to the retrieval process.
The retrieval fails unless: (i) (the class of) each processor has been previously registered with
registerProcessor(Class)
, (ii) the runtime type of its prototypical object is the same type
or a supertype of the runtime type of the input object. All the processors which match these conditions
are returned in type order, from the most to the least specifically typed.
Th If many suitable processors classes have previously registered, one is chosen in order of registration.
PROCESSOR
- the type of required processors.processorClass
- the class of the required processor type.input
- the input object.
Registry.ProcessorNotFoundException
- if no processor could be found for the input.
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |