本文整理汇总了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;
}
}
示例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;
}
示例3: getClassName
import org.eclipse.uml2.uml.Classifier; //导入方法依赖的package包/类
private String getClassName(Classifier clazz) {
String className = clazz.getName();
return className;
}
示例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();
}