Search in sources :

Example 11 with Interface

use of org.mybatis.generator.api.dom.java.Interface in project generator by mybatis.

the class GeneratedJavaFileTest method testGenericInterface.

@Test
public void testGenericInterface() {
    FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType("org.mybatis.test.TestInterface");
    fqjt.addTypeArgument(new FullyQualifiedJavaType("T"));
    Interface ifc = new Interface(fqjt);
    JavaFormatter jf = new DefaultJavaFormatter();
    GeneratedJavaFile gjf = new GeneratedJavaFile(ifc, "src", jf);
    assertEquals("TestInterface.java", gjf.getFileName());
    assertEquals("org.mybatis.test", gjf.getTargetPackage());
}
Also used : DefaultJavaFormatter(org.mybatis.generator.api.dom.DefaultJavaFormatter) DefaultJavaFormatter(org.mybatis.generator.api.dom.DefaultJavaFormatter) FullyQualifiedJavaType(org.mybatis.generator.api.dom.java.FullyQualifiedJavaType) Interface(org.mybatis.generator.api.dom.java.Interface) Test(org.junit.Test)

Example 12 with Interface

use of org.mybatis.generator.api.dom.java.Interface in project generator by mybatis.

the class GeneratedJavaFileTest method testReqularInterface.

@Test
public void testReqularInterface() {
    FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType("org.mybatis.test.TestInterface");
    Interface ifc = new Interface(fqjt);
    JavaFormatter jf = new DefaultJavaFormatter();
    GeneratedJavaFile gjf = new GeneratedJavaFile(ifc, "src", jf);
    assertEquals("TestInterface.java", gjf.getFileName());
    assertEquals("org.mybatis.test", gjf.getTargetPackage());
}
Also used : DefaultJavaFormatter(org.mybatis.generator.api.dom.DefaultJavaFormatter) DefaultJavaFormatter(org.mybatis.generator.api.dom.DefaultJavaFormatter) FullyQualifiedJavaType(org.mybatis.generator.api.dom.java.FullyQualifiedJavaType) Interface(org.mybatis.generator.api.dom.java.Interface) Test(org.junit.Test)

Example 13 with Interface

use of org.mybatis.generator.api.dom.java.Interface in project generator by mybatis.

the class SimpleInterfaceGenerator method generateInterface.

private Interface generateInterface() {
    FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType(BASE_PACKAGE + ".sub1.SimpleInterface");
    Interface interfaze = new Interface(fqjt);
    interfaze.setVisibility(JavaVisibility.PUBLIC);
    return interfaze;
}
Also used : FullyQualifiedJavaType(org.mybatis.generator.api.dom.java.FullyQualifiedJavaType) Interface(org.mybatis.generator.api.dom.java.Interface)

Aggregations

Interface (org.mybatis.generator.api.dom.java.Interface)13 FullyQualifiedJavaType (org.mybatis.generator.api.dom.java.FullyQualifiedJavaType)10 ArrayList (java.util.ArrayList)5 CompilationUnit (org.mybatis.generator.api.dom.java.CompilationUnit)5 Messages.getString (org.mybatis.generator.internal.util.messages.Messages.getString)3 Test (org.junit.Test)2 CommentGenerator (org.mybatis.generator.api.CommentGenerator)2 DefaultJavaFormatter (org.mybatis.generator.api.dom.DefaultJavaFormatter)2 Method (org.mybatis.generator.api.dom.java.Method)2 Parameter (org.mybatis.generator.api.dom.java.Parameter)2 TopLevelClass (org.mybatis.generator.api.dom.java.TopLevelClass)2 FullyQualifiedTable (org.mybatis.generator.api.FullyQualifiedTable)1