Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.core.commands
Class ParameterType


java.lang.Object
  extended by 

org.eclipse.core.commands.common.EventManager
      extended by 

org.eclipse.core.commands.common.HandleObject
          extended by 
org.eclipse.core.commands.ParameterType
All Implemented Interfaces:
Comparable, IIdentifiable

public final class ParameterType
extends HandleObject
implements Comparable

Provides information about the type of a command parameter. Clients can use a parameter type to check if an object matches the type of the parameter with isCompatible(Object) and can get an AbstractParameterValueConverter to convert between objects matching the parameter type and strings that encode the object's identity.

A command parameter is not required to declare a type. To determine if a given parameter has a type, check if an IParameter implements ITypedParameter and if so, use ITypedParameter.getParameterType() like this:

                   IParameter parameter = // ... get IParameter from Command
                   if (parameter instanceof ITypedParameter) {
                     ParameterType type = ((ITypedParameter)parameter).getParameterType();
                     if (type != null) {
                       // this parameter has a ParameterType
                     }
                   }
 

Since:
3.2
See Also:
IParameter, ITypedParameter.getParameterType()

Field Summary
 
Fields inherited from class org.eclipse.core.commands.common. HandleObject
defined, id, string
 
Method Summary
 void addListener ( IParameterTypeListener listener)
          Adds a listener to this parameter type that will be notified when its state changes.
 int compareTo ( Object object)
          Compares this parameter type with another object by comparing each of the non-transient attributes.
 void define ( String type, AbstractParameterValueConverter parameterTypeConverter)
           Defines this parameter type, setting the defined property to true.
  AbstractParameterValueConverter getValueConverter ()
          Returns the value converter associated with this parameter, if any.
 boolean isCompatible ( Object value)
          Returns whether the provided value is compatible with this parameter type.
 void removeListener ( IParameterTypeListener listener)
          Unregisters listener for changes to properties of this parameter type.
  String toString ()
          The string representation of this parameter type.
 void undefine ()
          Makes this parameter type become undefined.
 
Methods inherited from class org.eclipse.core.commands.common. HandleObject
equals, getId, hashCode, isDefined
 
Methods inherited from class org.eclipse.core.commands.common. EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
Methods inherited from class java.lang. Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

addListener

public final void addListener(
IParameterTypeListener listener)
Adds a listener to this parameter type that will be notified when its state changes.

Parameters:
listener - The listener to be added; must not be null.

compareTo

public final int compareTo(
Object object)
Compares this parameter type with another object by comparing each of the non-transient attributes.

Specified by:
compareTo in interface Comparable
Parameters:
object - The object with which to compare; must be an instance of ParameterType.
Returns:
A negative integer, zero or a positive integer, if the object is greater than, equal to or less than this parameter type.

define

public final void define(
String type,
                         
AbstractParameterValueConverter parameterTypeConverter)

Defines this parameter type, setting the defined property to true.

Notification is sent to all listeners that something has changed.

Parameters:
type - a string identifying the Java object type for this parameter type; null is interpreted as "java.lang.Object"
parameterTypeConverter - an AbstractParameterValueConverter to perform string/object conversions for parameter values; may be null

getValueConverter

public final 
AbstractParameterValueConverter getValueConverter()
                                                        throws 
NotDefinedException
Returns the value converter associated with this parameter, if any.

Returns:
The parameter value converter, or null if there is no value converter for this parameter.
Throws:
NotDefinedException - if the parameter type is not currently defined

isCompatible

public boolean isCompatible(
Object value)
                     throws 
NotDefinedException
Returns whether the provided value is compatible with this parameter type. An object is compatible with a parameter type if the object is an instance of the class defined as the parameter's type class.

Parameters:
value - an object to check for compatibility with this parameter type; may be null.
Returns:
true if the value is compatible with this type, false otherwise
Throws:
NotDefinedException - if the parameter type is not currently defined

removeListener

public final void removeListener(
IParameterTypeListener listener)
Unregisters listener for changes to properties of this parameter type.

Parameters:
listener - the instance to unregister. Must not be null. If an attempt is made to unregister an instance which is not already registered with this instance, no operation is performed.

toString

public final 
String toString()
The string representation of this parameter type. For debugging purposes only. This string should not be shown to an end user.

Specified by:
toString in class HandleObject
Returns:
The string representation; never null.

undefine

public final void undefine()
Makes this parameter type become undefined. Notification is sent to all listeners.

Specified by:
undefine in class HandleObject

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire