当前位置: 首页>>代码示例>>Java>>正文


Java TypeDeclaration类代码示例

本文整理汇总了Java中org.eclipse.gmt.modisco.java.TypeDeclaration的典型用法代码示例。如果您正苦于以下问题:Java TypeDeclaration类的具体用法?Java TypeDeclaration怎么用?Java TypeDeclaration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TypeDeclaration类属于org.eclipse.gmt.modisco.java包,在下文中一共展示了TypeDeclaration类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: queryGrabats

import org.eclipse.gmt.modisco.java.TypeDeclaration; //导入依赖的package包/类
public static Query<Integer> queryGrabats(Resource resource) {
    return () -> {
        List<ClassDeclaration> listResult = new BasicEList<>();

        Iterable<TypeDeclaration> typeDeclarations = getAllInstances(resource, JavaPackage.eINSTANCE.getTypeDeclaration());
        for (TypeDeclaration type : typeDeclarations) {
            for (BodyDeclaration body : type.getBodyDeclarations()) {
                if ((body instanceof MethodDeclaration)) {
                    MethodDeclaration method = (MethodDeclaration) body;
                    if (nonNull(method.getModifier()) && method.getModifier().isStatic() && nonNull(method.getReturnType()) && method.getReturnType().getType() == type) {
                        listResult.add((ClassDeclaration) type);
                    }
                }
            }
        }

        return listResult.size();
    };
}
 
开发者ID:atlanmod,项目名称:NeoEMF,代码行数:20,代码来源:QueryFactoryASE2015.java

示例2: queryGrabats

import org.eclipse.gmt.modisco.java.TypeDeclaration; //导入依赖的package包/类
public static Query<Integer> queryGrabats(Resource resource) {
    return () -> {
        List<ClassDeclaration> listResult = new BasicEList<>();

        Iterable<TypeDeclaration> typeDeclarations = getAllInstances(resource, JavaPackage.eINSTANCE.getTypeDeclaration());
        for (TypeDeclaration owner : typeDeclarations) {
            for (BodyDeclaration method : owner.getBodyDeclarations()) {
                if (method instanceof MethodDeclaration) {
                    MethodDeclaration methDecl = (MethodDeclaration) method;
                    if (nonNull(methDecl.getModifier()) && methDecl.getModifier().isStatic() && methDecl.getReturnType() == owner) {
                        listResult.add((ClassDeclaration) owner);
                    }
                }
            }
        }

        return listResult.size();
    };
}
 
开发者ID:atlanmod,项目名称:NeoEMF,代码行数:20,代码来源:QueryFactory.java

示例3: addTypeParametersToTypeDeclaration

import org.eclipse.gmt.modisco.java.TypeDeclaration; //导入依赖的package包/类
/**
 * Add type parameters to a type declaration with a name including these
 * ones and set its name properly
 * 
 * @param typeDeclaration
 *            the type declaration.
 */
public static void addTypeParametersToTypeDeclaration(TypeDeclaration typeDeclaration) {
	String typeName = typeDeclaration.getName();
	if (typeName.contains(TypeParameterHelper.PARAMETER_ENTRY)) {
		int index = typeName.indexOf(TypeParameterHelper.PARAMETER_ENTRY);
		typeDeclaration.setName(typeName.substring(0, index).trim());
		typeDeclaration.getOriginalCompilationUnit().setName(typeDeclaration.getName() + ".java");
		String[] parametersTypes = typeName.substring(index + 1, typeName.length() - 1).split(
				TypeParameterHelper.PARAMETER_SEPARATOR);
		EList<TypeParameter> typeParametersList = typeDeclaration.getTypeParameters();
		for (String parameterTypeName : parametersTypes) {
			typeParametersList.add(TypeParameterHelper.createTypeParameter(parameterTypeName));
		}
	}
}
 
开发者ID:awltech,项目名称:eclipse-optimus,代码行数:22,代码来源:TypeParameterHelper.java

示例4: visitType

import org.eclipse.gmt.modisco.java.TypeDeclaration; //导入依赖的package包/类
/**
 * Visit the properties of an {@code IType}.
 * 
 * @param type
 *            the {@code IType}
 * @return the {@link AbstractTypeDeclaration} object corresponding to the
 *         {@code IType}
 * @throws JavaModelException
 */
