|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IConstraintDescriptor
A constraint descriptor provides information about a constraint's role and status in the system. This includes such information as what categories the constraint is a member of and whether it is enabled, disabled, or even broken because of a run-time fault, in addition to a variety of meta-data declared about severity, evaluation mode, and triggers.
This interface is intended to be implemented by clients that have constraintProviders
that are contributing IModelConstraint
that are not described in standard XML. Note that the specialization
IParameterizedConstraintDescriptor
may be of particular value in
describing constraints that are configurable and indicate their language.
Method Summary | |
---|---|
void |
addCategory(Category category)
Adds a category to me. |
String |
getBody()
If I represent an in-line constraint (whose algorithm is implemented in an XML file, script, or some other source than Java), then this method obtains its body. |
Set<Category> |
getCategories()
Queries the categories that I am a member of. |
String |
getDescription()
Obtains a description of my purpose, if any. |
EvaluationMode<?> |
getEvaluationMode()
Queries the mode (or modes) in which I can be evaluated. |
Throwable |
getException()
If I am an error constraint, obtains the exception
that caused me not to be initialized. |
String |
getId()
Gets my ID. |
String |
getMessagePattern()
Obtains the localized message pattern configured in the XML for my constraint. |
String |
getName()
Gets my name. |
String |
getPluginId()
Queries the ID of the plugin which defines me. |
ConstraintSeverity |
getSeverity()
Queries the severity, as enumerated by the ConstraintSeverity
class, of the problem indicated by a violation of my constraint. |
int |
getStatusCode()
Obtains a status code (unique integer within the scope of the plugin which defines me, useful for logging. |
boolean |
isBatch()
Queries whether I may be applied in "batch" mode, i.e., outside of any particular editing action context. |
boolean |
isEnabled()
Queries whether the constraint is enabled. |
boolean |
isError()
Queries whether the constraint is errored, i.e., not executable because of some error in initializing it. |
boolean |
isLive()
Queries whether I may be applied in "live" mode, i.e., within some particular editing action context. |
void |
removeCategory(Category category)
Removes a category from me. |
void |
setEnabled(boolean enabled)
Sets whether the constraint is enabled. |
void |
setError(Throwable exception)
Sets my error status. |
boolean |
targetsEvent(Notification notification)
Queries whether I apply to the specified EMF notification . |
boolean |
targetsTypeOf(EObject eObject)
Queries whether I target the type (or any supertype) of the specified eObject . |
Method Detail |
---|
String getName()
String getId()
String getPluginId()
String getDescription()
null
if I have noneConstraintSeverity getSeverity()
ConstraintSeverity
class, of the problem indicated by a violation of my constraint.
int getStatusCode()
plugin
which defines me, useful for logging.
getPluginId()
EvaluationMode<?> getEvaluationMode()
EvaluationMode.NULL
mode, then I am never evaluated at all.
boolean targetsTypeOf(EObject eObject)
eObject
.
eObject
- an EMF object which is to be validated
true
if I can be applied to the specified
eObject
;false
, otherwiseboolean targetsEvent(Notification notification)
notification
.
Note that it is OK if I indiscriminately return
true
; this method merely enables an optimization that skips
constraints that are known not to apply to the notification in
question.
This method is only invoked on live
constraints, because
batch
constraints are not invoked in a live context.
notification
- a notification of some change in an EMF model object
false
if I need not be executed on this
notification
; true
, otherwiseboolean isBatch()
true
if I support "batch" (contextless)
invocation; false
, otherwisegetEvaluationMode()
boolean isLive()
true
if I support "live" (contextful) invocation;
false
, otherwisegetEvaluationMode()
boolean isError()
Throwable getException()
error
constraint, obtains the exception
that caused me not to be initialized.
boolean isEnabled()
Errored
constraints are never enabled; other constraints may be disabled
by the user.
void setEnabled(boolean enabled)
errored
and are
not in a mandatory
category.
enabled
- whether the constraint that I represent is enabledisEnabled()
void setError(Throwable exception)
Sets my error status.
This method should not be called outside of the validation framework.
exception
- the exception that causes me to be an error constraintSet<Category> getCategories()
Category
svoid addCategory(Category category)
category
- my category
IllegalArgumentException
- if category
is the default
category, as this is not allowed to be set explicitlyvoid removeCategory(Category category)
category
- a categoryString getMessagePattern()
NLS
class.
NLS
String getBody()
|
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 |