JPF 1.5.1

org.java.plugin.tools.mocks
Class MockParameter

java.lang.Object
  extended by org.java.plugin.tools.mocks.MockIdentity
      extended by org.java.plugin.tools.mocks.MockPluginElement<Extension.Parameter>
          extended by org.java.plugin.tools.mocks.MockParameter
All Implemented Interfaces:
Documentable<Extension.Parameter>, Extension.Parameter, Identity, PluginElement<Extension.Parameter>

public class MockParameter
extends MockPluginElement<Extension.Parameter>
implements Extension.Parameter

Version:
$Id$

Constructor Summary
MockParameter()
          No-arguments constructor.
MockParameter(java.lang.String id, java.lang.String aRawValue, java.lang.Object aTypedValue)
           
MockParameter(java.lang.String id, java.lang.String aRawValue, java.lang.Object aTypedValue, Extension aDeclaringExtension)
           
 
Method Summary
 MockParameter addParameter(Extension.Parameter parameter)
           
 Extension getDeclaringExtension()
           
 ExtensionPoint.ParameterDefinition getDefinition()
          Returns definition for this extension parameter.
 Extension.Parameter getSubParameter(java.lang.String id)
          Returns sub-parameter with given ID or null if no sub-parameters exist.
 java.util.Collection<Extension.Parameter> getSubParameters()
          Returns collection of all sub-parameters defined in this parameter.
 java.util.Collection<Extension.Parameter> getSubParameters(java.lang.String id)
           
 Extension.Parameter getSuperParameter()
           
 java.lang.String rawValue()
           
 MockParameter setDeclaringExtension(Extension value)
           
 MockParameter setDefinition(ExtensionPoint.ParameterDefinition value)
           
 MockParameter setSuperParameter(Extension.Parameter value)
           
 MockParameter setValue(java.lang.String raw, java.lang.Object typed)
           
 java.lang.Boolean valueAsBoolean()
          Returns "typed" value of parameter.
 java.util.Date valueAsDate()
          Returns "typed" value of parameter.
 Extension valueAsExtension()
          Returns "typed" value of parameter.
 ExtensionPoint valueAsExtensionPoint()
          Returns "typed" value of parameter.
 java.lang.Number valueAsNumber()
          Returns "typed" value of parameter.
 PluginDescriptor valueAsPluginDescriptor()
          Returns "typed" value of parameter.
 java.lang.String valueAsString()
          Returns "typed" value of parameter.
 java.net.URL valueAsUrl()
          Returns "typed" value of parameter.
 java.net.URL valueAsUrl(PathResolver pathResolver)
          Returns "typed" value of parameter.
 
Methods inherited from class org.java.plugin.tools.mocks.MockPluginElement
getDeclaringPluginDescriptor, getDeclaringPluginFragment, getDocsPath, getDocumentation, setDeclaringPluginDescriptor, setDeclaringPluginFragment, setDocsPath, setDocumentation
 
Methods inherited from class org.java.plugin.tools.mocks.MockIdentity
getId, setId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
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
 

Constructor Detail

MockParameter

public MockParameter()
No-arguments constructor.


MockParameter

public MockParameter(java.lang.String id,
                     java.lang.String aRawValue,
                     java.lang.Object aTypedValue)
Parameters:
id - parameter ID
aRawValue - raw parameter value
aTypedValue - typed parameter value

MockParameter

public MockParameter(java.lang.String id,
                     java.lang.String aRawValue,
                     java.lang.Object aTypedValue,
                     Extension aDeclaringExtension)
Parameters:
id - parameter ID
aRawValue - raw parameter value
aTypedValue - typed parameter value
aDeclaringExtension - declaring extension
Method Detail

getDeclaringExtension

public Extension getDeclaringExtension()
Specified by:
getDeclaringExtension in interface Extension.Parameter
Returns:
extension this parameter belongs to
See Also:
Extension.Parameter.getDeclaringExtension()

setDeclaringExtension

public MockParameter setDeclaringExtension(Extension value)
Parameters:
value - the declaring extension to set
Returns:
this instance

getDefinition

public ExtensionPoint.ParameterDefinition getDefinition()
Description copied from interface: Extension.Parameter
Returns definition for this extension parameter. May return null for "invalid" parameters.

Specified by:
getDefinition in interface Extension.Parameter
Returns:
parameter definition or null, if this parameter is "invalid"
See Also:
Extension.Parameter.getDefinition()

setDefinition

public MockParameter setDefinition(ExtensionPoint.ParameterDefinition value)
Parameters:
value - the parameter definition to set
Returns:
this instance

getSubParameter

public Extension.Parameter getSubParameter(java.lang.String id)
Description copied from interface: Extension.Parameter
Returns sub-parameter with given ID or null if no sub-parameters exist. If more than one sub-parameters with given ID found, the method should throw an IllegalArgumentException.

Specified by:
getSubParameter in interface Extension.Parameter
Parameters:
id - ID of sub-parameter to look for
Returns:
sub-parameter with given ID
See Also:
Extension.Parameter.getSubParameter( java.lang.String)

getSubParameters

public java.util.Collection<Extension.Parameter> getSubParameters()
Description copied from interface: Extension.Parameter
Returns collection of all sub-parameters defined in this parameter.