protected AbstractTypeDeclaration visitType(final IType type) throws JavaModelException {

	AbstractTypeDeclaration element = null;
	if (type.isEnum()) {
		element = getFactory().createEnumDeclaration();
	} else if (type.isAnnotation()) {
		element = getFactory().createAnnotationTypeDeclaration();
	} else if (type.isInterface()) {
		element = getFactory().createInterfaceDeclaration();
	} else {
		element = getFactory().createClassDeclaration();
	}

	this.currentlyVisitedJavaElement = type;
	initializeNode(element);

	element.setName(type.getElementName());
	element.setPackage(this.currentPackage);
	this.currentPackage.getOwnedElements().add(element);

	// superClass
	// enums are classes but can't have explicit superclass
	String superClass = type.getSuperclassTypeSignature();
	if (type.isClass() && superClass != null
			&& !ClassFileParserUtils.isJavaLangObject(superClass)) {
		((ClassDeclaration) element).setSuperClass(getRefOnType(superClass));
	}

	// superInterfaces
	// annotations can't have explicit annotations
	if (!type.isAnnotation()) {
		for (String superInterface : type.getSuperInterfaceTypeSignatures()) {
			if (!ClassFileParserUtils.isJavaLangObject(superInterface)) {
				element.getSuperInterfaces().add(getRefOnType(superInterface));
			}
		}
	}

	// type parameters
	ITypeParameter[] parameters = type.getTypeParameters();
	for (ITypeParameter parameter : parameters) {
		TypeParameter t = getFactory().createTypeParameter();
		((TypeDeclaration) element).getTypeParameters().add(t);
		visitTypeParameter(parameter, t);
	}

	// annotations
	for (IAnnotation annotation : type.getAnnotations()) {
		Annotation anno = getFactory().createAnnotation();
		element.getAnnotations().add(anno);
		visitAnnotation(annotation, anno);
	}

	// visibility modifier
	Modifier m = getFactory().createModifier();
	element.setModifier(m);
	m.setBodyDeclaration(element);
	manageModifier(m, type.getFlags(), type);

	ClassFileParserUtils.manageBindingDeclaration(element, type, this);

	return element;
}
 
开发者ID:markus1978,项目名称:srcrepo,代码行数:73,代码来源:ClassFileParser.java

示例5: setAbstractTypeDeclaration

import org.eclipse.gmt.modisco.java.TypeDeclaration; //导入依赖的package包/类
/**
 * Set the abstract type of the interface declaration under construction
 * 
 * @param typeDeclaration
 *            the abstract type of the interface declaration under
 *            construction.
 * @return the builder.
 */
public InterfaceDeclarationBuilder setAbstractTypeDeclaration(TypeDeclaration typeDeclaration) {
	this.buildInterfaceDeclaration.setAbstractTypeDeclaration(typeDeclaration);
	return this;
}
 
开发者ID:awltech,项目名称:eclipse-optimus,代码行数:13,代码来源:InterfaceDeclarationBuilder.java

示例6: setAbstractTypeDeclaration

import org.eclipse.gmt.modisco.java.TypeDeclaration; //导入依赖的package包/类
/**
 * Set the abstract type of the class declaration under construction
 * 
 * @param typeDeclaration
 *            the abstract type of the class declaration under construction.
 * @return the builder.
 */
public ClassDeclarationBuilder setAbstractTypeDeclaration(TypeDeclaration typeDeclaration) {
	this.buildClassDeclaration.setAbstractTypeDeclaration(typeDeclaration);
	return this;
}
 
开发者ID:awltech,项目名称:eclipse-optimus,代码行数:12,代码来源:ClassDeclarationBuilder.java

示例7: setAbstractTypeDeclaration

import org.eclipse.gmt.modisco.java.TypeDeclaration; //导入依赖的package包/类
/**
 * Set the abstract type of the enum declaration under construction
 * 
 * @param typeDeclaration
 *            the abstract type of the enum declaration under construction.
 * @return the builder.
 */
public EnumDeclarationBuilder setAbstractTypeDeclaration(TypeDeclaration typeDeclaration) {
	this.buildEnumDeclaration.setAbstractTypeDeclaration(typeDeclaration);
	return this;
}
 
开发者ID:awltech,项目名称:eclipse-optimus,代码行数:12,代码来源:EnumDeclarationBuilder.java


注:本文中的org.eclipse.gmt.modisco.java.TypeDeclaration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。