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


Java Type类代码示例

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


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

示例1: getJavadocComments

import com.thoughtworks.qdox.model.Type; //导入依赖的package包/类
protected String getJavadocComments(final ITestNGMethod method) {

        try {
            final Method m = method.getMethod();
            final String javaClass = m.getDeclaringClass().getName();
            final String javaMethod = m.getName();
            final JavaClass jc = getJavaDocBuilder(m.getDeclaringClass()).getClassByName(javaClass);
            final Class<?>[] types = method.getMethod().getParameterTypes();
            final Type[] qdoxTypes = new Type[types.length];
            for (int i = 0; i < types.length; i++) {
                final String type = getType(types[i]);
                final int dim = getDim(types[i]);
                qdoxTypes[i] = new Type(type, dim);
            }

            final JavaMethod jm = jc.getMethodBySignature(javaMethod, qdoxTypes);
            return jm.getComment();
        } catch (final Throwable e) {
            logger.error("Exception loading the javadoc comments for : " + method.getMethodName() + e);
            return null;
        }

    }
 
开发者ID:tarun3kumar,项目名称:seleniumtestsframework,代码行数:24,代码来源:SeleniumTestsReporter.java

示例2: generateClassBuilderFor

import com.thoughtworks.qdox.model.Type; //导入依赖的package包/类
private PojoClass generateClassBuilderFor(JavaClass javaClass, STGroup template) throws IOException {
	for (JavaMethod method : javaClass.getMethods()) {
		if (isAllArgumentsConstructor(javaClass, method)) {
			PojoClass pojo = new PojoClass(getGeneratedClassPackage(javaClass), getPojoClassName(javaClass.getName()), javaClass.getFullyQualifiedName(),
					interfaceName, getPojoSuperclass(javaClass), Boolean.parseBoolean(includeFieldsEnum));
			for (JavaParameter p : method.getParameters()) {
				if (p.getType().isA(new Type(POJO_CLASS_MAP))) {
					pojo.addMapParameter(p.getType().toGenericString(), p.getName());
				} else if(p.getType().isA(new Type(POJO_CLASS_LIST))){
                       pojo.addListParameter(p.getType().toGenericString(), p.getName());
                   } else if(p.getType().isA(new Type(POJO_CLASS_SET))){
                       pojo.addSetParameter(p.getType().toGenericString(), p.getName());
                   }else {
					pojo.addParameter(p.getType().toGenericString(), p.getName());
				}
			}

			return pojo;
		}
	}

	return null;
}
 
开发者ID:sergypv,项目名称:thrift-pojo-generator-maven-plugin,代码行数:24,代码来源:ThriftPojoGenerator.java

示例3: getDefaultValue

import com.thoughtworks.qdox.model.Type; //导入依赖的package包/类
/**
 * Determina o valor padrao para o atributo informado.<br> 
 * Normalmente trata os renderizadores, que tem valores padrao diferentes, de acordo com o tipo da propriedade.<br> 
 * Ex: String=textfield, Date=calendar, Number=textfield que aceita apenas números<br>
 * 
 * @param attribute
 * @param javaEntity 
 * @return
 */
