public List<EnumerationLiteral> getEnumerationLiterals(Classifier enumerationType) { return ((Enumeration) enumerationType).getOwnedLiterals(); }
private void generateEnum(Element element) throws IOException { Enumeration clazz = (Enumeration) element; logger.log(Level.FINE, "Enum: " + clazz.getName()); // Generate the enumeration for this class CompilationUnit compilationUnit = enumGenerator.generateEnum(clazz, sourceDirectoryPackageName); generateClassFile(clazz, compilationUnit); }
public EnumerationLiteral getEnumerationLiteral(Classifier enumerationType, String literalName) { return ((Enumeration) enumerationType).getOwnedLiteral(literalName); }
public void visitBefore(org.eclipse.uml2.uml.Enumeration enumeration) { OJEnum ojEnum = new OJEnum(enumeration.getName()); ojEnum.addToImplementedInterfaces(UmlgGenerationUtil.UmlgEnum); OJPackage ojPackage = new OJPackage(Namer.name(enumeration.getNearestPackage())); ojEnum.setMyPackage(ojPackage); for (EnumerationLiteral literal : enumeration.getOwnedLiterals()) { List<Slot> slots = literal.getSlots(); for (Slot slot : slots) { for (EnumerationLiteral literal : enumeration.getOwnedLiterals()) { for (EnumerationLiteral literal : enumeration.getOwnedLiterals()) { for (EnumerationLiteral literal : enumeration.getOwnedLiterals()) { OJEnumLiteral ojLiteral = new OJEnumLiteral(literal.getName()); ojEnum.addToLiterals(ojLiteral);
/** * @see org.andromda.metafacades.uml.EnumerationFacade#getMemberVariables() */ @Override protected Collection<AttributeFacade> handleGetMemberVariables() { // To Check: could be sufficient to return the collection of attributes only // without filtering // http://www.andromda.org/jira/browse/UMLMETA-87 final Collection variables = this.metaObject instanceof Enumeration ? ((Enumeration)this.metaObject).getOwnedAttributes() : CollectionUtils.collect(this.getAttributes(), UmlUtilities.ELEMENT_TRANSFORMER); CollectionUtils.filter( variables, new Predicate() { public boolean evaluate(final Object object) { // evaluates to true in case it's NOT a native literal // but an attribute which considered as a regular member return object instanceof AttributeFacade && ((AttributeFacade)object).isEnumerationMember(); } } ); return variables; }
@Override public Object caseEnumeration(Enumeration enumeration) { org.eclipse.uml2.uml.Package package_ = enumeration .getNearestPackage(); if (package_ != null) { EEnum eEnum = EcoreFactory.eINSTANCE.createEEnum(); elementToEModelElementMap.put(enumeration, eEnum); EPackage ePackage = (EPackage) doSwitch(package_); ePackage.getEClassifiers().add(eEnum); setName(eEnum, enumeration); defaultCase(enumeration); return eEnum; } return super.caseEnumeration(enumeration); }
/** * @see org.andromda.metafacades.uml.EnumerationFacade#getMemberVariables() */ @Override protected Collection<AttributeFacade> handleGetMemberVariables() { // To Check: could be sufficient to return the collection of attributes only // without filtering // http://www.andromda.org/jira/browse/UMLMETA-87 final Collection variables = this.metaObject instanceof Enumeration ? ((Enumeration)this.metaObject).getOwnedAttributes() : CollectionUtils.collect(this.getAttributes(), UmlUtilities.ELEMENT_TRANSFORMER); CollectionUtils.filter( variables, new Predicate() { public boolean evaluate(final Object object) { // evaluates to true in case it's NOT a native literal // but an attribute which considered as a regular member return object instanceof AttributeFacade && ((AttributeFacade)object).isEnumerationMember(); } } ); return variables; }
/** * Return type can be either EnumerationLiteral or AttributeFacade * @see org.andromda.metafacades.uml.EnumerationFacade#getLiterals() */ @Override protected Collection<? extends ModelElementFacade> handleGetLiterals() { // To Check: could be sufficient to return the collection of literals only // without filtering final Collection<? extends ModelElementFacade> literals = this.metaObject instanceof Enumeration ? ((Enumeration)this.metaObject).getOwnedLiterals() : CollectionUtils.collect(this.getAttributes(), UmlUtilities.ELEMENT_TRANSFORMER); CollectionUtils.filter( literals, new Predicate() { public boolean evaluate(final Object object) { // evaluates to true in case it's a native literal // or an attribute which is not considered a regular member return (object instanceof EnumerationLiteral) || (object instanceof AttributeFacade && !((AttributeFacade)object).isEnumerationMember()); } } ); return literals; }
.getOwnedLiteral(((EEnumLiteral) value) .getName());
/** * Default implementation just gets the name of the named element's * {@link org.eclipse.emf.ecore.EObject#eClass() metaclass} or, if it is a * {@link TypedElement}, the name of its type. */ public String getDescription(Object namedElement) { if (namedElement instanceof TypedElement) { Type type = ((TypedElement) namedElement).getType(); return (type == null) ? OCLStandardLibraryImpl.INSTANCE .getOclVoid().getName() : type.getName(); } else if (namedElement instanceof EnumerationLiteral) { return ((EnumerationLiteral) namedElement).getEnumeration() .getName(); } else if (namedElement == null) { return null; } return ((EObject) namedElement).eClass().getName(); }
/** * Return type can be either EnumerationLiteral or AttributeFacade * @see org.andromda.metafacades.uml.EnumerationFacade#getLiterals() */ @Override protected Collection<? extends ModelElementFacade> handleGetLiterals() { // To Check: could be sufficient to return the collection of literals only // without filtering final Collection<? extends ModelElementFacade> literals = this.metaObject instanceof Enumeration ? ((Enumeration)this.metaObject).getOwnedLiterals() : CollectionUtils.collect(this.getAttributes(), UmlUtilities.ELEMENT_TRANSFORMER); CollectionUtils.filter( literals, new Predicate() { public boolean evaluate(final Object object) { // evaluates to true in case it's a native literal // or an attribute which is not considered a regular member return (object instanceof EnumerationLiteral) || (object instanceof AttributeFacade && !((AttributeFacade)object).isEnumerationMember()); } } ); return literals; }
.getOwnedLiteral(ENUMERATION_LITERAL__EMPTY); break; case ExtendedMetaData.SIMPLE_CONTENT : value = contentKindEnumeration .getOwnedLiteral(ENUMERATION_LITERAL__SIMPLE); break; case ExtendedMetaData.MIXED_CONTENT : value = contentKindEnumeration .getOwnedLiteral(ENUMERATION_LITERAL__MIXED); break; case ExtendedMetaData.ELEMENT_ONLY_CONTENT : value = contentKindEnumeration .getOwnedLiteral(ENUMERATION_LITERAL__ELEMENT_ONLY); break; .getOwnedLiteral(ENUMERATION_LITERAL__SIMPLE); break; case ExtendedMetaData.ATTRIBUTE_FEATURE : value = featureKindEnumeration .getOwnedLiteral(ENUMERATION_LITERAL__ATTRIBUTE); break; case ExtendedMetaData.ATTRIBUTE_WILDCARD_FEATURE : value = featureKindEnumeration .getOwnedLiteral(ENUMERATION_LITERAL__ATTRIBUTE_WILDCARD); break; case ExtendedMetaData.ELEMENT_FEATURE : value = featureKindEnumeration .getOwnedLiteral(ENUMERATION_LITERAL__ELEMENT); break;
ValueSpecification valueSpecification = mock(ValueSpecification.class); when(enumeration.getOwnedLiterals()).thenReturn(enumLiterals); when(enumLiterals.iterator()).thenReturn(enumIter); when(enumIter.hasNext()).thenReturn(true).thenReturn(false);
@Override public Object caseInstanceValue(InstanceValue instanceValue) { Type type = instanceValue.getType(); if (type instanceof Enumeration) { instanceValue.setInstance(((Enumeration) type) .getOwnedLiteral(newValue)); } else { InstanceSpecification instance = instanceValue .getInstance(); if (instance != null) { ValueSpecification specification = instance .getSpecification(); if (specification != null) { return doSwitch(specification); } } return null; } return instanceValue; }
/** * Qualifier's corresponding property gets defaulted to make the ui work. * * @return */ public String getQualifierJippoDefaultValue() { if (isString()) { return "\"\""; } else if (isBoolean()) { return "false"; } else if (isInteger()) { return "-1"; } else if (isDate()) { return "LocalDate.now()"; } else if (isEnumeration()) { Enumeration enumeration = (Enumeration) getType(); String name = Namer.qualifiedName(enumeration); return name + "." + enumeration.getOwnedLiterals().get(0).getName(); } else { throw new IllegalStateException(String.format("Qualified property %s is a %s, this is not supported for default values", new String[]{getQualifiedName(), getType().getQualifiedName()})); } }
.getOwnedLiteral(ENUMERATION_LITERAL__EMPTY)) { ExtendedMetaData.EMPTY_CONTENT); } else if (value == contentKindEnumeration .getOwnedLiteral(ENUMERATION_LITERAL__SIMPLE)) { ExtendedMetaData.SIMPLE_CONTENT); } else if (value == contentKindEnumeration .getOwnedLiteral(ENUMERATION_LITERAL__MIXED)) { ExtendedMetaData.MIXED_CONTENT); } else if (value == contentKindEnumeration .getOwnedLiteral(ENUMERATION_LITERAL__ELEMENT_ONLY)) { .getOwnedLiteral(ENUMERATION_LITERAL__SIMPLE)) { ExtendedMetaData.SIMPLE_FEATURE); } else if (value == featureKindEnumeration .getOwnedLiteral(ENUMERATION_LITERAL__ATTRIBUTE)) { ExtendedMetaData.ATTRIBUTE_FEATURE); } else if (value == featureKindEnumeration .getOwnedLiteral(ENUMERATION_LITERAL__ATTRIBUTE_WILDCARD)) { ExtendedMetaData.ATTRIBUTE_WILDCARD_FEATURE); } else if (value == featureKindEnumeration .getOwnedLiteral(ENUMERATION_LITERAL__ELEMENT)) { ExtendedMetaData.ELEMENT_FEATURE);
ValueSpecification valueSpecification = mock(ValueSpecification.class); when(enumeration.getOwnedLiterals()).thenReturn(enumLiterals); when(enumLiterals.iterator()).thenReturn(enumIter); when(enumIter.hasNext()).thenReturn(true).thenReturn(false);
UMLUtil.TAG_DEFINITION__XML_FEATURE_KIND, featureKindEnumeration .getOwnedLiteral(UMLUtil.ENUMERATION_LITERAL__ATTRIBUTE)); UMLUtil.TAG_DEFINITION__XML_FEATURE_KIND, featureKindEnumeration .getOwnedLiteral(UMLUtil.ENUMERATION_LITERAL__ELEMENT));
ValueSpecification valueSpecification = mock(ValueSpecification.class); when(enumeration.getOwnedLiterals()).thenReturn(enumLiterals); when(enumLiterals.iterator()).thenReturn(enumIter); when(enumIter.hasNext()).thenReturn(true).thenReturn(false);
return enumeration == null ? null : enumeration.getOwnedLiteral(definition.getName()); } else if (definition instanceof EPackage) { return getProfile((EPackage) definition, context);