本文整理汇总了Java中com.thoughtworks.qdox.model.JavaSource类的典型用法代码示例。如果您正苦于以下问题:Java JavaSource类的具体用法?Java JavaSource怎么用?Java JavaSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JavaSource类属于com.thoughtworks.qdox.model包,在下文中一共展示了JavaSource类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getQualifiedName
import com.thoughtworks.qdox.model.JavaSource; //导入依赖的package包/类
/**
* @param source the {@link JavaSource}.
* @param simpleName the {@link Class#getSimpleName() simple name} of a class.
* @return the {@link Class#getName() qualified name} of the class.
*/
public String getQualifiedName( JavaSource source, String simpleName )
{
for ( String importStatement : source.getImports() )
{
if ( simpleName.equals( Util.getSimpleName( importStatement ) ) )
{
return importStatement;
}
}
String packageName = source.getPackageName();
if ( packageName.isEmpty() )
{
// default package...
return simpleName;
}
else if ( JAVA_LANG_TYPES.contains( simpleName ) )
{
return "java.lang." + simpleName;
}
return packageName + "." + simpleName;
}
开发者ID:mojohaus,项目名称:servicedocgen-maven-plugin,代码行数:27,代码来源:JavaDocHelper.java
示例2: main
import com.thoughtworks.qdox.model.JavaSource; //导入依赖的package包/类
public static void main(String[] args) {
JavaProjectBuilder builder = new JavaProjectBuilder();
try {
JavaSource src = builder.addSource(new File(
"/Users/bingoohuang/github/java-sandbox/src/main/java/org/n3r/sandbox/qdox/DemoJava.java"));
JavaPackage pkg = src.getPackage();
String name = pkg.getName();
String toString = pkg.toString();
JavaPackage parent = pkg.getParentPackage();
Collection<JavaClass> classes = pkg.getClasses();
List<JavaMethod> methods = classes.iterator().next().getMethods();
for (JavaMethod method : methods) {
System.out.println("Method Name : " + method.getName());
}
System.out.println("pkg name : " + name);
System.out.println("pkg to String : " + toString);
System.out.println("pkg parent name : " + parent);
// Method Name : printName
// Method Name : createListOfNames
// pkg name : org.n3r.sandbox.qdox
// pkg to String : package org.n3r.sandbox.qdox
// pkg parent name : null
} catch (Exception e) {
e.printStackTrace();
}
}
开发者ID:bingoohuang,项目名称:javacode-demo,代码行数:28,代码来源:QDoxDemo.java
示例3: scanJavaFilesRecursive
import com.thoughtworks.qdox.model.JavaSource; //导入依赖的package包/类
private void scanJavaFilesRecursive( File sourceDir, JavaProjectBuilder builder, List<JavaClass> serviceClasses )
throws IOException
{
File[] children = sourceDir.listFiles();
if ( children == null )
{
getLog().debug( "Directory does not exist: " + sourceDir );
return;
}
for ( File file : children )
{
if ( file.isDirectory() )
{
scanJavaFilesRecursive( file, builder, serviceClasses );
}
else if ( file.getName().endsWith( ".java" ) )
{
try
{
JavaSource source = builder.addSource( file );
for ( JavaClass type : source.getClasses() )
{
boolean isService = isServiceClass( type );
if ( isService )
{
serviceClasses.add( type );
}
}
}
catch ( Exception e )
{
getLog().debug( "Error parsing file: " + file, e );
}
}
}
}
开发者ID:mojohaus,项目名称:servicedocgen-maven-plugin,代码行数:38,代码来源:ServiceDocGenReport.java
示例4: getSrc
import com.thoughtworks.qdox.model.JavaSource; //导入依赖的package包/类
/**
* @return the src
*/
public JavaSource[] getSrc() {
return src;
}
开发者ID:jcrcano,项目名称:DrakkarKeel,代码行数:7,代码来源:JavaParser.java
示例5: setSrc
import com.thoughtworks.qdox.model.JavaSource; //导入依赖的package包/类
/**
* @param src the src to set
*/
public void setSrc(JavaSource[] src) {
this.src = src;
}
开发者ID:jcrcano,项目名称:DrakkarKeel,代码行数:7,代码来源:JavaParser.java
注:本文中的com.thoughtworks.qdox.model.JavaSource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论