Java Code Examples for org.eclipse.uml2.uml.Element#getAppliedStereotypes()

The following examples show how to use org.eclipse.uml2.uml.Element#getAppliedStereotypes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Uml2Service.java    From uml2solidity with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Returns true when the stereotype is applied to the {@link Element}.
 * 
 * @param clazz
 * @param stereotypeName
 * @return
 */
public static boolean hasStereotype(Element clazz, String stereotypeName) {
	if(clazz==null) return false;
	List<Stereotype> stereotypes = clazz.getAppliedStereotypes();
	for (Stereotype stereotype : stereotypes) {
		if (stereotype.getName().equals(stereotypeName)) {
			return true;
		}
	}
	return false;
}
 
Example 2
Source File: Uml2Service.java    From uml2solidity with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Returns the stereotype.
 * 
 * @param clazz
 * @param stereotypeName
 * @return
 */
public static Stereotype getStereotype(Element clazz, String stereotypeName) {
	if(clazz==null) return null;
	List<Stereotype> stereotypes = clazz.getAppliedStereotypes();
	for (Stereotype stereotype : stereotypes) {
		if (stereotype.getName().equals(stereotypeName)) {
			return stereotype;
		}
	}
	return null;
}
 
Example 3
Source File: StereotypeUtils.java    From textuml with Eclipse Public License 1.0 5 votes vote down vote up
public static boolean hasStereotype(Element element, String stereotypeQName) {
    for (Stereotype s : element.getAppliedStereotypes())
        if (stereotypeQName.equals(s.getName()) || stereotypeQName.equals(s.getQualifiedName()))
            return true;
    if (element instanceof Classifier)
        for (Classifier general : ((Classifier) element).getGenerals())
            if (hasStereotype(general, stereotypeQName))
                return true;
    return false;
}
 
Example 4
Source File: StereotypeUtils.java    From textuml with Eclipse Public License 1.0 5 votes vote down vote up
public static Stereotype getStereotype(Element element, String stereotypeQName) {
    for (Stereotype s : element.getAppliedStereotypes())
        if (stereotypeQName.equals(s.getName()) || stereotypeQName.equals(s.getQualifiedName()))
            return s;
    if (element instanceof Classifier)
        for (Classifier general : ((Classifier) element).getGenerals()) {
            Stereotype found = getStereotype(general, stereotypeQName);
            if (found != null)
                return found;
        }
    return null;
}