mybatis / mybatipse

Eclipse plugin adding support for MyBatis SQL Mapper Framework.
Eclipse Public License 1.0
332 stars 91 forks source link

Support a code assist on Groovy language #56

Open kazuki43zoo opened 8 years ago

kazuki43zoo commented 8 years ago

I hope to support a code assist on Groovy language!! I will prefer to create a mapper interface using groovy language. Groovy language is more readable on annotation.

e.g.)

package com.example.mapper

import com.example.domain.Todo
import org.apache.ibatis.annotations.Insert
import org.apache.ibatis.annotations.Mapper
import org.apache.ibatis.annotations.Options
import org.apache.ibatis.annotations.Select

@Mapper
interface TodoMapper {

    @Insert('''
        INSERT INTO todo
            (title, details, finished)
        VALUES
            (#{title}, #{details}, #{finished})
    ''')
    @Options(useGeneratedKeys = true)
    void insert(Todo todo);

    @Select('''
        SELECT
            id, title, details, finished
        FROM
            todo
        WHERE
            id = #{id}
    ''')
    Todo select(int id);

}

For Demo application, please see here.

What do you think ?

harawata commented 8 years ago

It seemed to be possible because groovy-eclipse plugin provides an extension point for this enhancement. But it turned out that there is no annotation information attached to the Java model provided by the plugin.

There is even a test case ensuring this behavior. The comment of the test case reads:

Only marker annotations or SingleMember annotations whose member is a class literal are copied over.

Does anyone know why?