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


Java MethodDeclaration.getSimpleName方法代码示例

本文整理汇总了Java中com.sun.mirror.declaration.MethodDeclaration.getSimpleName方法的典型用法代码示例。如果您正苦于以下问题:Java MethodDeclaration.getSimpleName方法的具体用法?Java MethodDeclaration.getSimpleName怎么用?Java MethodDeclaration.getSimpleName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.mirror.declaration.MethodDeclaration的用法示例。


在下文中一共展示了MethodDeclaration.getSimpleName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visitMethodDeclaration

import com.sun.mirror.declaration.MethodDeclaration; //导入方法依赖的package包/类
@Override
public void visitMethodDeclaration(MethodDeclaration methodDeclaration) {

    ERROR_PREFIX = methodDeclaration.getSimpleName() + ERROR_PREFIX_STATIC;

    // return type must be void
    if (!(methodDeclaration.getReturnType() instanceof VoidType))
        reportError(methodDeclaration,
                "the method shouldn't have any return value, but instead returns " +
                    methodDeclaration.getReturnType().toString());

    // method must not have arguments
    if (!methodDeclaration.getParameters().isEmpty())
        reportError(methodDeclaration, "the method accepts parameters");

}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:17,代码来源:OnDepartureVisitorAPT.java

示例2: visitMethodDeclaration

import com.sun.mirror.declaration.MethodDeclaration; //导入方法依赖的package包/类
/**
 * Stores information about getter and setter methods annotated with
 * {@link Accessor} and {@link Mutator}. This includes thrown exceptions,
 * setter parameters annotated with {@link MutatorParameter}, and required
 * imports. The {@link SPAnnotationProcessor} takes this information and
 * generates
 * {@link SPPersisterHelper#commitProperty(SPObject, String, Object, ca.sqlpower.dao.session.SessionPersisterSuperConverter)}
 * and
 * {@link SPPersisterHelper#findProperty(SPObject, String, ca.sqlpower.dao.session.SessionPersisterSuperConverter)}
 * methods.
 * 
 * @param d
 *            The {@link MethodDeclaration} of the method to visit.
 */
public void visitMethodDeclaration(MethodDeclaration d) {
	Accessor accessorAnnotation = d.getAnnotation(Accessor.class);
	Mutator mutatorAnnotation = d.getAnnotation(Mutator.class);
	Transient transientAnnotation = d.getAnnotation(Transient.class);
	TypeMirror type = null;
	
	if (!d.getDeclaringType().equals(typeDecl)) return;

	if (accessorAnnotation != null && transientAnnotation == null) {
		type = d.getReturnType();
	} else if (mutatorAnnotation != null && transientAnnotation == null) {
		type = d.getParameters().iterator().next().getType();
	} else {
		return;
	}
	
	String methodName = d.getSimpleName();
	Class<?> c = null;
	
	try {
		
		c = SPAnnotationProcessorUtils.convertTypeMirrorToClass(type);

		if (!propertiesToAccess.containsKey(methodName) && accessorAnnotation != null) {
			propertiesToAccess.put(methodName, c);
			
			if (accessorAnnotation.persistOnlyIfNonNull()) {
				propertiesToPersistOnlyIfNonNull.add(
						SPAnnotationProcessorUtils.convertMethodToProperty(methodName));
			}
			accessorAdditionalInfo.putAll(
					methodName, Arrays.asList(accessorAnnotation.additionalInfo()));
			
		} else if (!propertiesToMutate.containsKey(methodName) && mutatorAnnotation != null) {
			for (ReferenceType refType : d.getThrownTypes()) {
				Class<? extends Exception> thrownType = 
					(Class<? extends Exception>) Class.forName(refType.toString());
				mutatorThrownTypes.put(methodName, thrownType);
				mutatorImports.put(methodName, thrownType.getName());
			}

			propertiesToMutate.put(methodName, c);
			mutatorImports.put(methodName, c.getName());
			
			for (ParameterDeclaration pd : d.getParameters()) {
				MutatorParameter mutatorParameterAnnotation = 
					pd.getAnnotation(MutatorParameter.class);
				
				if (mutatorParameterAnnotation != null) {
					Class<?> extraParamType = 
						SPAnnotationProcessorUtils.convertTypeMirrorToClass(pd.getType());
					mutatorExtraParameters.put(methodName, 
							new MutatorParameterObject(
									extraParamType,
									pd.getSimpleName(), 
									mutatorParameterAnnotation.value()));
					mutatorImports.put(methodName, extraParamType.getName());
				}
			}
		}
		
	} catch (ClassNotFoundException e) {
		valid = false;
		e.printStackTrace();
	}
}
 
开发者ID:SQLPower,项目名称:sqlpower-library,代码行数:81,代码来源:SPClassVisitor.java

示例3: methodToString

import com.sun.mirror.declaration.MethodDeclaration; //导入方法依赖的package包/类
public String methodToString(MethodDeclaration method) {
    StringBuffer buf = new StringBuffer(method.getSimpleName());
    for (ParameterDeclaration param : method.getParameters())
        buf.append(";"+param.getType().toString());
    return buf.toString();
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:7,代码来源:AnnotationProcessorContext.java

示例4: getMethodName

import com.sun.mirror.declaration.MethodDeclaration; //导入方法依赖的package包/类
public String getMethodName(MethodDeclaration m) {
    return m.getSimpleName();
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:4,代码来源:APTNavigator.java

示例5: fullName

import com.sun.mirror.declaration.MethodDeclaration; //导入方法依赖的package包/类
protected String fullName(MethodDeclaration m) {
    return m.getDeclaringType().getQualifiedName()+'#'+m.getSimpleName();
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:4,代码来源:InlineAnnotationReaderImpl.java


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