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

The following examples show how to use org.eclipse.uml2.uml.Element#getValue() . 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 6 votes vote down vote up
/**
 * Returns the value cast as an List.
 * 
 * @param clazz
 * @param stereotypeName
 * @param propertyName
 * @return
 */
public static List<?> getStereotypeListValue(Element clazz, String stereotypeName, String propertyName) {
	Stereotype stereotype = getStereotype(clazz, stereotypeName);
	if (stereotype != null) {
		try {
			Object value = clazz.getValue(stereotype, propertyName);
			if (value instanceof List) {
				List<?> new_name = (List<?>) value;
				return new_name;
			}
		} catch (IllegalArgumentException e) {
		}

	}
	return new ArrayList<Object>();
}
 
Example 2
Source File: Uml2Service.java    From uml2solidity with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Return the value of the the stereotype property.
 * 
 * @param clazz
 * @param stereotypeName
 * @param propertyName
 * @return
 */
public static Object getStereotypeValue(Element clazz, String stereotypeName, String propertyName) {
	Stereotype stereotype = getStereotype(clazz, stereotypeName);
	if (stereotype != null) {
		Object value = clazz.getValue(stereotype, propertyName);
		return value;
	}
	return null;
}
 
Example 3
Source File: MDDExtensionUtils.java    From textuml with Eclipse Public License 1.0 4 votes vote down vote up
public static Integer getLineNumber(Element element) {
	if (!hasDebugInfo(element))
		return null;
	Stereotype debuggableStereotype = element.getAppliedStereotype(DEBUGGABLE_STEREOTYPE);
	return (Integer) element.getValue(debuggableStereotype, "lineNumber");
}
 
Example 4
Source File: MDDExtensionUtils.java    From textuml with Eclipse Public License 1.0 4 votes vote down vote up
public static String getSource(Element element) {
	if (!hasDebugInfo(element))
		return null;
	Stereotype debuggableStereotype = element.getAppliedStereotype(DEBUGGABLE_STEREOTYPE);
	return (String) element.getValue(debuggableStereotype, "source");
}
 
Example 5
Source File: StereotypeUtils.java    From textuml with Eclipse Public License 1.0 4 votes vote down vote up
public static Object getValue(Element element, String stereotypeQName, String property) {
    Stereotype stereotype = getStereotype(element, stereotypeQName);
    if (stereotype == null)
        return null;
    return element.getValue(stereotype, property);
}