Extension SDK 10.1.2

oracle.ide.model
Interface Recognizer

All Known Subinterfaces:
ElementRecognizer
All Known Implementing Classes:
AbstractElementRecognizer, DefaultRecognizer, LegacyLibraryRecognizer

public interface Recognizer

The Recognizer interface provides the API for recognizing data types from specific urls.

Data model frameworks can register their own recognizer with the NodeFactory.

See Also:
NodeFactory

Method Summary
 boolean canConvert(java.net.URL oldURL, java.net.URL newURL)
          Check if the old URL can be converted to the new URL.
 Node create(java.net.URL url, java.lang.Class type)
          Creates an instance of the design-time node associated with the specified URL.
 java.lang.Class recognize(java.net.URL url)
          Gets the Class of the data item associated with the specified URL.
 java.net.URL validate(java.net.URL newURL, java.net.URL oldURL)
          Validate the specified new name.
 

Method Detail

recognize

public java.lang.Class recognize(java.net.URL url)
Gets the Class of the data item associated with the specified URL. Implementations must return null if the URL is not recognized. The Class returned must be the data model class. This value is passed to the create(URL, Class) method which will create the design-time node.

Parameters:
url - unique URL identifying the document.
Returns:
the data Class.

create

public Node create(java.net.URL url,
                   java.lang.Class type)
            throws java.lang.IllegalAccessException,
                   java.lang.InstantiationException
Creates an instance of the design-time node associated with the specified URL. This method is called by the NodeFactory. This method must return a Node instance. The type parameter specifies the Class of the data object.

Parameters:
url - unique URL identifying the document.
type - the data Class.
Returns:
Design-time node.
Throws:
java.lang.IllegalAccessException
java.lang.InstantiationException

validate

public java.net.URL validate(java.net.URL newURL,
                             java.net.URL oldURL)
                      throws RecognizerException
Validate the specified new name. Returns null if the name does not validate. This method may modify the URL to make it valid, such as adding a file extension. The old URL is used as the validation base. For example, if the new URL does not have the correct file extension, the old URL extension may be added to the new URL during the validation process.

Parameters:
newURL - the new URL to validate.
oldURL - the old URL used as the validation base.
Returns:
the validated URL or null if the name does not validate.
Throws:
RecognizerException - if validation fails. The reason why validation failed is in the exception's message. The message should be suitably formatted so that it can be displayed to the user.

canConvert

public boolean canConvert(java.net.URL oldURL,
                          java.net.URL newURL)
Check if the old URL can be converted to the new URL. This method is called on the new URL's Recognizer. It is called when a Node is being renamed and the new name causes a Node type conversion. If the call to canConvert(URL, URL) returns true, the Node conversion will go through, otherwise, it will not.

Parameters:
oldURL - the url of the node being renamed.
newURL - the new url for the node.
Returns:
true if conversion is possible.

Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.