org.java.plugin.extension
Class AnnotatedExtension

java.lang.Object
  extended by org.java.plugin.extension.AnnotatedExtension
All Implemented Interfaces:
Documentable<Extension>, Extension, Identity, PluginElement<Extension>, UniqueIdentity

public class AnnotatedExtension
extends java.lang.Object
implements Extension


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.java.plugin.registry.Extension
Extension.Parameter
 
Constructor Summary
AnnotatedExtension(PluginDescriptor pluginDescriptor, java.lang.String id, java.lang.String plugin, java.lang.String point, java.util.List<ParameterContainer> parameters)
           
 
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 Extension.get(String) and converts it into the given type.
 PluginDescriptor getDeclaringPluginDescriptor()
          Returns plug-in descriptor, this element belongs to.
 PluginFragment getDeclaringPluginFragment()
          Returns descriptor of plug-in fragment that contributes this element.
 java.lang.String getDocsPath()
           
 Documentation<Extension> getDocumentation()
           
 java.lang.String getExtendedPluginId()
           
 java.lang.String getExtendedPointId()
           
 java.lang.String getId()
           
 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)
           
 java.lang.String getUniqueId()
           
 boolean isValid()
           
 java.lang.String toString()
           
 java.util.Collection<IntegrityCheckReport.ReportItem> validate()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AnnotatedExtension

public AnnotatedExtension(PluginDescriptor pluginDescriptor,
                          java.lang.String id,
                          java.lang.String plugin,
                          java.lang.String point,
                          java.util.List<ParameterContainer> parameters)
Method Detail

getExtendedPluginId

public java.lang.String getExtendedPluginId()
Specified by:
getExtendedPluginId in interface Extension
Returns:
ID of plug-in, extended point belongs to

getExtendedPointId

public java.lang.String getExtendedPointId()
Specified by:
getExtendedPointId in interface Extension
Returns:
ID of extended point

getParameter

public Extension.Parameter getParameter(java.lang.String id)
Description copied from interface: Extension
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.

Specified by:
getParameter in interface Extension
Parameters:
id - ID of parameter to look for
Returns:
top level parameter with given ID

getParameters

public java.util.Collection<Extension.Parameter> getParameters()
Description copied from interface: Extension
Returns collection of all top level parameters defined in this extension.

Specified by:
getParameters in interface Extension
Returns:
collection of Extension.Parameter objects

getParameters

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

getUniqueId

public java.lang.String getUniqueId()
Specified by:
getUniqueId in interface UniqueIdentity
Returns:
unique ID of plug-in element

getId

public java.lang.String getId()
Specified by:
getId in interface Identity
Returns:
ID of plug-in manifest element

getDeclaringPluginDescriptor

public PluginDescriptor getDeclaringPluginDescriptor()
Description copied from interface: PluginElement
Returns plug-in descriptor, this element belongs to. This method should never return null.

Specified by:
getDeclaringPluginDescriptor in interface PluginElement<Extension>
Returns:
plug-in descriptor, this element belongs to

getDeclaringPluginFragment

public PluginFragment getDeclaringPluginFragment()
Description copied from interface: PluginElement
Returns descriptor of plug-in fragment that contributes this element. This method may return null, if element is contributed by plug-in directly.

Specified by:
getDeclaringPluginFragment in interface PluginElement<Extension>
Returns:
descriptor of plug-in fragment that contributes this element

getDocsPath

public java.lang.String getDocsPath()
Specified by:
getDocsPath in interface Documentable<Extension>
Returns:
path to documentation "home", it is used for resolving documentation references

getDocumentation

public Documentation<Extension> getDocumentation()
Specified by:
getDocumentation in interface Documentable<Extension>
Returns:
plug-in element documentation object or null if there is no documentation provided

isValid

public boolean isValid()
Specified by:
isValid in interface Extension
Returns:
true if extension is considered to be valid

get

public java.lang.String get(java.lang.String name)
Description copied from interface: Extension
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.

Specified by:
get in interface Extension
Parameters:
name - of the parameter
Returns:
rawValue of the parameter or null

get

public <T> T get(java.lang.String name,
                 java.lang.Class<? extends T> type)
Description copied from interface: Extension
Gets the raw value for the given parameter using Extension.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.

Specified by:
get in interface Extension
Parameters:
name - the name of the parameter
type - the target type
Returns:
converted resutl or null

validate

public java.util.Collection<IntegrityCheckReport.ReportItem> validate()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

createInstance

public java.lang.Object createInstance()
                                throws JpfException
Description copied from interface: Extension
If this extension provides a parameter "class", this will create a new instance of that class.

Specified by:
createInstance in interface Extension
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.