public void setOpen(Type type, boolean isOpen) {
if (isOpen == type.isOpen())
return;
if (isOpen) {
EAttribute eAttribute = (EAttribute)SDOFactory.eINSTANCE.createAttribute();
((EClass)type).getEStructuralFeatures().add(eAttribute);
eAttribute.setName("any");
eAttribute.setUnique(false);
eAttribute.setUpperBound(ETypedElement.UNBOUNDED_MULTIPLICITY);
eAttribute.setEType(EcorePackage.eINSTANCE.getEFeatureMapEntry());
ExtendedMetaData.INSTANCE.setFeatureKind(eAttribute, ExtendedMetaData.ELEMENT_WILDCARD_FEATURE);
ExtendedMetaData.INSTANCE.setProcessingKind(eAttribute, ExtendedMetaData.LAX_PROCESSING);
ExtendedMetaData.INSTANCE.setWildcards(eAttribute, Collections.singletonList("##any"));
// FB TBD Add an "anyAttribute" EAttribute as well.
if (ExtendedMetaData.INSTANCE.getMixedFeature((EClass)type) != null) {
eAttribute.setDerived(true);
eAttribute.setTransient(true);
eAttribute.setVolatile(true);
}
} else {
EClass eClass = (EClass)type;
EAttribute any = (EAttribute)eClass.getEStructuralFeature("any");
eClass.getEStructuralFeatures().remove(any);
}
}