protected Object getDefaultValue(Method attribute, AbstractInheritableJavaEntity javaEntity) {
	
	Object defaultValue = attribute.getDefaultValue();;
	
	if(javaEntity instanceof com.thoughtworks.qdox.model.JavaMethod){
		JavaMethod javaMethod = (JavaMethod) javaEntity;
		
		Type propertyType = javaMethod.getPropertyType();
		
		if(attribute.getName().equals(DomainModelLoaderFactory.ATTRIBUTE_RENDERER) && propertyType.isA(DomainModelLoaderFactory.TYPE_DATE)){
			
			defaultValue = JazzRenderer.CALENDAR.toString();
			
		}
		
	}
	
	return defaultValue;
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:29,代码来源:DomainModelLoaderFactory.java

示例4: hasAnnotation

import com.thoughtworks.qdox.model.Type; //导入依赖的package包/类
/**
 * testa se a classe informada possui a anotação
 * @throws GeradorException
 */
protected boolean hasAnnotation(Type type, String strAnnotation) {
	final java.lang.annotation.Annotation annotation = getAnnotation(type.getJavaClass(), strAnnotation);
	
	return annotation!=null;
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:10,代码来源:DomainModelLoaderFactory.java

示例5: getDefaultValue

import com.thoughtworks.qdox.model.Type; //导入依赖的package包/类
/**
 * Determina o valor padrao para o atributo informado.<br> 
 * Normalmente trata os renderizadores, que tem valores padrao diferentes, de acordo com o tipo da propriedade.<br> 
 * Ex: String=textfield, Date=calendar, Number=textfield que aceita apenas n�meros<br>
 * 
 * @param attribute
 * @param javaEntity 
 * @return
 */
protected Object getDefaultValue(Method attribute, AbstractInheritableJavaEntity javaEntity) {
	
	Object defaultValue = attribute.getDefaultValue();;
	
	if(javaEntity instanceof com.thoughtworks.qdox.model.JavaMethod){
		JavaMethod javaMethod = (JavaMethod) javaEntity;
		
		Type propertyType = javaMethod.getPropertyType();
		
		if(attribute.getName().equals(DomainModelLoaderFactory.ATTRIBUTE_RENDERER) && propertyType.isA(DomainModelLoaderFactory.TYPE_DATE)){
			
			defaultValue = JazzRenderer.CALENDAR.toString();
			
		}
		
	}
	
	return defaultValue;
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:29,代码来源:DomainModelLoaderFactory.java

示例6: hasAnnotation

import com.thoughtworks.qdox.model.Type; //导入依赖的package包/类
/**
 * testa se a classe informada possui a anota��o
 * @throws GeradorException
 */
protected boolean hasAnnotation(Type type, String strAnnotation) {
	final java.lang.annotation.Annotation annotation = getAnnotation(type.getJavaClass(), strAnnotation);
	
	return annotation!=null;
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:10,代码来源:DomainModelLoaderFactory.java

示例7: createMethodModel

import com.thoughtworks.qdox.model.Type; //导入依赖的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

示例8: requiredAppearsInGetterJavadoc

import com.thoughtworks.qdox.model.Type; //导入依赖的package包/类
@Test
public void requiredAppearsInGetterJavadoc() throws IOException {

    JavaMethod javaMethod = classWithRequired.getMethodBySignature("getRequiredProperty", new Type[] {});
    String javaDocComment = javaMethod.getComment();

    assertThat(javaDocComment, containsString("(Required)"));

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:RequiredIT.java

示例9: requiredAppearsInSetterJavadoc

import com.thoughtworks.qdox.model.Type; //导入依赖的package包/类
@Test
public void requiredAppearsInSetterJavadoc() throws IOException {

    JavaMethod javaMethod = classWithRequired.getMethodBySignature("setRequiredProperty", new Type[] { new Type("java.lang.String") });
    String javaDocComment = javaMethod.getComment();

    assertThat(javaDocComment, containsString("(Required)"));

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:RequiredIT.java

示例10: descriptionAppearsInGetterJavadoc

import com.thoughtworks.qdox.model.Type; //导入依赖的package包/类
@Test
public void descriptionAppearsInGetterJavadoc() throws IOException {

    JavaMethod javaMethod = classWithTitle.getMethodBySignature("getTitle", new Type[] {});
    String javaDocComment = javaMethod.getComment();

    assertThat(javaDocComment, containsString("A title for this property"));

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:TitleIT.java

示例11: descriptionAppearsInSetterJavadoc

import com.thoughtworks.qdox.model.Type; //导入依赖的package包/类
@Test
public void descriptionAppearsInSetterJavadoc() throws IOException {

    JavaMethod javaMethod = classWithTitle.getMethodBySignature("setTitle", new Type[] { new Type("java.lang.String") });
    String javaDocComment = javaMethod.getComment();

    assertThat(javaDocComment, containsString("A title for this property"));

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:TitleIT.java

示例12: descriptionAppearsInGetterJavadoc

import com.thoughtworks.qdox.model.Type; //导入依赖的package包/类
@Test
public void descriptionAppearsInGetterJavadoc() throws IOException {

    JavaMethod javaMethod = classWithDescription.getMethodBySignature("getDescription", new Type[] {});
    String javaDocComment = javaMethod.getComment();

    assertThat(javaDocComment, containsString("A description for this property"));

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:DescriptionIT.java

示例13: descriptionAppearsInSetterJavadoc

import com.thoughtworks.qdox.model.Type; //导入依赖的package包/类
@Test
public void descriptionAppearsInSetterJavadoc() throws IOException {

    JavaMethod javaMethod = classWithDescription.getMethodBySignature("setDescription", new Type[] { new Type("java.lang.String") });
    String javaDocComment = javaMethod.getComment();

    assertThat(javaDocComment, containsString("A description for this property"));

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:DescriptionIT.java

示例14: getValue

import com.thoughtworks.qdox.model.Type; //导入依赖的package包/类
/**
 * TODO: IMPLEMENTAR DEFAULT VALUE INTELIGENTE PARA OUTROS ATRIBUTOS DE JAZZPROP
 * @param javaMethod 
 * @param annotation
 * @param attribute
 * @return
 * @throws GeradorException
 */
protected Object getValue(JavaMethod javaMethod, final java.lang.annotation.Annotation annotation, final String attribute) throws GeradorException {
	
	Object value = getAnnotationAttributeValue(annotation, attribute);
	
	Type propertyType = javaMethod.getPropertyType();
	
	if(isDefaultValue(value) && isJazzRendererAttribute(annotation, attribute) ){
			
		value = getRendererDefaultValue(value, propertyType);
		
	}
	
	return value;
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:23,代码来源:DomainModelLoaderFactory.java

示例15: getRendererDefaultValue

import com.thoughtworks.qdox.model.Type; //导入依赖的package包/类
/**
 * TODO Implementar o retorno de default value para todos os tipos interessantes
 * @param value
 * @param propertyType
 * @return
 */
protected Object getRendererDefaultValue(Object value, Type propertyType) {

	if (propertyType.isA(TYPE_DATE)) {
		value = JazzRenderer.CALENDAR;
		
	}else if(propertyType.isA(TYPE_BOOLEAN)) {
		value = JazzRenderer.CHECKBOX;
		
	}
	
	return value;
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:19,代码来源:DomainModelLoaderFactory.java


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