Search in sources :

Example 51 with FullyQualifiedJavaType

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

the class MapperAnnotationPlugin method clientGenerated.

@Override
public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
    interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Mapper"));
    interfaze.addAnnotation("@Mapper");
    return true;
}
Also used : FullyQualifiedJavaType(org.mybatis.generator.api.dom.java.FullyQualifiedJavaType)

Example 52 with FullyQualifiedJavaType

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

the class FullyQualifiedJavaTypeTest method testStringArray.

@Test
public void testStringArray() {
    FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType("java.lang.String[]");
    assertFalse(fqjt.isPrimitive());
    assertTrue(fqjt.isArray());
}
Also used : FullyQualifiedJavaType(org.mybatis.generator.api.dom.java.FullyQualifiedJavaType) Test(org.junit.Test)

Example 53 with FullyQualifiedJavaType

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

the class FullyQualifiedJavaTypeTest method testSimpleType2.

@Test
public void testSimpleType2() {
    FullyQualifiedJavaType fqjt = //$NON-NLS-1$
    new FullyQualifiedJavaType("com.foo.bar");
    assertTrue(fqjt.isExplicitlyImported());
    //$NON-NLS-1$
    assertEquals("bar", fqjt.getShortName());
    //$NON-NLS-1$
    assertEquals("com.foo.bar", fqjt.getFullyQualifiedName());
    //$NON-NLS-1$
    assertEquals("com.foo", fqjt.getPackageName());
    assertEquals(1, fqjt.getImportList().size());
    assertEquals("com.foo.bar", fqjt.getImportList().get(0));
}
Also used : FullyQualifiedJavaType(org.mybatis.generator.api.dom.java.FullyQualifiedJavaType) Test(org.junit.Test)

Example 54 with FullyQualifiedJavaType

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

the class FullyQualifiedJavaTypeTest method testByteArray2.

@Test
public void testByteArray2() {
    FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType("byte[ ]");
    assertFalse(fqjt.isPrimitive());
    assertTrue(fqjt.isArray());
}
Also used : FullyQualifiedJavaType(org.mybatis.generator.api.dom.java.FullyQualifiedJavaType) Test(org.junit.Test)

Example 55 with FullyQualifiedJavaType

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

the class FullyQualifiedJavaTypeTest method testWildcardType1.

@Test
public void testWildcardType1() {
    FullyQualifiedJavaType fqjt = new FullyQualifiedJavaType("java.util.Map<java.lang.String, ? extends com.foo.Bar>");
    assertTrue(fqjt.isExplicitlyImported());
    //$NON-NLS-1$
    assertEquals("Map<String, ? extends Bar>", fqjt.getShortName());
    //$NON-NLS-1$
    assertEquals("java.util.Map<java.lang.String, ? extends com.foo.Bar>", fqjt.getFullyQualifiedName());
    //$NON-NLS-1$
    assertEquals("java.util", fqjt.getPackageName());
    assertEquals(2, fqjt.getImportList().size());
    //$NON-NLS-1$
    assertEquals("java.util.Map", fqjt.getFullyQualifiedNameWithoutTypeParameters());
}
Also used : FullyQualifiedJavaType(org.mybatis.generator.api.dom.java.FullyQualifiedJavaType) Test(org.junit.Test)

Aggregations

FullyQualifiedJavaType (org.mybatis.generator.api.dom.java.FullyQualifiedJavaType)163 Method (org.mybatis.generator.api.dom.java.Method)97 Parameter (org.mybatis.generator.api.dom.java.Parameter)54 TreeSet (java.util.TreeSet)53 IntrospectedColumn (org.mybatis.generator.api.IntrospectedColumn)32 Test (org.junit.Test)24 ArrayList (java.util.ArrayList)19 Field (org.mybatis.generator.api.dom.java.Field)19 TopLevelClass (org.mybatis.generator.api.dom.java.TopLevelClass)19 Messages.getString (org.mybatis.generator.internal.util.messages.Messages.getString)14 CommentGenerator (org.mybatis.generator.api.CommentGenerator)11 CompilationUnit (org.mybatis.generator.api.dom.java.CompilationUnit)11 Interface (org.mybatis.generator.api.dom.java.Interface)10 FullyQualifiedTable (org.mybatis.generator.api.FullyQualifiedTable)7 GeneratedKey (org.mybatis.generator.config.GeneratedKey)7 Plugin (org.mybatis.generator.api.Plugin)5 Attribute (org.mybatis.generator.api.dom.xml.Attribute)5 TextElement (org.mybatis.generator.api.dom.xml.TextElement)5 XmlElement (org.mybatis.generator.api.dom.xml.XmlElement)5 JavaBeansUtil.getJavaBeansField (org.mybatis.generator.internal.util.JavaBeansUtil.getJavaBeansField)5