|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.core.runtime.Status org.eclipse.emf.validation.model.ConstraintStatus
public class ConstraintStatus
Indicates the result of evaluating a constraint on a model object. Any
constraint which is met by the object results in an IStatus.OK
status. Failure of a constraint results in a status severity matching the
severity
defined for the constraint.
As a special case of constraint failure, if the validation framework
receives an uncaught exception from the constraint, then the constraint is
disabled and the resulting ConstraintStatus
is an
IStatus.INFO
indicating this fact and containing the exception that
caused the failure. Once disabled, the constraint will not be evaluated
again.
This class should not be extended outside of the validation framework.
It may be instantiated by clients, especially using the createStatus()
factory methods.
IModelConstraint.validate(org.eclipse.emf.validation.IValidationContext)
,
createStatus(IValidationContext, Collection, String, Object[])
,
createMultiStatus(IValidationContext, Collection)
Field Summary |
---|
Fields inherited from class org.eclipse.core.runtime.Status |
---|
CANCEL_STATUS, OK_STATUS |
Fields inherited from interface org.eclipse.core.runtime.IStatus |
---|
CANCEL, ERROR, INFO, OK, WARNING |
Constructor Summary | |
---|---|
ConstraintStatus(IModelConstraint constraint,
EObject target)
Initializes me as a successful execution of the specified constraint . |
|
ConstraintStatus(IModelConstraint constraint,
EObject target,
int severity,
int code,
String message,
Set<? extends EObject> resultLocus)
Constructor that explicitly initializes all of my parts. |
|
ConstraintStatus(IModelConstraint constraint,
EObject target,
String message,
Set<? extends EObject> resultLocus)
Initializes me as a failure of the specified constraint
with a message to be displayed somehow to the user. |
Method Summary | |
---|---|
static IStatus |
createMultiStatus(IValidationContext ctx,
Collection<? extends IStatus> statuses)
Creates a multi-status from the specified problem statuses. |
static IStatus |
createMultiStatus(IValidationContext ctx,
String messagePattern,
Object[] messageArguments,
Collection<? extends IStatus> statuses)
Creates a multi-status from the specified problem statuses. |
static ConstraintStatus |
createStatus(IValidationContext ctx,
Collection<? extends EObject> resultLocus,
int severity,
int errorCode,
String messagePattern,
Object... messageArguments)
Creates a status object indicating unsuccessful evaluation of the current constraint on the current target element, as indicated by the supplied validation context. |
static ConstraintStatus |
createStatus(IValidationContext ctx,
Collection<? extends EObject> resultLocus,
String messagePattern,
Object... messageArguments)
Creates a status object indicating unsuccessful evaluation of the current constraint on the current target element, as indicated by the supplied validation context. |
static ConstraintStatus |
createStatus(IValidationContext ctx,
EObject target,
Collection<? extends EObject> resultLocus,
int severity,
int errorCode,
String messagePattern,
Object... messageArguments)
Creates a status object indicating unsuccessful evaluation of the current constraint on the provided target element. |
static ConstraintStatus |
createStatus(IValidationContext ctx,
EObject target,
Collection<? extends EObject> resultLocus,
String messagePattern,
Object... messageArguments)
Creates a status object indicating unsuccessful evaluation of the current constraint on the provided target element. |
static IStatus |
createSuccessStatus(IValidationContext ctx,
EObject target,
Collection<? extends EObject> resultLocus)
Creates a status object indicating successful evaluation of the current constraint on the provided target element. |
IModelConstraint |
getConstraint()
Obtains the constraint which either succeeded or failed, according to what I have to say. |
Set<EObject> |
getResultLocus()
Obtains the objects which are involved in the failure of the constraint. |
EObject |
getTarget()
Obtains the target object, on which the constraint was evaluated. |
Methods inherited from class org.eclipse.core.runtime.Status |
---|
getChildren, getCode, getException, getMessage, getPlugin, getSeverity, isMultiStatus, isOK, matches, setCode, setException, setMessage, setPlugin, setSeverity, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.eclipse.core.runtime.IStatus |
---|
getChildren, getCode, getException, getMessage, getPlugin, getSeverity, isMultiStatus, isOK, matches |
Constructor Detail |
---|
public ConstraintStatus(IModelConstraint constraint, EObject target, String message, Set<? extends EObject> resultLocus)
constraint
with a message
to be displayed somehow to the user.
constraint
- the constraint that failedtarget
- the target of the failed validationmessage
- the message describing the failureresultLocus
- the objects which caused the constraint to fail (at
least the original target should be among these). May be
null
if there really is no result locuspublic ConstraintStatus(IModelConstraint constraint, EObject target)
constraint
.
constraint
- the constraint that succeededtarget
- the target of the successful validationpublic ConstraintStatus(IModelConstraint constraint, EObject target, int severity, int code, String message, Set<? extends EObject> resultLocus)
Constructor that explicitly initializes all of my parts.
This constructor should not be used outside of the validation framework.
constraint
- the constraint that was evaluatedtarget
- the object on which validation was performedseverity
- the severity of the constraint evaluation resultcode
- the error code (if the constraint failed)message
- the error message (if the constraint failed)resultLocus
- the result locus (if the constraint failed)Method Detail |
---|
public static ConstraintStatus createStatus(IValidationContext ctx, EObject target, Collection<? extends EObject> resultLocus, String messagePattern, Object... messageArguments)
This is useful in the case that a single constraint object reports multiple distinct problems, with different messages, at the same severity.
ctx
- the calling constraint's validation context. Must not be
null
target
- the target for the status. If the target is
null
, the target from the validation context is usedresultLocus
- the objects involved in the problem that this status
is to report. If this collection does not contain the target object
of the validation, then it is considered to contain it implicitly.
Thus, this parameter may be null
if only the target
object is in the result locusmessagePattern
- the message pattern (with optional {0} etc.
parameters)messageArguments
- the positional {0}, {1}, etc. arguments to
replace in the message pattern (may by null
if none
are needed)
createStatus(IValidationContext, Collection, int, int, String, Object[])
public static ConstraintStatus createStatus(IValidationContext ctx, EObject target, Collection<? extends EObject> resultLocus, int severity, int errorCode, String messagePattern, Object... messageArguments)
This is useful in the case that a single constraint object reports multiple distinct problems, with different messages and severities.
ctx
- the calling constraint's validation context. Must not be
null
target
- the target for the status. If the target is
null
, the target from the validation context is usedresultLocus
- the objects involved in the problem that this status
is to report. If this collection does not contain the target object
of the validation, then it is considered to contain it implicitly.
Thus, this parameter may be null
if only the target
object is in the result locusseverity
- the severity of the problem (one of the constants defined
in the IStatus
interface; should not be OK
)errorCode
- the error code. A constraint may wish to use different
error codes for different conditions, or just supply the
status code
provided
by its is constraint descriptormessagePattern
- the message pattern (with optional {0} etc.
parameters)messageArguments
- the positional {0}, {1}, etc. arguments to
replace in the message pattern (may by null
if none
are needed)
createStatus(IValidationContext, Collection, String, Object[])
public static ConstraintStatus createStatus(IValidationContext ctx, Collection<? extends EObject> resultLocus, String messagePattern, Object... messageArguments)
This is useful in the case that a single constraint object reports multiple distinct problems, with different messages, at the same severity.
ctx
- the calling constraint's validation context. Must not be
null
resultLocus
- the objects involved in the problem that this status
is to report. If this collection does not contain the target object
of the validation, then it is considered to contain it implicitly.
Thus, this parameter may be null
if only the target
object is in the result locusmessagePattern
- the message pattern (with optional {0} etc.
parameters)messageArguments
- the positional {0}, {1}, etc. arguments to
replace in the message pattern (may by null
if none
are needed)
createStatus(IValidationContext, Collection, int, int, String, Object[])
public static ConstraintStatus createStatus(IValidationContext ctx, Collection<? extends EObject> resultLocus, int severity, int errorCode, String messagePattern, Object... messageArguments)
This is useful in the case that a single constraint object reports multiple distinct problems, with different messages and severities.
ctx
- the calling constraint's validation context. Must not be
null
resultLocus
- the objects involved in the problem that this status
is to report. If this collection does not contain the target object
of the validation, then it is considered to contain it implicitly.
Thus, this parameter may be null
if only the target
object is in the result locusseverity
- the severity of the problem (one of the constants defined
in the IStatus
interface; should not be OK
)errorCode
- the error code. A constraint may wish to use different
error codes for different conditions, or just supply the
status code
provided
by its is constraint descriptormessagePattern
- the message pattern (with optional {0} etc.
parameters)messageArguments
- the positional {0}, {1}, etc. arguments to
replace in the message pattern (may by null
if none
are needed)
createStatus(IValidationContext, Collection, String, Object[])
public static IStatus createSuccessStatus(IValidationContext ctx, EObject target, Collection<? extends EObject> resultLocus)
ConstraintStatus(IModelConstraint, EObject)
This method will only return a ConstraintStatus
when the
validation context's IValidationContext.createSuccessStatus()
method returns an IConstraintStatus
, otherwise it simply
returns the success created by the validation context
ctx
- the calling constraint's validation context. Must not be
null
target
- the target for the status. Must not be null
resultLocus
- the objects involved in the success that this status
is to report. If this collection does not contain the target object
of the validation, then it is considered to contain it implicitly.
Thus, this parameter may be null
if only the target
object is in the result locus
createStatus(IValidationContext, Collection, int, int, String, Object[])
public static IStatus createMultiStatus(IValidationContext ctx, Collection<? extends IStatus> statuses)
This is useful in the case that a single constraint object reports
multiple distinct problems. A constraint may choose to compose and
return a MultiStatus
if it wants different values for some of the
status properties.
ctx
- the calling constraint's current validation contextstatuses
- the statuses to combine into a multi-status. Must not
be null
or empty
IllegalArgumentException
- if the statuses is null
or emptycreateMultiStatus(IValidationContext, String, Object[], Collection)
public static IStatus createMultiStatus(IValidationContext ctx, String messagePattern, Object[] messageArguments, Collection<? extends IStatus> statuses)
This is useful in the case that a single constraint object reports
multiple distinct problems. A constraint may choose to compose and
return a MultiStatus
if it wants different values for some of the
status properties.
ctx
- the calling constraint's current validation contextmessagePattern
- the message pattern (with optional {0} etc.
parameters)messageArguments
- the positional {0}, {1}, etc. arguments to
replace in the message pattern (may by null
if none
are needed)statuses
- the statuses to combine into a multi-status. Must not
be null
or empty
IllegalArgumentException
- if the statuses is null
or emptycreateMultiStatus(IValidationContext, Collection)
public final IModelConstraint getConstraint()
getConstraint
in interface IConstraintStatus
public final EObject getTarget()
getTarget
in interface IConstraintStatus
public final Set<EObject> getResultLocus()
getResultLocus
in interface IConstraintStatus
null
|
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 |