作者:莫梓智 | 来源:互联网 | 2023-10-11 17:41
本文整理了Java中com.thoughtworks.qdox.model.JavaSource.getImports()
方法的一些代码示例,展示了JavaSource.getImports()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JavaSource.getImports()
方法的具体详情如下:
包路径:com.thoughtworks.qdox.model.JavaSource
类名称:JavaSource
方法名:getImports
JavaSource.getImports介绍
[英]Retrieve all the import
[中]检索所有导入文件
代码示例
代码示例来源:origin: com.thoughtworks.qdox/qdox
private String resolveImportedType( String importSpec, String typeName, boolean fullMatch ) {
String[] imports = getImports();
String resolvedName = null;
String dotSuffix = "." + importSpec;
for (int i = 0; i String imprt = imports[i];
//static imports can refer to inner classes
if(imprt.startsWith( "static " ) ) {
imprt = imprt.substring( 7 );
}
if (imprt.equals(importSpec) || (!fullMatch && imprt.endsWith(dotSuffix))) {
String candidateName = imprt.substring( 0, imprt.length() - importSpec.length()) + typeName;
resolvedName = resolveFullyQualifiedType( candidateName );
if(resolvedName == null && !"*".equals(importSpec)) {
resolvedName = candidateName;
}
}
}
return resolvedName;
}
代码示例来源:origin: org.codehaus.mojo.groovy.runtime/groovy-runtime-1.1
private void render(final JavaClass type, final PrintWriter out) {
assert type != null;
assert out != null;
out.println("//");
out.println("// Generated by " + getClass().getName() + " on " + new Date());
out.println("//");
out.println();
String pkg = type.getSource().getPackage();
if (pkg != null) {
out.println("package " + pkg + ";");
out.println();
}
String[] imports = type.getSource().getImports();
for (int j=0; j out.println("import " + imports[j] + ";");
}
if (imports.length > 0) {
out.println();
}
out.write(type.toString());
out.println();
out.flush();
}
代码示例来源:origin: org.apache.maven.plugins/maven-javadoc-plugin
typeName =
TypeResolver.byClassName( clazz.getBinaryName(), clazz.getJavaClassLibrary(),
clazz.getSource().getImports() ).resolveType( name.trim() );
typeName =
TypeResolver.byClassName( clazz.getBinaryName(), clazz.getJavaClassLibrary(),
clazz.getSource().getImports() ).resolveType( name.trim() );
代码示例来源:origin: paul-hammant/qdox
/** {@inheritDoc} */
public ModelWriter writeSource( JavaSource source )
{
// package statement
writePackage( source.getPackage() );
// import statement
for ( String imprt : source.getImports() )
{
buffer.write( "import " );
buffer.write( imprt );
buffer.write( ';' );
buffer.newline();
}
if ( source.getImports().size() > 0 )
{
buffer.newline();
}
// classes
for ( ListIterator iter = source.getClasses().listIterator(); iter.hasNext(); )
{
JavaClass cls = iter.next();
writeClass( cls );
if ( iter.hasNext() )
{
buffer.newline();
}
}
return this;
}
代码示例来源:origin: qdox/qdox
String[] imports = getImports();
for (int i = 0; i if (imports[i].equals(typeName)) return typeName;
代码示例来源:origin: paul-hammant/qdox
public JavaType getReturnType( boolean resolve )
{
JavaType result = originalMethod.getReturnType( resolve );
if (result != null) {
String originalValue = result.getValue();
result = DefaultJavaType.resolve( result, originalMethod.getDeclaringClass(), callingClass );
//According to java-specs, if it could be resolved the upper boundary, so Object, should be returned
if ( !resolve && !this.getReturns().getFullyQualifiedName().equals( result.getFullyQualifiedName() ) )
{
TypeResolver typeResolver =
TypeResolver.byClassName( callingClass.getBinaryName(), callingClass.getJavaClassLibrary(),
callingClass.getSource().getImports() );
result = new DefaultJavaType( "java.lang.Object", originalValue, 0, typeResolver );
}
}
return result;
}
代码示例来源:origin: paul-hammant/qdox
implement.getSource().getImports() );
代码示例来源:origin: qdox/qdox
public String toString() {
IndentBuffer result = new IndentBuffer();
// package statement
if (packge != null) {
result.write("package ");
result.write(packge);
result.write(';');
result.newline();
result.newline();
}
// import statement
String[] imports = getImports();
for (int i = 0; imports != null && i result.write("import ");
result.write(imports[i]);
result.write(';');
result.newline();
}
if (imports != null && imports.length > 0) {
result.newline();
}
// classes
JavaClass[] classes = getClasses();
for (int i = 0; i if (i > 0) result.newline();
classes[i].write(result);
}
return result.toString();
}
代码示例来源:origin: com.thoughtworks.qdox/qdox
public String getCodeBlock() {
IndentBuffer result = new IndentBuffer();
// package statement
if (packge != null) {
result.write("package ");
result.write(packge.getName());
result.write(';');
result.newline();
result.newline();
}
// import statement
String[] imports = getImports();
for (int i = 0; imports != null && i result.write("import ");
result.write(imports[i]);
result.write(';');
result.newline();
}
if (imports != null && imports.length > 0) {
result.newline();
}
// classes
JavaClass[] classes = getClasses();
for (int i = 0; i if (i > 0) result.newline();
classes[i].write(result);
}
return result.toString();
}