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


Java Classifier.getName方法代码示例

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


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

示例1: ClassNode

import org.eclipse.uml2.uml.Classifier; //导入方法依赖的package包/类
/**
 * Creates a ClassNode based on the EMF-UML model-element and layout
 * information provided
 * 
 * 
 * @param clazz
 *            the EMF-UML model-element which holds informations of this
 *            diagram element
 * @param id
 *            the layout id of this element
 */
public ClassNode(Classifier clazz, String id) {
	/*
	 * position = layout.getPosition(); width = layout.getWidth(); height =
	 * layout.getHeight(); id = layout.getName();
	 */
	this.id = id;
	name = clazz.getName();
	attributes = new ArrayList<Attribute>();
	// creating attributes
	for (Property attr : clazz.getAttributes()) {
		if (attr.getAssociation() == null) {
			attributes.add(new Attribute(attr));
		}
	}

	operations = new ArrayList<MemberOperation>();
	// creating operations
	for (Operation op : clazz.getOperations()) {
		operations.add(new MemberOperation(op));
	}

	if (clazz.isAbstract()) {
		type = CDNodeType.ABSTRACT_CLASS;
	} else {
		type = CDNodeType.CLASS;
	}
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:39,代码来源:ClassNode.java

示例2: createPropertiesDefinition

import org.eclipse.uml2.uml.Classifier; //导入方法依赖的package包/类
public static String createPropertiesDefinition(Classifier classifier) throws Exception {		
	EPackage _package = EcoreFactory.eINSTANCE.createEPackage();
	EClass propertyDefinition = EcoreFactory.eINSTANCE.createEClass();
	GenModel genModel = GenModelFactory.eINSTANCE.createGenModel();
	ExtendedMetaData extendedMetaData = genModel.getExtendedMetaData();
	
	List<EStructuralFeature> features = new ArrayList<EStructuralFeature>();
	String propertiesDefinition = "";
	
	for(Property property : classifier.getAttributes()) {
		// consider attributes only if they aren't members of an association
		if(property.getAssociation() == null) {
			EAttribute attribute = EcoreFactory.eINSTANCE.createEAttribute();
			attribute.setName(property.getName());
			attribute.setUnsettable(true);
			
			// create an EEnum in case of enumeration
			if(property.getType() instanceof Enumeration) {
				Enumeration enumeration = (Enumeration) property.getType(); 
				EEnum eenumeration = EcoreFactory.eINSTANCE.createEEnum();
				eenumeration.setName(enumeration.getName());
				
				int literalValue = 0;
				for(EnumerationLiteral literal : enumeration.getOwnedLiterals()) {
					EEnumLiteral eliteral = EcoreFactory.eINSTANCE.createEEnumLiteral();
					eliteral.setName(literal.getName());
					eliteral.setValue(literalValue);
					literalValue++;
					eenumeration.getELiterals().add(eliteral);
				}
				
				_package.getEClassifiers().add(eenumeration);
				attribute.setEType(eenumeration);
			}
			else {
				attribute.setEType(XMLTypePackage.eINSTANCE.getString());
			}
			propertyDefinition.getEStructuralFeatures().add(attribute);
			extendedMetaData.setFeatureKind(attribute, ExtendedMetaData.ELEMENT_FEATURE);
			features.add(attribute);
		}
	}
	
	if(!features.isEmpty()) {
		// first step: create an Ecore metamodel		
		URI uri = URI.createFileURI(new File(Path + classifier.getName() + Ecore_Model_Fragment).getAbsolutePath());
		Resource resource = Resource_Set.createResource(uri);

		_package.setName(classifier.getName() + "Properties");
		_package.setNsPrefix(classifier.getName() + "Properties");
		_package.setNsURI("http://" + classifier.getName() + "Properties");
		resource.getContents().add(_package);
		propertyDefinition.setName("Properties");
		_package.getEClassifiers().add(propertyDefinition);
		
		// second step: derive the GenModel from the metamodel
		genModel.setComplianceLevel(GenJDKLevel.JDK70_LITERAL);		 
		genModel.setModelDirectory("");
		genModel.setModelName(_package.getName());
		genModel.initialize(Collections.singleton(_package));
			
		// third step: export the XSD from the GenModel			
		XSDExporter modelExporter = new XSDExporter();
		modelExporter.setGenModel(genModel);
		modelExporter.getEPackages().add(_package);
		EPackageConvertInfo convertInfo = modelExporter.getEPackageConvertInfo(_package);
		convertInfo.setConvert(true);
		EPackageExportInfo exportInfo = modelExporter.getEPackageExportInfo(_package);
		exportInfo.setArtifactLocation(Path + classifier.getName() + Xsd_Model_Fragment);
		modelExporter.export(null); 
		
		// the name of the properties definition; it allows node types to reference it
		propertiesDefinition = classifier.getName() + "Properties";
	}
	return propertiesDefinition;
}
 
开发者ID:alexander-bergmayr,项目名称:caml2tosca,代码行数:77,代码来源:ToscaUtil.java

示例3: getClassName

import org.eclipse.uml2.uml.Classifier; //导入方法依赖的package包/类
private String getClassName(Classifier clazz) {
	String className = clazz.getName();
	return className;
}
 
开发者ID:WalterMourao,项目名称:andromda,代码行数:5,代码来源:EnumClassGenerator.java

示例4: generateFromStringMethod

import org.eclipse.uml2.uml.Classifier; //导入方法依赖的package包/类
/**
    * Generate the fromString method.
    * 
    * @param Class
    *              clazz the UML class
    * @param PrintWriter
    *              the writer used to write the code
    */
protected void generateFromStringMethod(Classifier clazz, PrintWriter writer) {
       String className = clazz.getName();
       generateSimpleComment(writer, String.format(FROM_STRING_COMMENT, className));
       writer.format("public static %s fromString(%s value) { return %s.valueOf(value); }",className,javaType,className);
       writer.println();
}
 
开发者ID:WalterMourao,项目名称:andromda,代码行数:15,代码来源:EnumClassGenerator.java


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