本文整理汇总了Java中org.eclipse.xtext.common.types.JvmEnumerationType.getMembers方法的典型用法代码示例。如果您正苦于以下问题:Java JvmEnumerationType.getMembers方法的具体用法?Java JvmEnumerationType.getMembers怎么用?Java JvmEnumerationType.getMembers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtext.common.types.JvmEnumerationType
的用法示例。
在下文中一共展示了JvmEnumerationType.getMembers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEnum_04
import org.eclipse.xtext.common.types.JvmEnumerationType; //导入方法依赖的package包/类
@Test
public void testEnum_04() throws Exception {
String typeName = TestEnum.class.getName();
JvmEnumerationType type = (JvmEnumerationType) getTypeProvider().findTypeByName(typeName);
List<JvmMember> members = type.getMembers();
boolean constructorFound = false;
for (JvmMember member : members) {
if (member instanceof JvmConstructor) {
assertFalse(constructorFound);
constructorFound = true;
List<JvmFormalParameter> parameters = ((JvmConstructor) member).getParameters();
assertEquals(1, parameters.size()); // synthetic parameters are not returned
}
}
assertTrue(constructorFound);
}
示例2: testNestedEnum_04
import org.eclipse.xtext.common.types.JvmEnumerationType; //导入方法依赖的package包/类
@Test
public void testNestedEnum_04() throws Exception {
String typeName = TestEnum.Nested.class.getName();
JvmEnumerationType type = (JvmEnumerationType) getTypeProvider().findTypeByName(typeName);
List<JvmMember> members = type.getMembers();
boolean constructorFound = false;
for (JvmMember member : members) {
if (member instanceof JvmConstructor) {
assertFalse(constructorFound);
constructorFound = true;
List<JvmFormalParameter> parameters = ((JvmConstructor) member).getParameters();
assertEquals(0, parameters.size()); // synthetic parameters are not returned
}
}
assertTrue(constructorFound);
}
示例3: testEnumerationWithCompleter
import org.eclipse.xtext.common.types.JvmEnumerationType; //导入方法依赖的package包/类
@Test
public void testEnumerationWithCompleter() {
try {
final XExpression expression = this.expression("null", false);
final Procedure1<JvmEnumerationType> _function = (JvmEnumerationType it) -> {
EList<JvmMember> _members = it.getMembers();
JvmEnumerationLiteral _enumerationLiteral = this.builder.toEnumerationLiteral(expression, "BAR");
this.builder.<JvmEnumerationLiteral>operator_add(_members, _enumerationLiteral);
EList<JvmMember> _members_1 = it.getMembers();
JvmEnumerationLiteral _enumerationLiteral_1 = this.builder.toEnumerationLiteral(expression, "BAZ");
this.builder.<JvmEnumerationLiteral>operator_add(_members_1, _enumerationLiteral_1);
};
final JvmEnumerationType enumeration = this.builder.toEnumerationType(expression, "my.test.Foo", _function);
expression.eResource().getContents().add(enumeration);
this.completer.complete(enumeration);
final Class<?> compiled = this.compile(expression.eResource(), enumeration);
final Method valuesMethod = compiled.getMethod("values");
Object _invoke = valuesMethod.invoke(null);
final Object[] values = ((Object[]) _invoke);
Assert.assertEquals("BAR", values[0].toString());
Assert.assertEquals("BAZ", values[1].toString());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}