当前位置: 首页>>代码示例>>Java>>正文


Java Stereotype类代码示例

本文整理汇总了Java中org.eclipse.uml2.uml.Stereotype的典型用法代码示例。如果您正苦于以下问题:Java Stereotype类的具体用法?Java Stereotype怎么用?Java Stereotype使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Stereotype类属于org.eclipse.uml2.uml包,在下文中一共展示了Stereotype类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getStereotypeListValue

import org.eclipse.uml2.uml.Stereotype; //导入依赖的package包/类
/**
 * 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>();
}
 
开发者ID:UrsZeidler,项目名称:uml2solidity,代码行数:24,代码来源:Uml2Service.java

示例2: createContainmentFeatureMapEntry

import org.eclipse.uml2.uml.Stereotype; //导入依赖的package包/类
public static FeatureMap.Entry createContainmentFeatureMapEntry(String nsPrefix, String nsURI, String name, Element base, Stereotype refinement) {
	AnyType anyType = XMLTypeFactory.eINSTANCE.createAnyType();
	
	// create for each property of the refinement an EReference and the SimpleFeatureMapEntry
	for(Property property : refinement.getAllAttributes()) {
		if(!property.getName().startsWith("base_")) {
			AnyType anyTypeForProperty = XMLTypeFactory.eINSTANCE.createAnyType();
			SimpleFeatureMapEntry simpleFeatureMapEntry = new SimpleFeatureMapEntry((EStructuralFeature.Internal) Text_Attribute, getStringRepresentation(base.getValue(refinement, property.getName())));
			anyTypeForProperty.getMixed().add(simpleFeatureMapEntry);
			
			EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry containmentFeatureMapEntry = 
					new EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry((EStructuralFeature.Internal) createTEReference(nsPrefix, nsURI, property.getName()), (InternalEObject) anyTypeForProperty);
		
			anyType.getMixed().add(containmentFeatureMapEntry);
		}
	}
	
	return new EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry((EStructuralFeature.Internal) createTEReference(nsPrefix, nsURI, name), 
			(InternalEObject) anyType); 		
}
 
开发者ID:alexander-bergmayr,项目名称:caml2tosca,代码行数:21,代码来源:ToscaUtil.java

示例3: getComponentElementList

import org.eclipse.uml2.uml.Stereotype; //导入依赖的package包/类
/**
 * 선택된 요소 전체목록 중에서 component 메타데이터 생성에 쓰이는 스테레오타입이 적용된 요소의 목록을 반환
 * 
 * @param selectedElementList
 * @return List<Element>
 */
public static List<Element> getComponentElementList(List<Element> selectedElementList) {
    List<Element> componentElementList = null;

    for (Element element : selectedElementList) {
        for (Stereotype appliedStereotype : element.getAppliedStereotypes()) {
            if (appliedStereotype.getLabel().equals(
                    MDDCoreConstant.COMPONENT_METADATA_STEREOTYPE_NAME)) {
                if (componentElementList == null) {
                    componentElementList = new ArrayList<Element>();
                }

                componentElementList.add(element);
            }
        }
    }

    return componentElementList;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:25,代码来源:NexcoreMDACUtil.java

示例4: getStereotypeListByTypeName

import org.eclipse.uml2.uml.Stereotype; //导入依赖的package包/类
/**
 * 스테레오타입과 특정타입명을 입력받아 타입에 해당하는 스테레오타입 목록을 반환한다. 타입명 : base_Class,
 * base_Operation, base_Property
 * 
 * @param stereotypeList
 * @param typeName
 * @return EList<Stereotype>
 */
public static List<Stereotype> getStereotypeListByTypeName(List<Stereotype> stereotypeList, String typeName) {
    List<Stereotype> stereotypes = new ArrayList<Stereotype>();

    if (typeName == null || MDDCoreConstant.EMPTY_STRING.equals(typeName)) {
        return new ArrayList<Stereotype>(0);
    }

    for (Stereotype stereotype : stereotypeList) {
        // 받아온 타입명과 base_Class 타입명이 같으면 add한다.
        for (Property property : stereotype.getAttributes()) {
            // property name 중 타입명과 일치하는 property가 있으면 add.
            if (typeName.equals(property.getName())) {
                stereotypes.add(stereotype);
                break;
            }
        }
    }

    return stereotypes;

}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:30,代码来源:MDADesignerTransformationUtil.java

示例5: getApplicableElementName

import org.eclipse.uml2.uml.Stereotype; //导入依赖的package包/类
/**
 * 스테레오타입이 적용될 수 있는 엘리먼트들의 이름을 나열해 반환한다. Class, Operation, Property 만 적용될 수
 * 있다고 간주한다. 각각 base_Class, base_Operation, base_Property 임. 이 로직은 프로퍼티 파일
 * 구조를 분석해 나온 로직으로서 정확한지 확인필요(알맞은 메소드가 존재하는지 여부) 명쾌한 해답이 없어요..
 * 
 * @param stereotype
 * @return String
 */
public static String getApplicableElementName(Stereotype stereotype) {
    if( null == stereotype) {
        return MDDCoreConstant.EMPTY_STRING;
    }
    StringBuffer name = new StringBuffer();

    for (Property property : stereotype.getOwnedAttributes()) {
        for (String typeName : MDDCoreConstant.APPLICABLE_TYPE_NAMES) {
            if (typeName.equals(property.getName())) {
                name.append(MDDCoreConstant.COMMA);
                name.append(property.getName().substring(5)); // "base_" 를.
                // 빼면 엘리먼트 명이
                // 된다.
                break;
            }
        }
    }

    if (name.length() > 0) {
        return name.substring(1); // 맨앞에 "," 제거
    } else {
        return MDDCoreConstant.EMPTY_STRING;
    }

}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:34,代码来源:MDADesignerTransformationUtil.java

示例6: getValidLifelineTypes

import org.eclipse.uml2.uml.Stereotype; //导入依赖的package包/类
/**
     * Class/Component/Interface 등 라이프라인의 타입이 될 수 있는 데이터의 리스트를 반환한다.
     * @param ruleSet
     * @param profile
     * @return
     */
    public static List<SourceStructureTransformationData> getValidLifelineTypes(RuleSet ruleSet, Profile profile) {
        
        List<SourceStructureTransformationData> elementList = new ArrayList<SourceStructureTransformationData>();
        String stereotypeName = null;
        for (SourceStructureTransformationData data : ruleSet.getStructureRules()) {
            stereotypeName = data.getSourceType().getSourceName();
            Stereotype stereotype = (Stereotype) profile.getPackagedElement(stereotypeName);
            String[] baseNames = MDADesignerTransformationUtil.getApplicableElementName(stereotype).split(MDDCoreConstant.COMMA);
//            String[] baseNames = StringUtil.split(MDADesignerTransformationUtil.getApplicableElementName(stereotype), 
//                MDDCoreConstant.COMMA);
            for (String base : baseNames) {
                if( MDDCoreConstant.UML_CLASS_LITERAL.equals(base) || MDDCoreConstant.UML_INTERFACE_LITERAL.equals(base) 
                    || MDDCoreConstant.UML_COMPONENT_LITERAL.equals(base)) {
                    elementList.add(data);
                }
            }
        }
        return elementList;
    }
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:26,代码来源:MDADesignerTransformationUtil.java

示例7: getApplicableStereotype

import org.eclipse.uml2.uml.Stereotype; //导入依赖的package包/类
/**
 * 스테레오타입 이름으로 요소에 적용 가능한 스테레오타입 목록에서 스테레오타입 찾아오는 메소드
 * 
 * @param elememt
 * @param stereotypeName
 * @return
 */
private static Stereotype getApplicableStereotype(Element elememt, String stereotypeName) {
    if (elememt == null || stereotypeName == null) {
        return null;
    }

    EList<Stereotype> applicableStereotypes = elememt.getApplicableStereotypes();
    Stereotype stereotype = null;

    if (applicableStereotypes != null) {
        for (Iterator<Stereotype> stereoTypeIterator = applicableStereotypes.iterator(); stereoTypeIterator.hasNext();) {
            stereotype = stereoTypeIterator.next();

            if (stereotype.getName().equals(stereotypeName)) {
                return stereotype;
            }
        }
    }

    return null;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:28,代码来源:SemanticModelHandlerUtil.java

示例8: getApplicableStereotypes

import org.eclipse.uml2.uml.Stereotype; //导入依赖的package包/类
/**
 * find applicable stereotypes for meta class
 * 
 * @param profile
 * @param metaClassName
 * @return
 */

public static List<Stereotype> getApplicableStereotypes(Profile profile, String metaClassName) {

    if (profile == null || metaClassName == null)
        return null;

    List<Stereotype> applicableStereotypes = new ArrayList<Stereotype>();

    for (Iterator<Stereotype> iter = profile.getOwnedStereotypes().iterator(); iter.hasNext();) {
        Stereotype stereotype = (Stereotype) iter.next();
        EList<Class> extendedMetaClasses = stereotype.getExtendedMetaclasses();
        for (int clazzCount = 0; clazzCount < extendedMetaClasses.size(); clazzCount++) {
            Class clazz = extendedMetaClasses.get(clazzCount);
            if (clazz.getName().equals(metaClassName))
                applicableStereotypes.add(stereotype);
        }

    }

    return applicableStereotypes;

}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:30,代码来源:SemanticModelHandlerUtil.java

示例9: existInTypeSet

import org.eclipse.uml2.uml.Stereotype; //导入依赖的package包/类
/**
 * 라이프라인의 타입이 BehaviorRule에 해당 유무 반환.
 * 
 * @param typeSet
 * @param lifelineType
 * @return boolean
 */
private boolean existInTypeSet(Set<String> typeSet, Type lifelineType) {
    if (null == typeSet || typeSet.size() == 0) {
        return false;
    }
    if (typeSet.contains(ManagerConstant.UML_TYPE_LITERAL)) {
        if (null != lifelineType) {
            return true;
        }
    }
    if (typeSet.contains(ManagerConstant.UML_ACTOR_LITERAL)) {
        if (lifelineType instanceof Actor) {
            return true;
        }
    }

    EList<Stereotype> stereotypes = lifelineType.getAppliedStereotypes();
    for (Stereotype stereotype : stereotypes) {
        if (typeSet.contains(stereotype.getName())) {
            return true;
        }
    }

    return false;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:32,代码来源:SemanticModelHandler.java

示例10: redo

import org.eclipse.uml2.uml.Stereotype; //导入依赖的package包/类
/**
 * @see org.eclipse.gef.commands.Command#redo()
 */
@Override
public void redo() {
    this.parentElement = (org.eclipse.uml2.uml.PackageableElement) this.targetElement.getOwner();
    this.appliedStereotypeList = this.targetElement.getAppliedStereotypes();
    this.compoundCommand = new ArrayList<DeleteUMLStereotypeCommand>();
    this.init();
    for (Iterator<DeleteUMLStereotypeCommand> iter = this.compoundCommand.iterator(); iter.hasNext();) {
        iter.next().redo();
    }
    Stereotype stereotype;
    for (Iterator<Stereotype> iter = appliedStereotypeList.iterator(); iter.hasNext();) {
        stereotype = iter.next();
        this.targetElement.unapplyStereotype(stereotype);
        this.delete(stereotype);
    }
    this.redoOwnElement();
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:21,代码来源:DeleteUMLStereotypeCommand.java

示例11: getAppliedStereotypes

import org.eclipse.uml2.uml.Stereotype; //导入依赖的package包/类
/**
 * Element에 적용된 스테레오타입을 텍스트로 반환한다.
 * 
 * @param element
 * @return String
 */
public static String getAppliedStereotypes(Element element) {
    if (element == null) {
        return null;
    }
    EList<Stereotype> appliedStereotypes = element.getAppliedStereotypes();
    Stereotype stereotype = null;
    if (appliedStereotypes != null) {
        StringBuffer stringBuffer = new StringBuffer();

        int sequence = 0;
        for (Iterator<Stereotype> iter = appliedStereotypes.iterator(); iter.hasNext();) {
            stereotype = iter.next();
            if (sequence > 0) {
                stringBuffer.append(UICoreConstant.PROJECT_CONSTANTS__COMMA);
            }
            stringBuffer.append(stereotype.getName().trim());
            sequence++;

        }
        return stringBuffer.toString();
    }
    return UICoreConstant.PROJECT_CONSTANTS__EMPTY_STRING;

}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:31,代码来源:ProjectUtil.java

示例12: getStringValueOfProperty

import org.eclipse.uml2.uml.Stereotype; //导入依赖的package包/类
/**
 * 해당 프로퍼티의 값을 String 으로 반환하는 메소드 - 넘겨진 boolean 값에 따라 프로퍼티의 값이 없을 경우 default
 * value 가져오도록 구현
 * 
 * @param parentElement
 * @param property
 * @param wantDefaultValue
 * @return String
 */
public static String getStringValueOfProperty(NamedElement parentElement, Object property, boolean wantDefaultValue) {
    String propertyValue = null;

    try {
        propertyValue = parentElement.getValue((Stereotype) ((Property) property).eContainer(),
            ((Property) property).getName()).toString();
    } catch (NullPointerException npe) {
        if (wantDefaultValue) {
            propertyValue = ((Property) property).isSetDefault() ? ((Property) property).getDefault() : ""; //$NON-NLS-1$
        } else {
            propertyValue = ""; //$NON-NLS-1$
        }
    }

    return propertyValue;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:26,代码来源:ProfileUtil.java

示例13: getObjectValueOfProperty

import org.eclipse.uml2.uml.Stereotype; //导入依赖的package包/类
/**
 * 해당 프로퍼티의 값을 Object 로 반환하는 메소드 - 넘겨진 boolean 값에 따라 프로퍼티의 값이 없을 경우 default
 * value 가져오도록 구현
 * 
 * @param parentElement
 * @param property
 * @param wantDefaultValue
 * @return Object
 */
public static Object getObjectValueOfProperty(NamedElement parentElement, Object property, boolean wantDefaultValue) {
    Object propertyValue = null;

    try {
        propertyValue = parentElement.getValue((Stereotype) ((Property) property).eContainer(),
            ((Property) property).getName());
    } catch (NullPointerException npe) {
        if (wantDefaultValue) {
            propertyValue = ((Property) property).isSetDefault() ? ((Property) property).getDefault() : ""; //$NON-NLS-1$
        } else {
            propertyValue = ""; //$NON-NLS-1$
        }
    }

    return propertyValue;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:26,代码来源:ProfileUtil.java

示例14: deactivate

import org.eclipse.uml2.uml.Stereotype; //导入依赖的package包/类
/**
 * activate에서 등록한 어댑터를 삭제한다.
 * 
 * @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractNotationNodeEditPart#deactivate()
 */
@Override
public void deactivate() {
    super.deactivate();
    LabelNode node = (LabelNode) getModel();

    if (node.getParent() != null) {
        node.getParent().eAdapters().remove(this);

        Element umlModel = ((AbstractView) node.getParent()).getUmlModel();
        if (umlModel != null) {
            umlModel.eAdapters().remove(this);

            for (Stereotype stereotype : ((Element) umlModel).getAppliedStereotypes()) {
                stereotype.eAdapters().remove(this);
            }

            for (EAnnotation annotation : ((EModelElement) umlModel).getEAnnotations()) {
                annotation.eAdapters().remove(this);
            }
        }
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:28,代码来源:LabelNodeEditPart.java

示例15: activate

import org.eclipse.uml2.uml.Stereotype; //导入依赖的package包/类
/**
 * @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractNotationNodeEditPart#activate()
 */
@Override
public void activate() {
    super.activate();

    LabelNode node = (LabelNode) getModel();

    if (node.getParent() != null) {
        node.getParent().eAdapters().add(this);
        if (null == ((AbstractView) node.getParent()).getParent()) {
            return;
        }
        ((AbstractView) node.getParent()).getParent().eAdapters().add(this);

        ((AbstractView) node.getParent()).getUmlModel().eAdapters().add(this);

        for (Stereotype stereotype : ((Element) ((AbstractView) node.getParent()).getUmlModel()).getAppliedStereotypes()) {
            stereotype.eAdapters().add(this);
        }

        for (EAnnotation annotation : ((EModelElement) ((AbstractView) node.getParent()).getUmlModel()).getEAnnotations()) {
            annotation.eAdapters().add(this);
        }
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:28,代码来源:CompartmentLabelNodeEditPart.java


注:本文中的org.eclipse.uml2.uml.Stereotype类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。