Skip to content
Snippets Groups Projects
Commit e59e9535 authored by Vincent Aravantinos's avatar Vincent Aravantinos
Browse files

utility functions for standard status text and colours

refs 2553
parent 81d17839
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,7 @@ import org.fortiss.tooling.kernel.model.constraints.SuccessVerificationStatus;
* @author aravantinos
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 1EE7F9BAEAF62D5E8C843797A8177D77
* @ConQAT.Rating YELLOW Hash: 1325BAE0A0C28B3F093D89D912BE1AFF
*/
public class ConstraintsUtils {
/**
......@@ -39,8 +39,18 @@ public class ConstraintsUtils {
* @param clazz
* @return <code>true</code> if <code>c</code> contains a constraint of type <code>clazz</code>.
*/
public static boolean containsConstraintOfType(IConstrained c, Class<?> clazz) {
return !EcoreUtils.pickInstanceOf(clazz, c.getConstraints()).isEmpty();
public static boolean containsConstraintOfType(IConstrained c,
Class<? extends IConstraint> clazz) {
return getConstraintOfType(c, clazz) != null;
}
/**
* @param c
* @param clazz
* @return the first constraint of <code>c</code> of type <code>clazz</code>.
*/
public static <T extends IConstraint> T getConstraintOfType(IConstrained c, Class<T> clazz) {
return EcoreUtils.pickFirstInstanceOf(clazz, c.getConstraints());
}
/** Exception which embeds an error. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment