本文整理汇总了Java中org.eclipse.uml2.uml.Element.applyStereotype方法的典型用法代码示例。如果您正苦于以下问题:Java Element.applyStereotype方法的具体用法?Java Element.applyStereotype怎么用?Java Element.applyStereotype使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.uml2.uml.Element
的用法示例。
在下文中一共展示了Element.applyStereotype方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyStereotype
import org.eclipse.uml2.uml.Element; //导入方法依赖的package包/类
/**
* 요소에 스테레오타입 이름에 해당하는 스테레오타입을 찾아 적용하는 메소드
*
* @param source
* @param target
* @param stereotypeName
* @return
*/
private static Stereotype applyStereotype(Element source, Element target, String stereotypeName) {
// null 확인
if (source == null || target == null || stereotypeName == null) {
return null;
}
Stereotype stereotype = target.getAppliedStereotype(stereotypeName);
if (stereotype == null) {
stereotype = getApplicableStereotype(target, stereotypeName);
if (stereotype != null) {
if (!isAppliedStereotype(target, stereotypeName)) {
target.applyStereotype(stereotype);
// 소스와 타겟에 같은 스테레오타입이 적용되어 있을 때는 스테레오타입의 특성값도 함께 적용해준다.
Stereotype sType = source.getAppliedStereotype(stereotype.getQualifiedName());
if( null != sType) {
EList<Property> attributes = sType.getAllAttributes();
for (Property property : attributes) {
String propertyName = property.getName();
Object obj = source.getValue(sType, propertyName);
if( null != obj && !propertyName.startsWith(Extension.METACLASS_ROLE_PREFIX)) {
target.setValue(stereotype, propertyName, obj);
}
}
}
}
}
}
return stereotype;
}
示例2: convertKeywordToStereotype
import org.eclipse.uml2.uml.Element; //导入方法依赖的package包/类
/**
* @see nexcore.tool.mdd.core.extension.ISemanticModelHandler#convertKeywordToStereotype()
*/
public void convertKeywordToStereotype() {
List<Element> enumeratedElementList = generateEnumeratedElementList();
Stereotype stereotype;
if (enumeratedElementList != null && !enumeratedElementList.isEmpty()) {
for (Element element : enumeratedElementList) {
stereotype = findStereotype(element);
if (stereotype != null) {
monitor.subTask(UMLMessage.getMessage(UMLMessage.LABEL_ING, UMLMessage.LABEL_APPLY_STEREOTYPE)
+ ((NamedElement) element).getName());
if (!element.getAppliedStereotypes().contains(stereotype)) {
element.applyStereotype(stereotype);
removeStereotype(element);
if (element instanceof NamedElement) {
String name = ((NamedElement) element).getName();
((NamedElement) element).setName(name);
}
}
monitor.worked(1);
}
}
}
}
示例3: applyStereotype
import org.eclipse.uml2.uml.Element; //导入方法依赖的package包/类
private void applyStereotype(Element object, Stereotype s) {
if (!object.isStereotypeApplied(s)) {
object.applyStereotype(s);
}
}