本文整理汇总了Java中org.eclipse.xtext.common.types.JvmGenericType.setInterface方法的典型用法代码示例。如果您正苦于以下问题:Java JvmGenericType.setInterface方法的具体用法?Java JvmGenericType.setInterface怎么用?Java JvmGenericType.setInterface使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.xtext.common.types.JvmGenericType
的用法示例。
在下文中一共展示了JvmGenericType.setInterface方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createType
import org.eclipse.xtext.common.types.JvmGenericType; //导入方法依赖的package包/类
public JvmDeclaredType createType(final TypeDeclaration type, final String packageName) {
JvmDeclaredType _switchResult = null;
int _kind = TypeDeclaration.kind(type.modifiers);
switch (_kind) {
case TypeDeclaration.CLASS_DECL:
_switchResult = TypesFactory.eINSTANCE.createJvmGenericType();
break;
case TypeDeclaration.INTERFACE_DECL:
JvmGenericType _createJvmGenericType = TypesFactory.eINSTANCE.createJvmGenericType();
final Procedure1<JvmGenericType> _function = (JvmGenericType it) -> {
it.setInterface(true);
};
_switchResult = ObjectExtensions.<JvmGenericType>operator_doubleArrow(_createJvmGenericType, _function);
break;
case TypeDeclaration.ENUM_DECL:
_switchResult = TypesFactory.eINSTANCE.createJvmEnumerationType();
break;
case TypeDeclaration.ANNOTATION_TYPE_DECL:
_switchResult = TypesFactory.eINSTANCE.createJvmAnnotationType();
break;
default:
String _string = type.toString();
String _plus = ("Cannot handle type " + _string);
throw new IllegalArgumentException(_plus);
}
final JvmDeclaredType jvmType = _switchResult;
jvmType.setPackageName(packageName);
jvmType.setSimpleName(String.valueOf(type.name));
if ((jvmType instanceof JvmGenericType)) {
if ((type.typeParameters != null)) {
for (final TypeParameter typeParam : type.typeParameters) {
{
final JvmTypeParameter jvmTypeParam = TypesFactory.eINSTANCE.createJvmTypeParameter();
jvmTypeParam.setName(String.valueOf(typeParam.name));
EList<JvmTypeParameter> _typeParameters = ((JvmGenericType)jvmType).getTypeParameters();
_typeParameters.add(jvmTypeParam);
}
}
}
}
if ((type.memberTypes != null)) {
for (final TypeDeclaration nestedType : type.memberTypes) {
{
final JvmDeclaredType nested = this.createType(nestedType, null);
EList<JvmMember> _members = jvmType.getMembers();
_members.add(nested);
}
}
}
return jvmType;
}
示例2: visit
import org.eclipse.xtext.common.types.JvmGenericType; //导入方法依赖的package包/类
@Override
public void visit(
final int version,
final int access,
final String name,
final String signature,
final String superName,
final String[] interfaces)
{
if ((access & ACC_SYNTHETIC) != 0)
throw new IllegalStateException("Cannot create type for anonymous or synthetic classes");
if ((ACC_ENUM & access) != 0) {
result = TypesFactory.eINSTANCE.createJvmEnumerationType();
offset = 2;
} else if ((ACC_ANNOTATION & access) != 0) {
result = TypesFactory.eINSTANCE.createJvmAnnotationType();
} else {
JvmGenericType generic = TypesFactory.eINSTANCE.createJvmGenericType();
result = generic;
generic.setInterface((access & ACC_INTERFACE) != 0);
generic.setStrictFloatingPoint((access & ACC_STRICT) != 0);
}
setTypeModifiers(access);
proxies.setVisibility(access, result);
setNameAndPackage(name);
BinarySuperTypeSignature genericSignature = null;
if (signature != null) {
if ((access & (ACC_STATIC | ACC_INTERFACE)) != 0) {
typeParameters = Collections.emptyMap();
}
genericSignature = BinarySignatures.createSuperTypeSignature(signature);
if (((ACC_ENUM | ACC_ANNOTATION) & access) == 0) {
typeParameters = proxies.createTypeParameters(genericSignature, (JvmTypeParameterDeclarator) result, typeParameters);
}
}
setSuperTypes(name, genericSignature, superName, interfaces);
}
示例3: toInterface
import org.eclipse.xtext.common.types.JvmGenericType; //导入方法依赖的package包/类
/**
* Creates a public interface declaration, associated to the given sourceElement. It sets the given name, which might be
* fully qualified using the standard Java notation.
*
* @param sourceElement
* the sourceElement the resulting element is associated with.
* @param name
* the qualified name of the resulting class.
* @param initializer
* the initializer to apply on the created interface element. If <code>null</code>, the interface won't be initialized.
*
* @return a {@link JvmGenericType} representing a Java class of the given name, <code>null</code>
* if sourceElement or name are <code>null</code>.
*/
/* @Nullable */
public JvmGenericType toInterface(/* @Nullable */ EObject sourceElement, /* @Nullable */ String name, /* @Nullable */ Procedure1<? super JvmGenericType> initializer) {
final JvmGenericType result = createJvmGenericType(sourceElement, name);
if (result == null)
return null;
result.setInterface(true);
result.setAbstract(true);
associate(sourceElement, result);
return initializeSafely(result, initializer);
}