|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.emf.validation.service.ModelValidationService
public class ModelValidationService
The Model Validation Service makes constraints and validators available to
the client application. An application obtains validators from the service
and requests validation whenever it is appropriate, according to the
application's mapping of the EvaluationMode
triggers.
The ModelValidationService
delegates the retrieval of
constraints to any number of IModelConstraintProvider
implementations registered by other plug-ins via the
org.eclipse.emf.validation.constraintProvider extension point.
The validation service uses the meta-data associated with registered providers to determine which ones can provide constraints for a specific EMF object according to the meta-model URI namespace and the evaluation context. This allows the service to delay instantiating providers (and, hence, loading plug-ins) until it is absolutely necessary to do so.
newValidator(EvaluationMode)
,
IValidator
,
IModelConstraint
Method Summary | ||
---|---|---|
void |
addValidationListener(IValidationListener listener)
Adds a new listener to receive validation events. |
|
void |
broadcastValidationEvent(ValidationEvent event)
Broadcasts the specified event to all listeners. |
|
void |
configureListeners(IConfigurationElement[] elements)
Deprecated. 1.2 This method is no longer implemented. |
|
void |
configureProviders(IConfigurationElement[] elements)
Deprecated. 1.2 This method is no longer implemented. |
|
static EClass |
findClass(String namespaceUri,
String className)
Finds the EClass having the specified name within the namespace
indicated by the URI. |
|
static ModelValidationService |
getInstance()
Obtains the instance of this class. |
|
void |
loadXmlConstraintDeclarations()
Loads all available XML-declared constraint descriptors. |
|
|
newValidator(EvaluationMode<T> mode)
Creates a new validator object that the client can use to validate EMF objects, notifications, or features, according to the value of the specified evaluation mode . |
|
void |
removeValidationListener(IValidationListener listener)
Removes a listener from the service. |
|
void |
replaceInCache(IModelConstraint oldConstraint,
IModelConstraint newConstraint)
Replaces a constraint in the cache with an alternative implementation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static ModelValidationService getInstance()
public <T,V extends IValidator<T>> V newValidator(EvaluationMode<T> mode)
Creates a new validator object that the client can use to validate
EMF objects, notifications, or features, according to the value of the
specified evaluation mode
.
The resulting validator may be retained as long as it is needed, and reused any number of times. Each validator has its own separate state.
T
- the kind of validator to returnmode
- the evaluation mode for which to create a new validator.
Must not be null
or EvaluationMode.NULL
IllegalArgumentException
- if the mode
is not a
valid evaluation modepublic void addValidationListener(IValidationListener listener)
listener
to receive validation events. This
method has no effect if the listener
is already registered.
listener
- a new validation listenerpublic void removeValidationListener(IValidationListener listener)
listener
from the service. This method
has no effect if the listener
is not currently registered.
listener
- a validation listenerpublic void broadcastValidationEvent(ValidationEvent event)
event
to all listeners. This
method is used internally by validators to send notifications when they
perform validation, but may also be used by clients to simulate
validation occurrences.
event
- a validation event to broadcast@Deprecated public void configureListeners(IConfigurationElement[] elements)
Configures my listeners from the Eclipse configuration
elements
representing implementations of my extension point.
NOTE that this method should only be called by the EMF Model Validation Plug-in, not by any client code!
elements
- @Deprecated public void configureProviders(IConfigurationElement[] elements)
Configures my providers from the Eclipse configuration
elements
representing implementations of my extension point.
NOTE that this method should only be called by the EMF Model Validation Plug-in, not by any client code!
elements
- public void replaceInCache(IModelConstraint oldConstraint, IModelConstraint newConstraint)
oldConstraint
- the constraint to be replaced in the cachenewConstraint
- the new constraint to replace itpublic void loadXmlConstraintDeclarations()
Loads all available XML-declared constraint descriptors. This is not a very heavy-weight operation, as it does not require the loading of any plug-ins or even the instantantiation of any constraints. It only loads the constraint descriptors that are statically declared in XML.
Subsequent invocations of this method have no effect.
NOTE that this method should only be called by the EMF Model Validation Plug-in, not by any client code!
public static EClass findClass(String namespaceUri, String className)
EClass
having the specified name within the namespace
indicated by the URI. The class name may optionally be fully qualified
(prefixed by its full package name) to support constraint providers that
need to disambiguate like-named classes in different EPackages.
namespaceUri
- the provider-specified namespace URI of the EPackageclassName
- the class name. May be a simple name within the
package namespace indicated by namespaceUri
or a
fully-qualified class name
null
if it
could not be found
|
Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |