com.xdev.jadoth.codegen.java.codeobjects.JavaImportDefinition Maven / Gradle / Ivy
/*
* XDEV Application Framework - XDEV Application Framework
* Copyright © 2003 XDEV Software (https://xdev.software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*/
package com.xdev.jadoth.codegen.java.codeobjects;
import java.lang.reflect.Type;
import com.xdev.jadoth.codegen.java.Java;
/**
* @author Thomas Muenz
*
*/
public interface JavaImportDefinition extends JavaCompilationUnitMember, JavaKeywordOwner
{
public JavaTypeDescription getImportedType();
public class Implementation extends JavaCompilationObject.Implementation implements JavaImportDefinition
{
///////////////////////////////////////////////////////////////////////////
// instance fields //
/////////////////////
private final JavaTypeDescription importedType;
private JavaCompilationUnit owner;
///////////////////////////////////////////////////////////////////////////
// constructors //
/////////////////////
Implementation(final JavaTypeDescription importedType)
{
super(null);
this.importedType = importedType;
}
Implementation(final Type type)
{
this(JavaTypeDescription.Implementation.wrap(type));
}
///////////////////////////////////////////////////////////////////////////
// override methods //
/////////////////////
/**
* @return
* @see com.xdev.jadoth.codegen.java.codeobjects.JavaImportDefinition#getImportedType()
*/
@Override
public JavaTypeDescription getImportedType()
{
return this.importedType;
}
/**
* @return
* @see com.xdev.jadoth.codegen.java.codeobjects.JavaCompilationUnitMember#getOwnerCompilationUnit()
*/
@Override
public JavaCompilationUnit getOwnerCompilationUnit()
{
return this.owner;
}
/**
* @param compilationUnit
* @return
* @see com.xdev.jadoth.codegen.java.codeobjects.JavaCompilationUnitMember#registerAtOwner(JavaCompilationUnit)
*/
@Override
public JavaCompilationUnitMember registerAtOwner(final JavaCompilationUnit compilationUnit)
{
compilationUnit.add(this);
return this;
}
/**
* @param owner
* @see com.xdev.jadoth.codegen.java.codeobjects.JavaCompilationUnitMember#setOwner(JavaCompilationUnit)
*/
@Override
public void setOwner(final JavaCompilationUnit owner)
{
this.owner = owner;
}
/**
* @param codeGenerator
* @see com.xdev.jadoth.codegen.java.codeobjects.JavaCodeAssembable#assemble(StringBuilder, com.xdev.jadoth.codegen.java.codeobjects.JavaCodeGenerator)
*/
@Override
public void assemble(final StringBuilder sb, final JavaCodeGenerator codeGenerator)
{
codeGenerator.assembleJavaImportDefinition(sb, this);
}
/**
* @return
* @see com.xdev.jadoth.util.strings.Named#getName()
*/
@Override
public String getName()
{
return Java.Lang.$import;
}
/**
* @return
* @see com.xdev.jadoth.codegen.java.codeobjects.JavaCompilationUnitMember#getAssociatedComment()
*/
@Override
public JavaCommentBlock getAssociatedComment()
{
return null;
}
/**
* @return
* @see com.xdev.jadoth.codegen.java.codeobjects.JavaCompilationUnitMember#getJavaDoc()
*/
@Override
public JavaDocBlock getJavaDoc()
{
return null;
}
/**
* @return
* @see com.xdev.jadoth.codegen.java.codeobjects.JavaKeywordOwner#getKeyword()
*/
@Override
public String getKeyword()
{
return Java.Lang.$import;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy