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


Java JavaMethod.getParentClass方法代码示例

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


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

示例1: getAnnotationValue

import com.thoughtworks.qdox.model.JavaMethod; //导入方法依赖的package包/类
/**
 * Recuopera o valor de um atributo de uma anotacao
 */
public Object getAnnotationValue(final JavaMethod javaMethod, final String annotName, final String attribute) throws GeradorException {
	
	final JavaClass javaClass = javaMethod.getParentClass();
	
	final String className = javaClass.getFullyQualifiedName();
	
	final Class clazz = getAnnotationClass(className);
	
	final Method method = getMethod(javaMethod, className, clazz);
	
	final Class annClazz = getAnnotationClass(annotName);
	
	final java.lang.annotation.Annotation annotation = method.getAnnotation(annClazz);
	
	final Object value = getValue(javaMethod, annotation, attribute);
	
	return value;
	
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:23,代码来源:DomainModelLoaderFactory.java

示例2: getAnnotationValue

import com.thoughtworks.qdox.model.JavaMethod; //导入方法依赖的package包/类
public Object getAnnotationValue(JavaMethod javaMethod, String annotName, String attribute) throws GeradorException{
	
	JavaClass javaClass = javaMethod.getParentClass();
	
	String className = javaClass.getFullyQualifiedName();
	
	Class clazz = forName(className);
	
	Method method = getMethod(javaMethod, className, clazz);
	
	Class annClazz = forName(annotName);
	
	java.lang.annotation.Annotation annotation = method.getAnnotation(annClazz);
	
	Object value=getValue(annotation,attribute);
	
	return value;
	
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:20,代码来源:DomainModelLoaderFactory.java

示例3: getAnnotationValue

import com.thoughtworks.qdox.model.JavaMethod; //导入方法依赖的package包/类
/**
 * Recuopera o valor de um atributo de uma anotacao
 */
public Object getAnnotationValue(final JavaMethod javaMethod, final String annotName, final String attribute) throws GeradorException {
	
	final JavaClass javaClass = javaMethod.getParentClass();
	
	final String className = javaClass.getFullyQualifiedName();
	
	final Class clazz = getAnnotationClass(className);
	
	final Method method = getMethod(javaMethod, className, clazz);
	
	final Class annClazz = getAnnotationClass(annotName);
	
	final java.lang.annotation.Annotation annotation = method.getAnnotation(annClazz);
	
	final Object value = getValue(annotation, attribute);
	
	return value;
	
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:23,代码来源:DomainModelLoaderFactory.java

示例4: createMethodModel

import com.thoughtworks.qdox.model.JavaMethod; //导入方法依赖的package包/类
private EventMethodModel createMethodModel(JavaMethod method)
        throws EventConventionException, ClassNotFoundException {
    JavaClass clazz = method.getParentClass();
    //Check EventProducer conventions
    if (!method.getReturnType().isVoid()) {
        throw new EventConventionException("All methods of interface "
                + clazz.getFullyQualifiedName() + " must have return type 'void'!");
    }
    String methodSig = clazz.getFullyQualifiedName() + "." + method.getCallSignature();
    JavaParameter[] params = method.getParameters();
    if (params.length < 1) {
        throw new EventConventionException("The method " + methodSig
                + " must have at least one parameter: 'Object source'!");
    }
    Type firstType = params[0].getType();
    if (firstType.isPrimitive() || !"source".equals(params[0].getName())) {
        throw new EventConventionException("The first parameter of the method " + methodSig
                + " must be: 'Object source'!");
    }

    //build method model
    DocletTag tag = method.getTagByName("event.severity");
    EventSeverity severity;
    if (tag != null) {
        severity = EventSeverity.valueOf(tag.getValue());
    } else {
        severity = EventSeverity.INFO;
    }
    EventMethodModel methodMeta = new EventMethodModel(
            method.getName(), severity);
    if (params.length > 1) {
        for (int j = 1, cj = params.length; j < cj; j++) {
            JavaParameter p = params[j];
            Class<?> type;
            JavaClass pClass = p.getType().getJavaClass();
            if (p.getType().isPrimitive()) {
                type = PRIMITIVE_MAP.get(pClass.getName());
                if (type == null) {
                    throw new UnsupportedOperationException(
                            "Primitive datatype not supported: " + pClass.getName());
                }
            } else {
                String className = pClass.getFullyQualifiedName();
                type = Class.forName(className);
            }
            methodMeta.addParameter(type, p.getName());
        }
    }
    Type[] exceptions = method.getExceptions();
    if (exceptions != null && exceptions.length > 0) {
        //We only use the first declared exception because that is always thrown
        JavaClass cl = exceptions[0].getJavaClass();
        methodMeta.setExceptionClass(cl.getFullyQualifiedName());
        methodMeta.setSeverity(EventSeverity.FATAL); //In case it's not set in the comments
    }
    return methodMeta;
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:58,代码来源:EventProducerCollector.java


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