本文整理汇总了Java中com.thoughtworks.qdox.model.JavaClass.getAnnotations方法的典型用法代码示例。如果您正苦于以下问题:Java JavaClass.getAnnotations方法的具体用法?Java JavaClass.getAnnotations怎么用?Java JavaClass.getAnnotations使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.thoughtworks.qdox.model.JavaClass
的用法示例。
在下文中一共展示了JavaClass.getAnnotations方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isElegibleForGeneration
import com.thoughtworks.qdox.model.JavaClass; //导入方法依赖的package包/类
protected boolean isElegibleForGeneration(String sourceFile) throws MojoExecutionException
{
if (sourceFile.endsWith(".template.xml"))
{
return true;
}
JavaClass javaClass = getJavaClass(sourceFile);
if (!javaClass.isAbstract() && javaClass.isPublic() && javaClass.isA(WidgetCreator.class.getCanonicalName()))
{
for (JavaAnnotation annot: javaClass.getAnnotations())
{
if (annot.getType().getFullyQualifiedName().equals(DECLARATIVE_FACTORY_ANNOTATION))
{
return true;
}
}
}
return false;
}
示例2: isServiceClass
import com.thoughtworks.qdox.model.JavaClass; //导入方法依赖的package包/类
private boolean isServiceClass( JavaClass type )
{
if ( this.classnamePattern.matcher( type.getName() ).matches() )
{
getLog().debug( "Class matches: " + type.getName() );
for ( JavaAnnotation annotation : type.getAnnotations() )
{
if ( Path.class.getName().equals( annotation.getType().getFullyQualifiedName() ) )
{
getLog().info( "Found service: " + type.getName() );
return true;
}
}
}
return false;
}
示例3: createResource
import com.thoughtworks.qdox.model.JavaClass; //导入方法依赖的package包/类
public JavaFile createResource(JavaClass jaxRsClass) {
// find path annotation
JavaAnnotation jaxRsPath = null;
JavaAnnotation jaxRsConsumes = null;
for (JavaAnnotation annotation : jaxRsClass.getAnnotations()) {
String annotationType = annotation.getType().getFullyQualifiedName();
if (annotationType.equals(Path.class.getName())) {
jaxRsPath = annotation;
} else if (annotationType.equals(Consumes.class.getName())) {
jaxRsConsumes = annotation;
}
}
if (jaxRsPath == null) return null; // no a valid JAX RS resource
if (jaxRsClass.getName().matches(settings.getExcludedClassNamesRegex())) return null;
System.out.println(jaxRsClass.getName());
TypeSpec.Builder retrofitResourceBuilder = TypeSpec
.interfaceBuilder(jaxRsClass.getName())
.addModifiers(Modifier.PUBLIC);
addAboutJavadoc(retrofitResourceBuilder);
for (JavaMethod jaxRsMethod : jaxRsClass.getMethods()) {
Collection<MethodSpec> retrofitMethods = createMethod(jaxRsClass, jaxRsMethod, jaxRsPath, jaxRsConsumes);
if (retrofitMethods != null) {
for (MethodSpec method : retrofitMethods) {
retrofitResourceBuilder.addMethod(method);
}
}
}
return JavaFile.builder(settings.getPackageName(), retrofitResourceBuilder.build()).build();
}
示例4: isBusinessMeaningful
import com.thoughtworks.qdox.model.JavaClass; //导入方法依赖的package包/类
private boolean isBusinessMeaningful(JavaClass doc) {
for (JavaAnnotation annotation : doc.getAnnotations()) {
if (annotation.getType().getPackageName().startsWith(ANNOTATION_PREFIX)) {
return true;
}
}
return false;
}
示例5: getAnnotationValue
import com.thoughtworks.qdox.model.JavaClass; //导入方法依赖的package包/类
public Object getAnnotationValue(final JavaClass javaClass, final String key) {
final String[] parts = key.split("\\.");
if (parts.length > 0) {
final Annotation[] annotations = javaClass.getAnnotations();
Annotation annotation = null;
for (final Annotation annotDaVez : annotations) {
if (annotDaVez.getType().getJavaClass().getName().equals(parts[0])) {
annotation = annotDaVez;
}
}
if (annotation != null) {
if (parts.length <= 1) {
// retorna o valor da tag
return annotation.getParameterValue();
} else {
// retorna o valor do atributo da tab
return annotation.getNamedParameter(parts[1]);
// return docletTag.getNamedParameterMap().get(parts[1]);
}
} else {
return null;
}
} else {
return null;
}
}
示例6: getAnnotationValue
import com.thoughtworks.qdox.model.JavaClass; //导入方法依赖的package包/类
public Object getAnnotationValue(JavaClass javaClass, String key) {
String[] parts = key.split("\\.");
if (parts.length > 0) {
Annotation[] annotations = javaClass.getAnnotations();
Annotation annotation=null;
for (Annotation annotDaVez : annotations) {
if(annotDaVez.getType().getJavaClass().getName().equals(parts[0])){
annotation = annotDaVez;
}
}
if (annotation != null) {
if (parts.length <= 1) {
// retorna o valor da tag
return annotation.getParameterValue();
} else {
// retorna o valor do atributo da tab
return annotation.getNamedParameter(parts[1]);
//return docletTag.getNamedParameterMap().get(parts[1]);
}
} else {
return null;
}
} else {
return null;
}
}