org.java.plugin.registry
Interface Extension

All Superinterfaces:
Documentable<Extension>, Identity, PluginElement<Extension>, UniqueIdentity
All Known Implementing Classes:
AnnotatedExtension

public interface Extension
extends UniqueIdentity, PluginElement<Extension>

This interface abstracts an extension - particular functionality, the plug-in contribute to the system.

Extension UID is a combination of declaring plug-in ID and extension ID that is unique within whole set of registered plug-ins.

Version:
$Id$

Nested Class Summary
static interface Extension.Parameter
          This interface abstracts extension parameter according to extension declaration in manifest.
 
Method Summary
 java.lang.Object createInstance()
          If this extension provides a parameter "class", this will create a new instance of that class.
 java.lang.String get(java.lang.String name)
          Returns the raw value of a given parameter if set.
<T> T
get(java.lang.String name, java.lang.Class<? extends T> type)
          Gets the raw value for the given parameter using get(String) and converts it into the given type.
 java.lang.String getExtendedPluginId()
           
 java.lang.String getExtendedPointId()
           
 Extension.Parameter getParameter(java.lang.String id)
          Returns top level parameter with given ID or null if no top level parameters exist.
 java.util.Collection<Extension.Parameter> getParameters()
          Returns collection of all top level parameters defined in this extension.
 java.util.Collection<Extension.Parameter> getParameters(java.lang.String id)
           
 boolean isValid()
           
 
Methods inherited from interface org.java.plugin.registry.UniqueIdentity
getUniqueId
 
Methods inherited from interface org.java.plugin.registry.Identity
getId
 
Methods inherited from interface org.java.plugin.registry.PluginElement
getDeclaringPluginDescriptor, getDeclaringPluginFragment
 
Methods inherited from interface org.java.plugin.registry.Identity
getId
 
Methods inherited from interface org.java.plugin.registry.Documentable
getDocsPath, getDocumentation
 

Method Detail

getParameters

java.util.Collection<Extension.Parameter> getParameters()
Returns collection of all top level parameters defined in this extension.

Returns:
collection of Extension.Parameter objects

getParameter

Extension.Parameter getParameter(java.lang.String id)
Returns top level parameter with given ID or null if no top level parameters exist. If more than one top level parameters with given ID found, the method should throw an IllegalArgumentException.

Parameters:
id - ID of parameter to look for
Returns:
top level parameter with given ID

getParameters

java.util.Collection<Extension.Parameter> getParameters(java.lang.String id)
Parameters:
id - ID of parameter to look for
Returns:
collection of all top level parameters with given ID

getExtendedPluginId

java.lang.String getExtendedPluginId()
Returns:
ID of plug-in, extended point belongs to

getExtendedPointId

java.lang.String getExtendedPointId()
Returns:
ID of extended point

isValid

boolean isValid()
Returns:
true if extension is considered to be valid

get

java.lang.String get(java.lang.String name)
Returns the raw value of a given parameter if set. If the ExtensionPoint provides a default value, that value is returned. If the parameter does not exists, this returns null.

Parameters:
name - of the parameter
Returns:
rawValue of the parameter or null

get

<T> T get(java.lang.String name,
          java.lang.Class<? extends T> type)
Gets the raw value for the given parameter using get(String) and converts it into the given type. This returns null if the parameter is null and throws a RuntimException if the conversion fails.

Parameters:
name - the name of the parameter
type - the target type
Returns:
converted resutl or null
Throws:
java.lang.RuntimeException - if the conversion fails

createInstance

java.lang.Object createInstance()
                                throws JpfException
If this extension provides a parameter "class", this will create a new instance of that class.

Returns:
the new instance of that class
Throws:
JpfException - if the class was not found, could not be isntanciated or the extension does not provide a class parameter


Copyright © 2010. All Rights Reserved.