use of org.eclipse.emf.codegen.ecore.genmodel.GenFeature in project xtext-core by eclipse.
the class GenModelUtil2 method getGetAccessor.
public static String getGetAccessor(final GenFeature genFeature, final ResourceSet resourceSet) {
final GenClass genClass = genFeature.getGenClass();
boolean _isMapEntry = genClass.isMapEntry();
if (_isMapEntry) {
GenFeature _mapEntryKeyFeature = genClass.getMapEntryKeyFeature();
boolean _equals = Objects.equal(genFeature, _mapEntryKeyFeature);
if (_equals) {
return "getKey";
}
GenFeature _mapEntryValueFeature = genClass.getMapEntryValueFeature();
boolean _equals_1 = Objects.equal(genFeature, _mapEntryValueFeature);
if (_equals_1) {
return "getValue";
}
}
return genFeature.getGetAccessor();
}
use of org.eclipse.emf.codegen.ecore.genmodel.GenFeature in project xtext-core by eclipse.
the class GenModelUtil2 method getGenFeature.
public static GenFeature getGenFeature(final EStructuralFeature feature, final ResourceSet resourceSet) {
GenClassifier _genClassifier = GenModelUtil2.getGenClassifier(feature.getEContainingClass(), resourceSet);
final GenClass genCls = ((GenClass) _genClassifier);
EList<GenFeature> _genFeatures = genCls.getGenFeatures();
for (final GenFeature genFeat : _genFeatures) {
String _name = feature.getName();
String _name_1 = genFeat.getEcoreFeature().getName();
boolean _equals = Objects.equal(_name, _name_1);
if (_equals) {
return genFeat;
}
}
StringConcatenation _builder = new StringConcatenation();
_builder.append("No GenFeature named \'");
String _name_2 = feature.getName();
_builder.append(_name_2);
_builder.append("\' found in GenClass \'");
_builder.append(genCls);
_builder.append("\' from GenModel");
URI _uRI = genCls.eResource().getURI();
_builder.append(_uRI);
throw new RuntimeException(_builder.toString());
}
use of org.eclipse.emf.codegen.ecore.genmodel.GenFeature in project xtext-core by eclipse.
the class SerializerFragment2 method getUnresolvingGetAccessor.
private StringConcatenationClient getUnresolvingGetAccessor(final EStructuralFeature feature, final ResourceSet resourceSet) {
final GenFeature genFeature = GenModelUtil2.getGenFeature(feature, resourceSet);
boolean _isResolveProxies = genFeature.isResolveProxies();
if (_isResolveProxies) {
StringConcatenationClient _client = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
_builder.append("eGet(");
EPackage _ecorePackage = genFeature.getGenPackage().getEcorePackage();
_builder.append(_ecorePackage);
_builder.append(".");
String _featureLiteral = GenModelUtil2.getFeatureLiteral(genFeature, resourceSet);
_builder.append(_featureLiteral);
_builder.append(", false)");
}
};
return _client;
} else {
StringConcatenationClient _client_1 = new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
String _getAccessor = GenModelUtil2.getGetAccessor(genFeature, resourceSet);
_builder.append(_getAccessor);
_builder.append("()");
}
};
return _client_1;
}
}
Aggregations