@@ -0,0 +1,2128 @@
+package org.egc.cybersolim.mybatis;%0A%0Aimport org.apache.ibatis.type.BaseTypeHandler;%0Aimport org.apache.ibatis.type.JdbcType;%0Aimport org.postgresql.util.PGobject;%0A%0Aimport java.net.InetAddress;%0Aimport java.net.UnknownHostException;%0Aimport java.sql.CallableStatement;%0Aimport java.sql.PreparedStatement;%0Aimport java.sql.ResultSet;%0Aimport java.sql.SQLException;%0A%0A/**%0A * Postgresql inet %3C=%3E java InetAddress in mybatis%0A *%0A * @author houzhiwei%0A * @date 2017/2/14 14:15%0A */%0Apublic class InetTypeHandler extends BaseTypeHandler%3CInetAddress%3E%0A%7B%0A    @Override%0A    public void setNonNullParameter(PreparedStatement ps, int i, InetAddress parameter, JdbcType jdbcType) throws SQLException%0A    %7B%0A        PGobject object = new PGobject();%0A//        %E7%94%A8parameter.getAddress() %E5%BE%97%E5%88%B0%E7%9A%84IP%E5%9C%B0%E5%9D%80%E5%89%8D%E9%9D%A2%E4%BC%9A%E6%9C%89/%0A        object.setValue(parameter.getHostAddress());%0A        object.setType(%22inet%22);%0A        ps.setObject(i, object);%0A    %7D%0A%0A    @Override%0A    public InetAddress getNullableResult(ResultSet rs, String columnName) throws SQLException%0A    %7B%0A        String v = rs.getString(columnName);%0A        InetAddress address = toInetAddress(v);%0A        if (rs.wasNull()) %7B%0A            return null;%0A        %7D else %7B%0A            return address;%0A        %7D%0A    %7D%0A%0A    @Override%0A    public InetAddress getNullableResult(ResultSet rs, int columnIndex) throws SQLException%0A    %7B%0A        String v = rs.getString(columnIndex);%0A        InetAddress address = toInetAddress(v);%0A        if (rs.wasNull()) %7B%0A            return null;%0A        %7D else %7B%0A            return address;%0A        %7D%0A    %7D%0A%0A    @Override%0A    public InetAddress getNullableResult(CallableStatement cs, int columnIndex) throws SQLException%0A    %7B%0A        String v = cs.getString(columnIndex);%0A        InetAddress address = toInetAddress(v);%0A        if (cs.wasNull()) %7B%0A            return null;%0A        %7D else %7B%0A            return address;%0A        %7D%0A    %7D%0A%0A    private InetAddress toInetAddress(String v)%0A    %7B%0A        InetAddress address = null;%0A        try %7B%0A            address = InetAddress.getByName(v);%0A        %7D catch (UnknownHostException e) %7B%0A            return null;%0A        %7D%0A        return address;%0A    %7D%0A%7D%0A

Create InetTypeHandler.java