本文整理汇总了Java中org.eclipse.xtext.xbase.XFeatureCall.getFeature方法的典型用法代码示例。如果您正苦于以下问题:Java XFeatureCall.getFeature方法的具体用法?Java XFeatureCall.getFeature怎么用?Java XFeatureCall.getFeature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtext.xbase.XFeatureCall
的用法示例。
在下文中一共展示了XFeatureCall.getFeature方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasConstructorCallWithThis
import org.eclipse.xtext.xbase.XFeatureCall; //导入方法依赖的package包/类
protected boolean hasConstructorCallWithThis(JvmConstructor constr) {
XExpression associatedExpression = logicalContainerProvider.getAssociatedExpression(constr);
if (associatedExpression == null) {
return false;
}
TreeIterator<EObject> contents = associatedExpression.eAllContents();
while (contents.hasNext()) {
EObject next = contents.next();
if (next instanceof XFeatureCall) {
XFeatureCall featureCall = (XFeatureCall) next;
if (featureCall.getFeature() instanceof JvmConstructor && featureCall.getConcreteSyntaxFeatureName().equals(IFeatureNames.THIS.toString())) {
return true;
}
}
}
return false;
}
示例2: checkDelegateConstructorIsFirst
import org.eclipse.xtext.xbase.XFeatureCall; //导入方法依赖的package包/类
@Check
public void checkDelegateConstructorIsFirst(XFeatureCall featureCall) {
JvmIdentifiableElement feature = featureCall.getFeature();
if (feature != null && !feature.eIsProxy() && feature instanceof JvmConstructor) {
JvmIdentifiableElement container = logicalContainerProvider.getNearestLogicalContainer(featureCall);
if (container != null) {
if (container instanceof JvmConstructor) {
XExpression body = logicalContainerProvider.getAssociatedExpression(container);
if (body == featureCall)
return;
if (body instanceof XBlockExpression) {
List<XExpression> expressions = ((XBlockExpression) body).getExpressions();
if (expressions.isEmpty() || expressions.get(0) != featureCall) {
error("Constructor call must be the first expression in a constructor", null, INVALID_CONSTRUCTOR_INVOCATION);
}
}
} else {
error("Constructor call must be the first expression in a constructor", null, INVALID_CONSTRUCTOR_INVOCATION);
}
}
}
}
示例3: getSwitchLocalVariableName
import org.eclipse.xtext.xbase.XFeatureCall; //导入方法依赖的package包/类
protected String getSwitchLocalVariableName(XSwitchExpression expr, ITreeAppendable b) {
JvmFormalParameter declaredParam = expr.getDeclaredParam();
if (declaredParam != null) {
if (b.hasName(declaredParam)) {
return b.getName(declaredParam);
}
return null;
}
XExpression switchExpression = expr.getSwitch();
if (b.hasName(switchExpression)) {
return b.getName(switchExpression);
}
if (switchExpression instanceof XFeatureCall) {
XFeatureCall featureCall = (XFeatureCall) switchExpression;
JvmIdentifiableElement feature = featureCall.getFeature();
if (b.hasName(feature)) {
return b.getName(feature);
}
}
return null;
}
示例4: hasJvmConstructorCall
import org.eclipse.xtext.xbase.XFeatureCall; //导入方法依赖的package包/类
protected boolean hasJvmConstructorCall(XExpression obj) {
if (!(obj instanceof XBlockExpression)) {
return false;
}
XBlockExpression blockExpression = (XBlockExpression) obj;
EList<XExpression> expressions = blockExpression.getExpressions();
if (expressions.isEmpty()) {
return false;
}
XExpression expr = expressions.get(0);
if (!(expr instanceof XFeatureCall)) {
return false;
}
XFeatureCall featureCall = (XFeatureCall) expr;
return featureCall.getFeature() instanceof JvmConstructor;
}
示例5: checkConstructorArgumentsAreValid
import org.eclipse.xtext.xbase.XFeatureCall; //导入方法依赖的package包/类
@Check
public void checkConstructorArgumentsAreValid(XFeatureCall featureCall) {
JvmIdentifiableElement feature = featureCall.getFeature();
if (feature != null && !feature.eIsProxy() && feature instanceof JvmConstructor) {
JvmType containerType = EcoreUtil2.getContainerOfType(logicalContainerProvider.getNearestLogicalContainer(featureCall), JvmType.class);
for(XExpression argument: featureCall.getFeatureCallArguments()) {
checkIsValidConstructorArgument(argument, containerType);
}
}
}
示例6: checkExplicitOperationCall
import org.eclipse.xtext.xbase.XFeatureCall; //导入方法依赖的package包/类
@Check
public void checkExplicitOperationCall(XFeatureCall featureCall) {
if (featureCall.getFeature() instanceof JvmOperation
&& !featureCall.isExplicitOperationCallOrBuilderSyntax()
&& featureCall.getFeature().getSimpleName().equals(featureCall.getConcreteSyntaxFeatureName())) {
addIssue("Method call without parentheses", featureCall, XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, OPERATION_WITHOUT_PARENTHESES);
}
}
示例7: _toJavaStatement
import org.eclipse.xtext.xbase.XFeatureCall; //导入方法依赖的package包/类
protected void _toJavaStatement(final XFeatureCall expr, final ITreeAppendable b, boolean isReferenced) {
// if it's a call to this() or super() make sure the arguments are forced to be compiled to expressions.
if (expr.getFeature() instanceof JvmConstructor) {
b.newLine();
featureCalltoJavaExpression(expr, b, false);
b.append(";");
} else {
_toJavaStatement((XAbstractFeatureCall) expr, b, isReferenced);
}
}
示例8: getSwitchLocalVariableSimpleName
import org.eclipse.xtext.xbase.XFeatureCall; //导入方法依赖的package包/类
protected String getSwitchLocalVariableSimpleName(XSwitchExpression expr) {
IdentifiableSimpleNameProvider nameProvider = getNameProvider();
String varName = nameProvider.getSimpleName(expr.getDeclaredParam());
if (varName != null) {
return varName;
}
XExpression expression = expr.getSwitch();
if (!(expression instanceof XFeatureCall)) {
return null;
}
XFeatureCall featureCall = (XFeatureCall) expression;
JvmIdentifiableElement feature = featureCall.getFeature();
return nameProvider.getSimpleName(feature);
}
示例9: isSimpleFeatureCall
import org.eclipse.xtext.xbase.XFeatureCall; //导入方法依赖的package包/类
protected boolean isSimpleFeatureCall(XExpression switch1) {
if (switch1 instanceof XFeatureCall) {
XFeatureCall featureCall = (XFeatureCall) switch1;
return !(featureCall.getFeature() instanceof JvmOperation);
}
return false;
}
示例10: _doEvaluate
import org.eclipse.xtext.xbase.XFeatureCall; //导入方法依赖的package包/类
protected Object _doEvaluate(XFeatureCall featureCall, IEvaluationContext context, CancelIndicator indicator) {
if (featureCall.isTypeLiteral()) {
JvmType type = (JvmType) featureCall.getFeature();
Object result = translateJvmTypeToResult(type, 0);
return result;
} else {
return _doEvaluate((XAbstractFeatureCall) featureCall, context, indicator);
}
}
示例11: _visit
import org.eclipse.xtext.xbase.XFeatureCall; //导入方法依赖的package包/类
protected void _visit(final XFeatureCall semanticObj, final INode originNode, final ImportsAcceptor acceptor) {
if (((semanticObj.getFeature() instanceof JvmType) && semanticObj.isTypeLiteral())) {
JvmIdentifiableElement _feature = semanticObj.getFeature();
this.visit(((JvmType) _feature), originNode, acceptor);
} else {
this.collectStaticImportsFrom(semanticObj, acceptor);
}
}
示例12: testLinkToParameter_1
import org.eclipse.xtext.xbase.XFeatureCall; //导入方法依赖的package包/类
@Test
public void testLinkToParameter_1() {
try {
XExpression _expression = this.expression("x", false);
final XFeatureCall expr = ((XFeatureCall) _expression);
final Resource resource = expr.eResource();
resource.eSetDeliver(false);
EList<EObject> _contents = resource.getContents();
final Procedure1<JvmGenericType> _function = (JvmGenericType it) -> {
EList<JvmMember> _members = it.getMembers();
JvmField _field = this._jvmTypesBuilder.toField(expr, "x", this.stringType(expr));
this._jvmTypesBuilder.<JvmField>operator_add(_members, _field);
EList<JvmMember> _members_1 = it.getMembers();
final Procedure1<JvmOperation> _function_1 = (JvmOperation it_1) -> {
EList<JvmFormalParameter> _parameters = it_1.getParameters();
JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(expr, "x", this.stringType(expr));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
this._jvmTypesBuilder.setBody(it_1, expr);
};
JvmOperation _method = this._jvmTypesBuilder.toMethod(expr, "doStuff", this.stringType(expr), _function_1);
this._jvmTypesBuilder.<JvmOperation>operator_add(_members_1, _method);
};
JvmGenericType _class = this._jvmTypesBuilder.toClass(expr, "Foo", _function);
this._jvmTypesBuilder.<JvmGenericType>operator_add(_contents, _class);
this._validationTestHelper.assertNoErrors(expr);
JvmIdentifiableElement _feature = expr.getFeature();
Assert.assertTrue((_feature instanceof JvmFormalParameter));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例13: testLinkToField
import org.eclipse.xtext.xbase.XFeatureCall; //导入方法依赖的package包/类
@Test
public void testLinkToField() {
try {
XExpression _expression = this.expression("x", false);
final XFeatureCall expr = ((XFeatureCall) _expression);
final Resource resource = expr.eResource();
resource.eSetDeliver(false);
EList<EObject> _contents = resource.getContents();
final Procedure1<JvmGenericType> _function = (JvmGenericType it) -> {
EList<JvmMember> _members = it.getMembers();
JvmField _field = this._jvmTypesBuilder.toField(expr, "x", this.stringType(expr));
this._jvmTypesBuilder.<JvmField>operator_add(_members, _field);
EList<JvmMember> _members_1 = it.getMembers();
final Procedure1<JvmOperation> _function_1 = (JvmOperation it_1) -> {
EList<JvmFormalParameter> _parameters = it_1.getParameters();
JvmFormalParameter _parameter = this._jvmTypesBuilder.toParameter(expr, "y", this.stringType(expr));
this._jvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter);
this._jvmTypesBuilder.setBody(it_1, expr);
};
JvmOperation _method = this._jvmTypesBuilder.toMethod(expr, "doStuff", this.stringType(expr), _function_1);
this._jvmTypesBuilder.<JvmOperation>operator_add(_members_1, _method);
};
JvmGenericType _class = this._jvmTypesBuilder.toClass(expr, "Foo", _function);
this._jvmTypesBuilder.<JvmGenericType>operator_add(_contents, _class);
this._validationTestHelper.assertNoErrors(expr);
JvmIdentifiableElement _feature = expr.getFeature();
Assert.assertTrue((_feature instanceof JvmField));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例14: testLinkToField_1
import org.eclipse.xtext.xbase.XFeatureCall; //导入方法依赖的package包/类
@Test
public void testLinkToField_1() {
try {
XExpression _expression = this.expression("x", false);
final XFeatureCall expr = ((XFeatureCall) _expression);
final Resource resource = expr.eResource();
resource.eSetDeliver(false);
EList<EObject> _contents = resource.getContents();
final Procedure1<JvmGenericType> _function = (JvmGenericType it) -> {
EList<JvmMember> _members = it.getMembers();
JvmField _field = this._jvmTypesBuilder.toField(expr, "x", this.stringType(expr));
this._jvmTypesBuilder.<JvmField>operator_add(_members, _field);
EList<JvmMember> _members_1 = it.getMembers();
final Procedure1<JvmOperation> _function_1 = (JvmOperation it_1) -> {
this._jvmTypesBuilder.setBody(it_1, expr);
};
JvmOperation _method = this._jvmTypesBuilder.toMethod(expr, "getX", this.stringType(expr), _function_1);
this._jvmTypesBuilder.<JvmOperation>operator_add(_members_1, _method);
};
JvmGenericType _class = this._jvmTypesBuilder.toClass(expr, "Foo", _function);
this._jvmTypesBuilder.<JvmGenericType>operator_add(_contents, _class);
this._validationTestHelper.assertNoErrors(expr);
JvmIdentifiableElement _feature = expr.getFeature();
Assert.assertTrue((_feature instanceof JvmField));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}