Specified by:
getSubParameters in interface Extension.Parameter
Returns:
collection of Extension.Parameter objects
See Also:
Extension.Parameter.getSubParameters()

getSubParameters

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

addParameter

public MockParameter addParameter(Extension.Parameter parameter)
Parameters:
parameter - sub-parameter to add
Returns:
this instance

getSuperParameter

public Extension.Parameter getSuperParameter()
Specified by:
getSuperParameter in interface Extension.Parameter
Returns:
parameter, of which this one is child or null if this is top level parameter
See Also:
Extension.Parameter.getSuperParameter()

setSuperParameter

public MockParameter setSuperParameter(Extension.Parameter value)
Parameters:
value - the super parameter to set
Returns:
this instance

rawValue

public java.lang.String rawValue()
Specified by:
rawValue in interface Extension.Parameter
Returns:
parameter value as it is specified in manifest, if no value provided there, this method should return empty string
See Also:
Extension.Parameter.rawValue()

setValue

public MockParameter setValue(java.lang.String raw,
                              java.lang.Object typed)
Parameters:
raw - raw parameter value
typed - typed parameter value
Returns:
this instance

valueAsBoolean

public java.lang.Boolean valueAsBoolean()
Description copied from interface: Extension.Parameter
Returns "typed" value of parameter. If this parameter is invalid or is not of type ParameterType.BOOLEAN, this method should throw an UnsupportedOperationException.

Specified by:
valueAsBoolean in interface Extension.Parameter
Returns:
value as Boolean object
See Also:
Extension.Parameter.valueAsBoolean()

valueAsDate

public java.util.Date valueAsDate()
Description copied from interface: Extension.Parameter
Returns "typed" value of parameter. If this parameter is invalid or is not of type ParameterType.DATE, ParameterType.TIME or ParameterType.DATE_TIME, this method should throw an UnsupportedOperationException.

Specified by:
valueAsDate in interface Extension.Parameter
Returns:
value as Date object
See Also:
Extension.Parameter.valueAsDate()

valueAsExtension

public Extension valueAsExtension()
Description copied from interface: Extension.Parameter
Returns "typed" value of parameter. If this parameter is invalid or is not of type ParameterType.EXTENSION_ID, this method should throw an UnsupportedOperationException.

Specified by:
valueAsExtension in interface Extension.Parameter
Returns:
value as Extension object
See Also:
Extension.Parameter.valueAsExtension()

valueAsExtensionPoint

public ExtensionPoint valueAsExtensionPoint()
Description copied from interface: Extension.Parameter
Returns "typed" value of parameter. If this parameter is invalid or is not of type ParameterType.EXTENSION_POINT_ID, this method should throw an UnsupportedOperationException.

Specified by:
valueAsExtensionPoint in interface Extension.Parameter
Returns:
value as ExtensionPoint object
See Also:
Extension.Parameter.valueAsExtensionPoint()

valueAsNumber

public java.lang.Number valueAsNumber()
Description copied from interface: Extension.Parameter
Returns "typed" value of parameter. If this parameter is invalid or is not of type ParameterType.NUMBER, this method should throw an UnsupportedOperationException.

Specified by:
valueAsNumber in interface Extension.Parameter
Returns:
value as Number object
See Also:
Extension.Parameter.valueAsNumber()

valueAsPluginDescriptor

public PluginDescriptor valueAsPluginDescriptor()
Description copied from interface: Extension.Parameter
Returns "typed" value of parameter. If this parameter is invalid or is not of type ParameterType.PLUGIN_ID, this method should throw an UnsupportedOperationException.

Specified by:
valueAsPluginDescriptor in interface Extension.Parameter
Returns:
value as PluginDescriptor object
See Also:
Extension.Parameter.valueAsPluginDescriptor()

valueAsString

public java.lang.String valueAsString()
Description copied from interface: Extension.Parameter
Returns "typed" value of parameter. If this parameter is invalid or is not of type ParameterType.STRING, this method should throw an UnsupportedOperationException.

Specified by:
valueAsString in interface Extension.Parameter
Returns:
value as String object
See Also:
Extension.Parameter.valueAsString()

valueAsUrl

public java.net.URL valueAsUrl()
Description copied from interface: Extension.Parameter
Returns "typed" value of parameter. If this parameter is invalid or is not of type ParameterType.RESOURCE, this method should throw an UnsupportedOperationException.

Specified by:
valueAsUrl in interface Extension.Parameter
Returns:
value as absolute or relative URL as specified in manifest
See Also:
Extension.Parameter.valueAsUrl()

valueAsUrl

public java.net.URL valueAsUrl(PathResolver pathResolver)
Description copied from interface: Extension.Parameter
Returns "typed" value of parameter. If this parameter is invalid or is not of type ParameterType.RESOURCE, this method should throw an UnsupportedOperationException.

Specified by:
valueAsUrl in interface Extension.Parameter
Parameters:
pathResolver - path resolver to make URL absolute
Returns:
value as absolute URL
See Also:
Extension.Parameter.valueAsUrl( org.java.plugin.PathResolver)

JPF 1.5.1

Copyright © 2004-2007 Dmitry Olshansky. All Rights Reserved.