target
stringlengths 20
113k
| src_fm
stringlengths 11
86.3k
| src_fm_fc
stringlengths 21
86.4k
| src_fm_fc_co
stringlengths 30
86.4k
| src_fm_fc_ms
stringlengths 42
86.8k
| src_fm_fc_ms_ff
stringlengths 43
86.8k
|
---|---|---|---|---|---|
@Test public void testTransactionWithinTransaction() throws Exception { if (connectionSource == null) { return; } final TransactionManager mgr = new TransactionManager(connectionSource); final Dao<Foo, Integer> dao = createDao(Foo.class, true); mgr.callInTransaction(new Callable<Void>() { @Override public Void call() throws Exception { testTransactionManager(mgr, null, dao); return null; } }); }
|
public <T> T callInTransaction(final Callable<T> callable) throws SQLException { return callInTransaction(connectionSource, callable); }
|
TransactionManager { public <T> T callInTransaction(final Callable<T> callable) throws SQLException { return callInTransaction(connectionSource, callable); } }
|
TransactionManager { public <T> T callInTransaction(final Callable<T> callable) throws SQLException { return callInTransaction(connectionSource, callable); } TransactionManager(); TransactionManager(ConnectionSource connectionSource); }
|
TransactionManager { public <T> T callInTransaction(final Callable<T> callable) throws SQLException { return callInTransaction(connectionSource, callable); } TransactionManager(); TransactionManager(ConnectionSource connectionSource); void initialize(); T callInTransaction(final Callable<T> callable); T callInTransaction(String tableName, final Callable<T> callable); static T callInTransaction(final ConnectionSource connectionSource, final Callable<T> callable); static T callInTransaction(String tableName, final ConnectionSource connectionSource,
final Callable<T> callable); static T callInTransaction(final DatabaseConnection connection, final DatabaseType databaseType,
final Callable<T> callable); static T callInTransaction(final DatabaseConnection connection, boolean saved,
final DatabaseType databaseType, final Callable<T> callable); void setConnectionSource(ConnectionSource connectionSource); }
|
TransactionManager { public <T> T callInTransaction(final Callable<T> callable) throws SQLException { return callInTransaction(connectionSource, callable); } TransactionManager(); TransactionManager(ConnectionSource connectionSource); void initialize(); T callInTransaction(final Callable<T> callable); T callInTransaction(String tableName, final Callable<T> callable); static T callInTransaction(final ConnectionSource connectionSource, final Callable<T> callable); static T callInTransaction(String tableName, final ConnectionSource connectionSource,
final Callable<T> callable); static T callInTransaction(final DatabaseConnection connection, final DatabaseType databaseType,
final Callable<T> callable); static T callInTransaction(final DatabaseConnection connection, boolean saved,
final DatabaseType databaseType, final Callable<T> callable); void setConnectionSource(ConnectionSource connectionSource); }
|
@Test public void testTransactionWithinTransactionFails() throws Exception { if (connectionSource == null) { return; } final TransactionManager mgr = new TransactionManager(connectionSource); final Dao<Foo, Integer> dao = createDao(Foo.class, true); try { mgr.callInTransaction(new Callable<Void>() { @Override public Void call() throws Exception { dao.create(new Foo()); mgr.callInTransaction(new Callable<Void>() { @Override public Void call() throws Exception { dao.create(new Foo()); throw new SQLException("Exception ahoy!"); } }); return null; } }); fail("Should have thrown"); } catch (SQLException se) { } List<Foo> results = dao.queryForAll(); assertNotNull(results); assertEquals(0, results.size()); }
|
public <T> T callInTransaction(final Callable<T> callable) throws SQLException { return callInTransaction(connectionSource, callable); }
|
TransactionManager { public <T> T callInTransaction(final Callable<T> callable) throws SQLException { return callInTransaction(connectionSource, callable); } }
|
TransactionManager { public <T> T callInTransaction(final Callable<T> callable) throws SQLException { return callInTransaction(connectionSource, callable); } TransactionManager(); TransactionManager(ConnectionSource connectionSource); }
|
TransactionManager { public <T> T callInTransaction(final Callable<T> callable) throws SQLException { return callInTransaction(connectionSource, callable); } TransactionManager(); TransactionManager(ConnectionSource connectionSource); void initialize(); T callInTransaction(final Callable<T> callable); T callInTransaction(String tableName, final Callable<T> callable); static T callInTransaction(final ConnectionSource connectionSource, final Callable<T> callable); static T callInTransaction(String tableName, final ConnectionSource connectionSource,
final Callable<T> callable); static T callInTransaction(final DatabaseConnection connection, final DatabaseType databaseType,
final Callable<T> callable); static T callInTransaction(final DatabaseConnection connection, boolean saved,
final DatabaseType databaseType, final Callable<T> callable); void setConnectionSource(ConnectionSource connectionSource); }
|
TransactionManager { public <T> T callInTransaction(final Callable<T> callable) throws SQLException { return callInTransaction(connectionSource, callable); } TransactionManager(); TransactionManager(ConnectionSource connectionSource); void initialize(); T callInTransaction(final Callable<T> callable); T callInTransaction(String tableName, final Callable<T> callable); static T callInTransaction(final ConnectionSource connectionSource, final Callable<T> callable); static T callInTransaction(String tableName, final ConnectionSource connectionSource,
final Callable<T> callable); static T callInTransaction(final DatabaseConnection connection, final DatabaseType databaseType,
final Callable<T> callable); static T callInTransaction(final DatabaseConnection connection, boolean saved,
final DatabaseType databaseType, final Callable<T> callable); void setConnectionSource(ConnectionSource connectionSource); }
|
@Test public void testException() { Throwable cause = new Throwable(); String msg = "hello"; SQLException e = SqlExceptionUtil.create(msg, cause); assertEquals(msg, e.getMessage()); assertEquals(cause, e.getCause()); }
|
public static SQLException create(String message, Throwable cause) { SQLException sqlException; if (cause instanceof SQLException) { sqlException = new SQLException(message, ((SQLException) cause).getSQLState()); } else { sqlException = new SQLException(message); } sqlException.initCause(cause); return sqlException; }
|
SqlExceptionUtil { public static SQLException create(String message, Throwable cause) { SQLException sqlException; if (cause instanceof SQLException) { sqlException = new SQLException(message, ((SQLException) cause).getSQLState()); } else { sqlException = new SQLException(message); } sqlException.initCause(cause); return sqlException; } }
|
SqlExceptionUtil { public static SQLException create(String message, Throwable cause) { SQLException sqlException; if (cause instanceof SQLException) { sqlException = new SQLException(message, ((SQLException) cause).getSQLState()); } else { sqlException = new SQLException(message); } sqlException.initCause(cause); return sqlException; } private SqlExceptionUtil(); }
|
SqlExceptionUtil { public static SQLException create(String message, Throwable cause) { SQLException sqlException; if (cause instanceof SQLException) { sqlException = new SQLException(message, ((SQLException) cause).getSQLState()); } else { sqlException = new SQLException(message); } sqlException.initCause(cause); return sqlException; } private SqlExceptionUtil(); static SQLException create(String message, Throwable cause); }
|
SqlExceptionUtil { public static SQLException create(String message, Throwable cause) { SQLException sqlException; if (cause instanceof SQLException) { sqlException = new SQLException(message, ((SQLException) cause).getSQLState()); } else { sqlException = new SQLException(message); } sqlException.initCause(cause); return sqlException; } private SqlExceptionUtil(); static SQLException create(String message, Throwable cause); }
|
@Test public void testExceptionWithSQLException() { String sqlReason = "sql exception message"; String sqlState = "sql exception state"; Throwable cause = new SQLException(sqlReason, sqlState); String msg = "hello"; SQLException e = SqlExceptionUtil.create(msg, cause); assertEquals(msg, e.getMessage()); assertEquals(sqlState, e.getSQLState()); assertEquals(cause, e.getCause()); }
|
public static SQLException create(String message, Throwable cause) { SQLException sqlException; if (cause instanceof SQLException) { sqlException = new SQLException(message, ((SQLException) cause).getSQLState()); } else { sqlException = new SQLException(message); } sqlException.initCause(cause); return sqlException; }
|
SqlExceptionUtil { public static SQLException create(String message, Throwable cause) { SQLException sqlException; if (cause instanceof SQLException) { sqlException = new SQLException(message, ((SQLException) cause).getSQLState()); } else { sqlException = new SQLException(message); } sqlException.initCause(cause); return sqlException; } }
|
SqlExceptionUtil { public static SQLException create(String message, Throwable cause) { SQLException sqlException; if (cause instanceof SQLException) { sqlException = new SQLException(message, ((SQLException) cause).getSQLState()); } else { sqlException = new SQLException(message); } sqlException.initCause(cause); return sqlException; } private SqlExceptionUtil(); }
|
SqlExceptionUtil { public static SQLException create(String message, Throwable cause) { SQLException sqlException; if (cause instanceof SQLException) { sqlException = new SQLException(message, ((SQLException) cause).getSQLState()); } else { sqlException = new SQLException(message); } sqlException.initCause(cause); return sqlException; } private SqlExceptionUtil(); static SQLException create(String message, Throwable cause); }
|
SqlExceptionUtil { public static SQLException create(String message, Throwable cause) { SQLException sqlException; if (cause instanceof SQLException) { sqlException = new SQLException(message, ((SQLException) cause).getSQLState()); } else { sqlException = new SQLException(message); } sqlException.initCause(cause); return sqlException; } private SqlExceptionUtil(); static SQLException create(String message, Throwable cause); }
|
@Test public void testCreate() throws Exception { Dao<One, Integer> dao = createDao(One.class, true); One one = new One(); String stuff = "fewpfjewfew"; one.stuff = stuff; one.setDao(dao); assertEquals(1, one.create()); }
|
public int create() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.create(t); }
|
BaseDaoEnabled { public int create() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.create(t); } }
|
BaseDaoEnabled { public int create() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.create(t); } }
|
BaseDaoEnabled { public int create() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.create(t); } int create(); int refresh(); int update(); int updateId(ID newId); int delete(); String objectToString(); ID extractId(); boolean objectsEqual(T other); void setDao(Dao<T, ID> dao); Dao<T, ID> getDao(); }
|
BaseDaoEnabled { public int create() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.create(t); } int create(); int refresh(); int update(); int updateId(ID newId); int delete(); String objectToString(); ID extractId(); boolean objectsEqual(T other); void setDao(Dao<T, ID> dao); Dao<T, ID> getDao(); }
|
@Test(expected = SQLException.class) public void testCreateNoDao() throws Exception { One one = new One(); String stuff = "fewpfjewfew"; one.stuff = stuff; one.create(); }
|
public int create() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.create(t); }
|
BaseDaoEnabled { public int create() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.create(t); } }
|
BaseDaoEnabled { public int create() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.create(t); } }
|
BaseDaoEnabled { public int create() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.create(t); } int create(); int refresh(); int update(); int updateId(ID newId); int delete(); String objectToString(); ID extractId(); boolean objectsEqual(T other); void setDao(Dao<T, ID> dao); Dao<T, ID> getDao(); }
|
BaseDaoEnabled { public int create() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.create(t); } int create(); int refresh(); int update(); int updateId(ID newId); int delete(); String objectToString(); ID extractId(); boolean objectsEqual(T other); void setDao(Dao<T, ID> dao); Dao<T, ID> getDao(); }
|
@Test public void testStringLiteral() throws Exception { String sql = "select #if (:1 == 'hello') ok #end"; ASTRootNode n = new Parser(sql).parse().init(); ParameterContext ctx = getParameterContext(Lists.newArrayList((Type) String.class)); n.checkAndBind(ctx); InvocationContext context = DefaultInvocationContext.create(); context.addParameter("1", "hello"); n.render(context); BoundSql boundSql = context.getBoundSql(); assertThat(boundSql.getSql(), Matchers.equalTo("select ok ")); }
|
final public void StringLiteral() throws ParseException { ASTStringLiteral jjtn000 = new ASTStringLiteral(JJTSTRINGLITERAL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1));Token t; try { t = jj_consume_token(STRING_LITERAL); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); jjtn000.init(t.image); } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } }
|
Parser implements ParserTreeConstants, ParserConstants { final public void StringLiteral() throws ParseException { ASTStringLiteral jjtn000 = new ASTStringLiteral(JJTSTRINGLITERAL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1));Token t; try { t = jj_consume_token(STRING_LITERAL); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); jjtn000.init(t.image); } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } } }
|
Parser implements ParserTreeConstants, ParserConstants { final public void StringLiteral() throws ParseException { ASTStringLiteral jjtn000 = new ASTStringLiteral(JJTSTRINGLITERAL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1));Token t; try { t = jj_consume_token(STRING_LITERAL); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); jjtn000.init(t.image); } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); }
|
Parser implements ParserTreeConstants, ParserConstants { final public void StringLiteral() throws ParseException { ASTStringLiteral jjtn000 = new ASTStringLiteral(JJTSTRINGLITERAL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1));Token t; try { t = jj_consume_token(STRING_LITERAL); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); jjtn000.init(t.image); } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); final ASTRootNode parse(); final void DML(); final void Insert(); final void Delete(); final void Update(); final void Select(); final void Replace(); final void Merge(); final void Truncate(); final void Statement(); final void JDBCParameter(); final void JDBCIterableParameter(); final void GlobalTable(); final void JoinParameter(); final void QuoteText(); final void Text(); final void Blank(); final void IfStatement(); final void ElseStatement(); final void ElseIfStatement(); final void Expression(); final void ConditionalOrExpression(); final void ConditionalAndExpression(); final void RelationalExpression(); final void UnaryExpression(); final void PrimaryExpression(); final void ExpressionParameter(); final void IntegerLiteral(); final void StringLiteral(); final void True(); final void False(); final void Null(); void ReInit(java.io.InputStream stream); void ReInit(java.io.InputStream stream, String encoding); void ReInit(Reader stream); void ReInit(ParserTokenManager tm); final Token getNextToken(); final Token getToken(int index); ParseException generateParseException(); final void enable_tracing(); final void disable_tracing(); }
|
Parser implements ParserTreeConstants, ParserConstants { final public void StringLiteral() throws ParseException { ASTStringLiteral jjtn000 = new ASTStringLiteral(JJTSTRINGLITERAL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1));Token t; try { t = jj_consume_token(STRING_LITERAL); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); jjtn000.init(t.image); } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); final ASTRootNode parse(); final void DML(); final void Insert(); final void Delete(); final void Update(); final void Select(); final void Replace(); final void Merge(); final void Truncate(); final void Statement(); final void JDBCParameter(); final void JDBCIterableParameter(); final void GlobalTable(); final void JoinParameter(); final void QuoteText(); final void Text(); final void Blank(); final void IfStatement(); final void ElseStatement(); final void ElseIfStatement(); final void Expression(); final void ConditionalOrExpression(); final void ConditionalAndExpression(); final void RelationalExpression(); final void UnaryExpression(); final void PrimaryExpression(); final void ExpressionParameter(); final void IntegerLiteral(); final void StringLiteral(); final void True(); final void False(); final void Null(); void ReInit(java.io.InputStream stream); void ReInit(java.io.InputStream stream, String encoding); void ReInit(Reader stream); void ReInit(ParserTokenManager tm); final Token getNextToken(); final Token getToken(int index); ParseException generateParseException(); final void enable_tracing(); final void disable_tracing(); public ParserTokenManager token_source; public Token token; public Token jj_nt; }
|
@Test public void testUpdate() throws Exception { Dao<One, Integer> dao = createDao(One.class, true); One one = new One(); String stuff1 = "fewpfjewfew"; one.stuff = stuff1; assertEquals(1, dao.create(one)); String stuff2 = "fjpfejpwewpfjewfew"; one.stuff = stuff2; assertEquals(1, one.update()); One one2 = dao.queryForId(one.id); assertEquals(stuff2, one2.stuff); }
|
public int update() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.update(t); }
|
BaseDaoEnabled { public int update() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.update(t); } }
|
BaseDaoEnabled { public int update() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.update(t); } }
|
BaseDaoEnabled { public int update() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.update(t); } int create(); int refresh(); int update(); int updateId(ID newId); int delete(); String objectToString(); ID extractId(); boolean objectsEqual(T other); void setDao(Dao<T, ID> dao); Dao<T, ID> getDao(); }
|
BaseDaoEnabled { public int update() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.update(t); } int create(); int refresh(); int update(); int updateId(ID newId); int delete(); String objectToString(); ID extractId(); boolean objectsEqual(T other); void setDao(Dao<T, ID> dao); Dao<T, ID> getDao(); }
|
@Test public void testUpdateId() throws Exception { Dao<One, Integer> dao = createDao(One.class, true); One one = new One(); String stuff1 = "fewpfjewfew"; one.stuff = stuff1; assertEquals(1, dao.create(one)); int id = one.id; assertNotNull(dao.queryForId(id)); assertEquals(1, one.updateId(id + 1)); assertNull(dao.queryForId(id)); assertNotNull(dao.queryForId(id + 1)); }
|
public int updateId(ID newId) throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.updateId(t, newId); }
|
BaseDaoEnabled { public int updateId(ID newId) throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.updateId(t, newId); } }
|
BaseDaoEnabled { public int updateId(ID newId) throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.updateId(t, newId); } }
|
BaseDaoEnabled { public int updateId(ID newId) throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.updateId(t, newId); } int create(); int refresh(); int update(); int updateId(ID newId); int delete(); String objectToString(); ID extractId(); boolean objectsEqual(T other); void setDao(Dao<T, ID> dao); Dao<T, ID> getDao(); }
|
BaseDaoEnabled { public int updateId(ID newId) throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.updateId(t, newId); } int create(); int refresh(); int update(); int updateId(ID newId); int delete(); String objectToString(); ID extractId(); boolean objectsEqual(T other); void setDao(Dao<T, ID> dao); Dao<T, ID> getDao(); }
|
@Test public void testDelete() throws Exception { Dao<One, Integer> dao = createDao(One.class, true); One one = new One(); String stuff1 = "fewpfjewfew"; one.stuff = stuff1; assertEquals(1, dao.create(one)); assertNotNull(dao.queryForId(one.id)); assertEquals(1, one.delete()); assertNull(dao.queryForId(one.id)); }
|
public int delete() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.delete(t); }
|
BaseDaoEnabled { public int delete() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.delete(t); } }
|
BaseDaoEnabled { public int delete() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.delete(t); } }
|
BaseDaoEnabled { public int delete() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.delete(t); } int create(); int refresh(); int update(); int updateId(ID newId); int delete(); String objectToString(); ID extractId(); boolean objectsEqual(T other); void setDao(Dao<T, ID> dao); Dao<T, ID> getDao(); }
|
BaseDaoEnabled { public int delete() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.delete(t); } int create(); int refresh(); int update(); int updateId(ID newId); int delete(); String objectToString(); ID extractId(); boolean objectsEqual(T other); void setDao(Dao<T, ID> dao); Dao<T, ID> getDao(); }
|
@Test(expected = IllegalArgumentException.class) public void testObjectEqualsNoDao() { One one = new One(); String stuff1 = "fewpfjewfew"; one.stuff = stuff1; one.objectToString(); }
|
public String objectToString() { try { checkForDao(); } catch (SQLException e) { throw new IllegalArgumentException(e); } @SuppressWarnings("unchecked") T t = (T) this; return dao.objectToString(t); }
|
BaseDaoEnabled { public String objectToString() { try { checkForDao(); } catch (SQLException e) { throw new IllegalArgumentException(e); } @SuppressWarnings("unchecked") T t = (T) this; return dao.objectToString(t); } }
|
BaseDaoEnabled { public String objectToString() { try { checkForDao(); } catch (SQLException e) { throw new IllegalArgumentException(e); } @SuppressWarnings("unchecked") T t = (T) this; return dao.objectToString(t); } }
|
BaseDaoEnabled { public String objectToString() { try { checkForDao(); } catch (SQLException e) { throw new IllegalArgumentException(e); } @SuppressWarnings("unchecked") T t = (T) this; return dao.objectToString(t); } int create(); int refresh(); int update(); int updateId(ID newId); int delete(); String objectToString(); ID extractId(); boolean objectsEqual(T other); void setDao(Dao<T, ID> dao); Dao<T, ID> getDao(); }
|
BaseDaoEnabled { public String objectToString() { try { checkForDao(); } catch (SQLException e) { throw new IllegalArgumentException(e); } @SuppressWarnings("unchecked") T t = (T) this; return dao.objectToString(t); } int create(); int refresh(); int update(); int updateId(ID newId); int delete(); String objectToString(); ID extractId(); boolean objectsEqual(T other); void setDao(Dao<T, ID> dao); Dao<T, ID> getDao(); }
|
@Test public void testExtractId() throws Exception { Dao<One, Integer> dao = createDao(One.class, true); One one = new One(); String stuff1 = "fewpfjewfew"; one.stuff = stuff1; assertEquals(1, dao.create(one)); assertEquals(one.id, (int) one.extractId()); }
|
public ID extractId() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.extractId(t); }
|
BaseDaoEnabled { public ID extractId() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.extractId(t); } }
|
BaseDaoEnabled { public ID extractId() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.extractId(t); } }
|
BaseDaoEnabled { public ID extractId() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.extractId(t); } int create(); int refresh(); int update(); int updateId(ID newId); int delete(); String objectToString(); ID extractId(); boolean objectsEqual(T other); void setDao(Dao<T, ID> dao); Dao<T, ID> getDao(); }
|
BaseDaoEnabled { public ID extractId() throws SQLException { checkForDao(); @SuppressWarnings("unchecked") T t = (T) this; return dao.extractId(t); } int create(); int refresh(); int update(); int updateId(ID newId); int delete(); String objectToString(); ID extractId(); boolean objectsEqual(T other); void setDao(Dao<T, ID> dao); Dao<T, ID> getDao(); }
|
@Test public void testIsEnabled() { for (Level level : Level.values()) { reset(mockLog); expect(mockLog.isLevelEnabled(level)).andReturn(true); expect(mockLog.isLevelEnabled(level)).andReturn(false); replay(mockLog); assertTrue(logger.isLevelEnabled(level)); assertFalse(logger.isLevelEnabled(level)); verify(mockLog); } }
|
public boolean isLevelEnabled(Level level) { return log.isLevelEnabled(level); }
|
Logger { public boolean isLevelEnabled(Level level) { return log.isLevelEnabled(level); } }
|
Logger { public boolean isLevelEnabled(Level level) { return log.isLevelEnabled(level); } Logger(Log log); }
|
Logger { public boolean isLevelEnabled(Level level) { return log.isLevelEnabled(level); } Logger(Log log); boolean isLevelEnabled(Level level); void trace(String msg); void trace(String msg, Object arg0); void trace(String msg, Object arg0, Object arg1); void trace(String msg, Object arg0, Object arg1, Object arg2); void trace(String msg, Object[] argArray); void trace(Throwable throwable, String msg); void trace(Throwable throwable, String msg, Object arg0); void trace(Throwable throwable, String msg, Object arg0, Object arg1); void trace(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void trace(Throwable throwable, String msg, Object[] argArray); void debug(String msg); void debug(String msg, Object arg0); void debug(String msg, Object arg0, Object arg1); void debug(String msg, Object arg0, Object arg1, Object arg2); void debug(String msg, Object[] argArray); void debug(Throwable throwable, String msg); void debug(Throwable throwable, String msg, Object arg0); void debug(Throwable throwable, String msg, Object arg0, Object arg1); void debug(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void debug(Throwable throwable, String msg, Object[] argArray); void info(String msg); void info(String msg, Object arg0); void info(String msg, Object arg0, Object arg1); void info(String msg, Object arg0, Object arg1, Object arg2); void info(String msg, Object[] argArray); void info(Throwable throwable, String msg); void info(Throwable throwable, String msg, Object arg0); void info(Throwable throwable, String msg, Object arg0, Object arg1); void info(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void info(Throwable throwable, String msg, Object[] argArray); void warn(String msg); void warn(String msg, Object arg0); void warn(String msg, Object arg0, Object arg1); void warn(String msg, Object arg0, Object arg1, Object arg2); void warn(String msg, Object[] argArray); void warn(Throwable throwable, String msg); void warn(Throwable throwable, String msg, Object arg0); void warn(Throwable throwable, String msg, Object arg0, Object arg1); void warn(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void warn(Throwable throwable, String msg, Object[] argArray); void error(String msg); void error(String msg, Object arg0); void error(String msg, Object arg0, Object arg1); void error(String msg, Object arg0, Object arg1, Object arg2); void error(String msg, Object[] argArray); void error(Throwable throwable, String msg); void error(Throwable throwable, String msg, Object arg0); void error(Throwable throwable, String msg, Object arg0, Object arg1); void error(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void error(Throwable throwable, String msg, Object[] argArray); void fatal(String msg); void fatal(String msg, Object arg0); void fatal(String msg, Object arg0, Object arg1); void fatal(String msg, Object arg0, Object arg1, Object arg2); void fatal(String msg, Object[] argArray); void fatal(Throwable throwable, String msg); void fatal(Throwable throwable, String msg, Object arg0); void fatal(Throwable throwable, String msg, Object arg0, Object arg1); void fatal(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void fatal(Throwable throwable, String msg, Object[] argArray); void log(Level level, String msg); void log(Level level, String msg, Object arg0); void log(Level level, String msg, Object arg0, Object arg1); void log(Level level, String msg, Object arg0, Object arg1, Object arg2); void log(Level level, String msg, Object[] argArray); void log(Level level, Throwable throwable, String msg); void log(Level level, Throwable throwable, String msg, Object arg0); void log(Level level, Throwable throwable, String msg, Object arg0, Object arg1); void log(Level level, Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void log(Level level, Throwable throwable, String msg, Object[] argArray); }
|
Logger { public boolean isLevelEnabled(Level level) { return log.isLevelEnabled(level); } Logger(Log log); boolean isLevelEnabled(Level level); void trace(String msg); void trace(String msg, Object arg0); void trace(String msg, Object arg0, Object arg1); void trace(String msg, Object arg0, Object arg1, Object arg2); void trace(String msg, Object[] argArray); void trace(Throwable throwable, String msg); void trace(Throwable throwable, String msg, Object arg0); void trace(Throwable throwable, String msg, Object arg0, Object arg1); void trace(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void trace(Throwable throwable, String msg, Object[] argArray); void debug(String msg); void debug(String msg, Object arg0); void debug(String msg, Object arg0, Object arg1); void debug(String msg, Object arg0, Object arg1, Object arg2); void debug(String msg, Object[] argArray); void debug(Throwable throwable, String msg); void debug(Throwable throwable, String msg, Object arg0); void debug(Throwable throwable, String msg, Object arg0, Object arg1); void debug(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void debug(Throwable throwable, String msg, Object[] argArray); void info(String msg); void info(String msg, Object arg0); void info(String msg, Object arg0, Object arg1); void info(String msg, Object arg0, Object arg1, Object arg2); void info(String msg, Object[] argArray); void info(Throwable throwable, String msg); void info(Throwable throwable, String msg, Object arg0); void info(Throwable throwable, String msg, Object arg0, Object arg1); void info(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void info(Throwable throwable, String msg, Object[] argArray); void warn(String msg); void warn(String msg, Object arg0); void warn(String msg, Object arg0, Object arg1); void warn(String msg, Object arg0, Object arg1, Object arg2); void warn(String msg, Object[] argArray); void warn(Throwable throwable, String msg); void warn(Throwable throwable, String msg, Object arg0); void warn(Throwable throwable, String msg, Object arg0, Object arg1); void warn(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void warn(Throwable throwable, String msg, Object[] argArray); void error(String msg); void error(String msg, Object arg0); void error(String msg, Object arg0, Object arg1); void error(String msg, Object arg0, Object arg1, Object arg2); void error(String msg, Object[] argArray); void error(Throwable throwable, String msg); void error(Throwable throwable, String msg, Object arg0); void error(Throwable throwable, String msg, Object arg0, Object arg1); void error(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void error(Throwable throwable, String msg, Object[] argArray); void fatal(String msg); void fatal(String msg, Object arg0); void fatal(String msg, Object arg0, Object arg1); void fatal(String msg, Object arg0, Object arg1, Object arg2); void fatal(String msg, Object[] argArray); void fatal(Throwable throwable, String msg); void fatal(Throwable throwable, String msg, Object arg0); void fatal(Throwable throwable, String msg, Object arg0, Object arg1); void fatal(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void fatal(Throwable throwable, String msg, Object[] argArray); void log(Level level, String msg); void log(Level level, String msg, Object arg0); void log(Level level, String msg, Object arg0, Object arg1); void log(Level level, String msg, Object arg0, Object arg1, Object arg2); void log(Level level, String msg, Object[] argArray); void log(Level level, Throwable throwable, String msg); void log(Level level, Throwable throwable, String msg, Object arg0); void log(Level level, Throwable throwable, String msg, Object arg0, Object arg1); void log(Level level, Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void log(Level level, Throwable throwable, String msg, Object[] argArray); }
|
@Test public void testShouldNotCallToString() throws Exception { for (Level level : Level.values()) { Method method = Logger.class.getMethod(getNameFromLevel(level), String.class, Object.class); reset(mockLog); expect(mockLog.isLevelEnabled(level)).andReturn(false); replay(mockLog); method.invoke(logger, "msg {}", new ToStringThrow()); verify(mockLog); } }
|
public boolean isLevelEnabled(Level level) { return log.isLevelEnabled(level); }
|
Logger { public boolean isLevelEnabled(Level level) { return log.isLevelEnabled(level); } }
|
Logger { public boolean isLevelEnabled(Level level) { return log.isLevelEnabled(level); } Logger(Log log); }
|
Logger { public boolean isLevelEnabled(Level level) { return log.isLevelEnabled(level); } Logger(Log log); boolean isLevelEnabled(Level level); void trace(String msg); void trace(String msg, Object arg0); void trace(String msg, Object arg0, Object arg1); void trace(String msg, Object arg0, Object arg1, Object arg2); void trace(String msg, Object[] argArray); void trace(Throwable throwable, String msg); void trace(Throwable throwable, String msg, Object arg0); void trace(Throwable throwable, String msg, Object arg0, Object arg1); void trace(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void trace(Throwable throwable, String msg, Object[] argArray); void debug(String msg); void debug(String msg, Object arg0); void debug(String msg, Object arg0, Object arg1); void debug(String msg, Object arg0, Object arg1, Object arg2); void debug(String msg, Object[] argArray); void debug(Throwable throwable, String msg); void debug(Throwable throwable, String msg, Object arg0); void debug(Throwable throwable, String msg, Object arg0, Object arg1); void debug(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void debug(Throwable throwable, String msg, Object[] argArray); void info(String msg); void info(String msg, Object arg0); void info(String msg, Object arg0, Object arg1); void info(String msg, Object arg0, Object arg1, Object arg2); void info(String msg, Object[] argArray); void info(Throwable throwable, String msg); void info(Throwable throwable, String msg, Object arg0); void info(Throwable throwable, String msg, Object arg0, Object arg1); void info(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void info(Throwable throwable, String msg, Object[] argArray); void warn(String msg); void warn(String msg, Object arg0); void warn(String msg, Object arg0, Object arg1); void warn(String msg, Object arg0, Object arg1, Object arg2); void warn(String msg, Object[] argArray); void warn(Throwable throwable, String msg); void warn(Throwable throwable, String msg, Object arg0); void warn(Throwable throwable, String msg, Object arg0, Object arg1); void warn(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void warn(Throwable throwable, String msg, Object[] argArray); void error(String msg); void error(String msg, Object arg0); void error(String msg, Object arg0, Object arg1); void error(String msg, Object arg0, Object arg1, Object arg2); void error(String msg, Object[] argArray); void error(Throwable throwable, String msg); void error(Throwable throwable, String msg, Object arg0); void error(Throwable throwable, String msg, Object arg0, Object arg1); void error(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void error(Throwable throwable, String msg, Object[] argArray); void fatal(String msg); void fatal(String msg, Object arg0); void fatal(String msg, Object arg0, Object arg1); void fatal(String msg, Object arg0, Object arg1, Object arg2); void fatal(String msg, Object[] argArray); void fatal(Throwable throwable, String msg); void fatal(Throwable throwable, String msg, Object arg0); void fatal(Throwable throwable, String msg, Object arg0, Object arg1); void fatal(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void fatal(Throwable throwable, String msg, Object[] argArray); void log(Level level, String msg); void log(Level level, String msg, Object arg0); void log(Level level, String msg, Object arg0, Object arg1); void log(Level level, String msg, Object arg0, Object arg1, Object arg2); void log(Level level, String msg, Object[] argArray); void log(Level level, Throwable throwable, String msg); void log(Level level, Throwable throwable, String msg, Object arg0); void log(Level level, Throwable throwable, String msg, Object arg0, Object arg1); void log(Level level, Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void log(Level level, Throwable throwable, String msg, Object[] argArray); }
|
Logger { public boolean isLevelEnabled(Level level) { return log.isLevelEnabled(level); } Logger(Log log); boolean isLevelEnabled(Level level); void trace(String msg); void trace(String msg, Object arg0); void trace(String msg, Object arg0, Object arg1); void trace(String msg, Object arg0, Object arg1, Object arg2); void trace(String msg, Object[] argArray); void trace(Throwable throwable, String msg); void trace(Throwable throwable, String msg, Object arg0); void trace(Throwable throwable, String msg, Object arg0, Object arg1); void trace(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void trace(Throwable throwable, String msg, Object[] argArray); void debug(String msg); void debug(String msg, Object arg0); void debug(String msg, Object arg0, Object arg1); void debug(String msg, Object arg0, Object arg1, Object arg2); void debug(String msg, Object[] argArray); void debug(Throwable throwable, String msg); void debug(Throwable throwable, String msg, Object arg0); void debug(Throwable throwable, String msg, Object arg0, Object arg1); void debug(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void debug(Throwable throwable, String msg, Object[] argArray); void info(String msg); void info(String msg, Object arg0); void info(String msg, Object arg0, Object arg1); void info(String msg, Object arg0, Object arg1, Object arg2); void info(String msg, Object[] argArray); void info(Throwable throwable, String msg); void info(Throwable throwable, String msg, Object arg0); void info(Throwable throwable, String msg, Object arg0, Object arg1); void info(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void info(Throwable throwable, String msg, Object[] argArray); void warn(String msg); void warn(String msg, Object arg0); void warn(String msg, Object arg0, Object arg1); void warn(String msg, Object arg0, Object arg1, Object arg2); void warn(String msg, Object[] argArray); void warn(Throwable throwable, String msg); void warn(Throwable throwable, String msg, Object arg0); void warn(Throwable throwable, String msg, Object arg0, Object arg1); void warn(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void warn(Throwable throwable, String msg, Object[] argArray); void error(String msg); void error(String msg, Object arg0); void error(String msg, Object arg0, Object arg1); void error(String msg, Object arg0, Object arg1, Object arg2); void error(String msg, Object[] argArray); void error(Throwable throwable, String msg); void error(Throwable throwable, String msg, Object arg0); void error(Throwable throwable, String msg, Object arg0, Object arg1); void error(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void error(Throwable throwable, String msg, Object[] argArray); void fatal(String msg); void fatal(String msg, Object arg0); void fatal(String msg, Object arg0, Object arg1); void fatal(String msg, Object arg0, Object arg1, Object arg2); void fatal(String msg, Object[] argArray); void fatal(Throwable throwable, String msg); void fatal(Throwable throwable, String msg, Object arg0); void fatal(Throwable throwable, String msg, Object arg0, Object arg1); void fatal(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void fatal(Throwable throwable, String msg, Object[] argArray); void log(Level level, String msg); void log(Level level, String msg, Object arg0); void log(Level level, String msg, Object arg0, Object arg1); void log(Level level, String msg, Object arg0, Object arg1, Object arg2); void log(Level level, String msg, Object[] argArray); void log(Level level, Throwable throwable, String msg); void log(Level level, Throwable throwable, String msg, Object arg0); void log(Level level, Throwable throwable, String msg, Object arg0, Object arg1); void log(Level level, Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void log(Level level, Throwable throwable, String msg, Object[] argArray); }
|
@Test public void testShouldCallToString() throws Exception { for (Level level : Level.values()) { Method method = Logger.class.getMethod(getNameFromLevel(level), String.class, Object.class); reset(mockLog); expect(mockLog.isLevelEnabled(level)).andReturn(true); replay(mockLog); try { method.invoke(logger, "msg {}", new ToStringThrow()); fail("Should have thrown"); } catch (InvocationTargetException e) { assertTrue("should have thrown an IllegalStateException", e.getCause() instanceof IllegalStateException); } verify(mockLog); } }
|
public boolean isLevelEnabled(Level level) { return log.isLevelEnabled(level); }
|
Logger { public boolean isLevelEnabled(Level level) { return log.isLevelEnabled(level); } }
|
Logger { public boolean isLevelEnabled(Level level) { return log.isLevelEnabled(level); } Logger(Log log); }
|
Logger { public boolean isLevelEnabled(Level level) { return log.isLevelEnabled(level); } Logger(Log log); boolean isLevelEnabled(Level level); void trace(String msg); void trace(String msg, Object arg0); void trace(String msg, Object arg0, Object arg1); void trace(String msg, Object arg0, Object arg1, Object arg2); void trace(String msg, Object[] argArray); void trace(Throwable throwable, String msg); void trace(Throwable throwable, String msg, Object arg0); void trace(Throwable throwable, String msg, Object arg0, Object arg1); void trace(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void trace(Throwable throwable, String msg, Object[] argArray); void debug(String msg); void debug(String msg, Object arg0); void debug(String msg, Object arg0, Object arg1); void debug(String msg, Object arg0, Object arg1, Object arg2); void debug(String msg, Object[] argArray); void debug(Throwable throwable, String msg); void debug(Throwable throwable, String msg, Object arg0); void debug(Throwable throwable, String msg, Object arg0, Object arg1); void debug(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void debug(Throwable throwable, String msg, Object[] argArray); void info(String msg); void info(String msg, Object arg0); void info(String msg, Object arg0, Object arg1); void info(String msg, Object arg0, Object arg1, Object arg2); void info(String msg, Object[] argArray); void info(Throwable throwable, String msg); void info(Throwable throwable, String msg, Object arg0); void info(Throwable throwable, String msg, Object arg0, Object arg1); void info(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void info(Throwable throwable, String msg, Object[] argArray); void warn(String msg); void warn(String msg, Object arg0); void warn(String msg, Object arg0, Object arg1); void warn(String msg, Object arg0, Object arg1, Object arg2); void warn(String msg, Object[] argArray); void warn(Throwable throwable, String msg); void warn(Throwable throwable, String msg, Object arg0); void warn(Throwable throwable, String msg, Object arg0, Object arg1); void warn(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void warn(Throwable throwable, String msg, Object[] argArray); void error(String msg); void error(String msg, Object arg0); void error(String msg, Object arg0, Object arg1); void error(String msg, Object arg0, Object arg1, Object arg2); void error(String msg, Object[] argArray); void error(Throwable throwable, String msg); void error(Throwable throwable, String msg, Object arg0); void error(Throwable throwable, String msg, Object arg0, Object arg1); void error(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void error(Throwable throwable, String msg, Object[] argArray); void fatal(String msg); void fatal(String msg, Object arg0); void fatal(String msg, Object arg0, Object arg1); void fatal(String msg, Object arg0, Object arg1, Object arg2); void fatal(String msg, Object[] argArray); void fatal(Throwable throwable, String msg); void fatal(Throwable throwable, String msg, Object arg0); void fatal(Throwable throwable, String msg, Object arg0, Object arg1); void fatal(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void fatal(Throwable throwable, String msg, Object[] argArray); void log(Level level, String msg); void log(Level level, String msg, Object arg0); void log(Level level, String msg, Object arg0, Object arg1); void log(Level level, String msg, Object arg0, Object arg1, Object arg2); void log(Level level, String msg, Object[] argArray); void log(Level level, Throwable throwable, String msg); void log(Level level, Throwable throwable, String msg, Object arg0); void log(Level level, Throwable throwable, String msg, Object arg0, Object arg1); void log(Level level, Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void log(Level level, Throwable throwable, String msg, Object[] argArray); }
|
Logger { public boolean isLevelEnabled(Level level) { return log.isLevelEnabled(level); } Logger(Log log); boolean isLevelEnabled(Level level); void trace(String msg); void trace(String msg, Object arg0); void trace(String msg, Object arg0, Object arg1); void trace(String msg, Object arg0, Object arg1, Object arg2); void trace(String msg, Object[] argArray); void trace(Throwable throwable, String msg); void trace(Throwable throwable, String msg, Object arg0); void trace(Throwable throwable, String msg, Object arg0, Object arg1); void trace(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void trace(Throwable throwable, String msg, Object[] argArray); void debug(String msg); void debug(String msg, Object arg0); void debug(String msg, Object arg0, Object arg1); void debug(String msg, Object arg0, Object arg1, Object arg2); void debug(String msg, Object[] argArray); void debug(Throwable throwable, String msg); void debug(Throwable throwable, String msg, Object arg0); void debug(Throwable throwable, String msg, Object arg0, Object arg1); void debug(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void debug(Throwable throwable, String msg, Object[] argArray); void info(String msg); void info(String msg, Object arg0); void info(String msg, Object arg0, Object arg1); void info(String msg, Object arg0, Object arg1, Object arg2); void info(String msg, Object[] argArray); void info(Throwable throwable, String msg); void info(Throwable throwable, String msg, Object arg0); void info(Throwable throwable, String msg, Object arg0, Object arg1); void info(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void info(Throwable throwable, String msg, Object[] argArray); void warn(String msg); void warn(String msg, Object arg0); void warn(String msg, Object arg0, Object arg1); void warn(String msg, Object arg0, Object arg1, Object arg2); void warn(String msg, Object[] argArray); void warn(Throwable throwable, String msg); void warn(Throwable throwable, String msg, Object arg0); void warn(Throwable throwable, String msg, Object arg0, Object arg1); void warn(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void warn(Throwable throwable, String msg, Object[] argArray); void error(String msg); void error(String msg, Object arg0); void error(String msg, Object arg0, Object arg1); void error(String msg, Object arg0, Object arg1, Object arg2); void error(String msg, Object[] argArray); void error(Throwable throwable, String msg); void error(Throwable throwable, String msg, Object arg0); void error(Throwable throwable, String msg, Object arg0, Object arg1); void error(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void error(Throwable throwable, String msg, Object[] argArray); void fatal(String msg); void fatal(String msg, Object arg0); void fatal(String msg, Object arg0, Object arg1); void fatal(String msg, Object arg0, Object arg1, Object arg2); void fatal(String msg, Object[] argArray); void fatal(Throwable throwable, String msg); void fatal(Throwable throwable, String msg, Object arg0); void fatal(Throwable throwable, String msg, Object arg0, Object arg1); void fatal(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void fatal(Throwable throwable, String msg, Object[] argArray); void log(Level level, String msg); void log(Level level, String msg, Object arg0); void log(Level level, String msg, Object arg0, Object arg1); void log(Level level, String msg, Object arg0, Object arg1, Object arg2); void log(Level level, String msg, Object[] argArray); void log(Level level, Throwable throwable, String msg); void log(Level level, Throwable throwable, String msg, Object arg0); void log(Level level, Throwable throwable, String msg, Object arg0, Object arg1); void log(Level level, Throwable throwable, String msg, Object arg0, Object arg1, Object arg2); void log(Level level, Throwable throwable, String msg, Object[] argArray); }
|
@Test public void testLevelProperty() { Log log = new LocalLog("foo"); if (log.isLevelEnabled(Level.TRACE)) { return; } System.setProperty(LocalLog.LOCAL_LOG_LEVEL_PROPERTY, "TRACE"); try { log = new LocalLog("foo"); assertTrue(log.isLevelEnabled(Level.TRACE)); } finally { System.clearProperty(LocalLog.LOCAL_LOG_LEVEL_PROPERTY); } }
|
@Override public boolean isLevelEnabled(Level level) { return this.level.isEnabled(level); }
|
LocalLog implements Log { @Override public boolean isLevelEnabled(Level level) { return this.level.isEnabled(level); } }
|
LocalLog implements Log { @Override public boolean isLevelEnabled(Level level) { return this.level.isEnabled(level); } LocalLog(String className); }
|
LocalLog implements Log { @Override public boolean isLevelEnabled(Level level) { return this.level.isEnabled(level); } LocalLog(String className); static void openLogFile(String logPath); @Override boolean isLevelEnabled(Level level); @Override void log(Level level, String msg); @Override void log(Level level, String msg, Throwable throwable); }
|
LocalLog implements Log { @Override public boolean isLevelEnabled(Level level) { return this.level.isEnabled(level); } LocalLog(String className); static void openLogFile(String logPath); @Override boolean isLevelEnabled(Level level); @Override void log(Level level, String msg); @Override void log(Level level, String msg, Throwable throwable); static final String LOCAL_LOG_LEVEL_PROPERTY; static final String LOCAL_LOG_FILE_PROPERTY; static final String LOCAL_LOG_PROPERTIES_FILE; }
|
@Test(expected = IllegalArgumentException.class) public void testInvalidFileProperty() { LocalLog.openLogFile("not-a-proper-directory-name-we-hope/foo.txt"); }
|
public static void openLogFile(String logPath) { if (logPath == null) { printStream = System.out; } else { try { printStream = new PrintStream(new File(logPath)); } catch (FileNotFoundException e) { throw new IllegalArgumentException("Log file " + logPath + " was not found", e); } } }
|
LocalLog implements Log { public static void openLogFile(String logPath) { if (logPath == null) { printStream = System.out; } else { try { printStream = new PrintStream(new File(logPath)); } catch (FileNotFoundException e) { throw new IllegalArgumentException("Log file " + logPath + " was not found", e); } } } }
|
LocalLog implements Log { public static void openLogFile(String logPath) { if (logPath == null) { printStream = System.out; } else { try { printStream = new PrintStream(new File(logPath)); } catch (FileNotFoundException e) { throw new IllegalArgumentException("Log file " + logPath + " was not found", e); } } } LocalLog(String className); }
|
LocalLog implements Log { public static void openLogFile(String logPath) { if (logPath == null) { printStream = System.out; } else { try { printStream = new PrintStream(new File(logPath)); } catch (FileNotFoundException e) { throw new IllegalArgumentException("Log file " + logPath + " was not found", e); } } } LocalLog(String className); static void openLogFile(String logPath); @Override boolean isLevelEnabled(Level level); @Override void log(Level level, String msg); @Override void log(Level level, String msg, Throwable throwable); }
|
LocalLog implements Log { public static void openLogFile(String logPath) { if (logPath == null) { printStream = System.out; } else { try { printStream = new PrintStream(new File(logPath)); } catch (FileNotFoundException e) { throw new IllegalArgumentException("Log file " + logPath + " was not found", e); } } } LocalLog(String className); static void openLogFile(String logPath); @Override boolean isLevelEnabled(Level level); @Override void log(Level level, String msg); @Override void log(Level level, String msg, Throwable throwable); static final String LOCAL_LOG_LEVEL_PROPERTY; static final String LOCAL_LOG_FILE_PROPERTY; static final String LOCAL_LOG_PROPERTIES_FILE; }
|
@Test public void testStringLiteral2() throws Exception { String sql = "select #if (:1 == 'hello') ok #end"; ASTRootNode n = new Parser(sql).parse().init(); ParameterContext ctx = getParameterContext(Lists.newArrayList((Type) String.class)); n.checkAndBind(ctx); InvocationContext context = DefaultInvocationContext.create(); context.addParameter("1", "hello2"); n.render(context); BoundSql boundSql = context.getBoundSql(); assertThat(boundSql.getSql(), Matchers.equalTo("select ")); }
|
final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); final ASTRootNode parse(); final void DML(); final void Insert(); final void Delete(); final void Update(); final void Select(); final void Replace(); final void Merge(); final void Truncate(); final void Statement(); final void JDBCParameter(); final void JDBCIterableParameter(); final void GlobalTable(); final void JoinParameter(); final void QuoteText(); final void Text(); final void Blank(); final void IfStatement(); final void ElseStatement(); final void ElseIfStatement(); final void Expression(); final void ConditionalOrExpression(); final void ConditionalAndExpression(); final void RelationalExpression(); final void UnaryExpression(); final void PrimaryExpression(); final void ExpressionParameter(); final void IntegerLiteral(); final void StringLiteral(); final void True(); final void False(); final void Null(); void ReInit(java.io.InputStream stream); void ReInit(java.io.InputStream stream, String encoding); void ReInit(Reader stream); void ReInit(ParserTokenManager tm); final Token getNextToken(); final Token getToken(int index); ParseException generateParseException(); final void enable_tracing(); final void disable_tracing(); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); final ASTRootNode parse(); final void DML(); final void Insert(); final void Delete(); final void Update(); final void Select(); final void Replace(); final void Merge(); final void Truncate(); final void Statement(); final void JDBCParameter(); final void JDBCIterableParameter(); final void GlobalTable(); final void JoinParameter(); final void QuoteText(); final void Text(); final void Blank(); final void IfStatement(); final void ElseStatement(); final void ElseIfStatement(); final void Expression(); final void ConditionalOrExpression(); final void ConditionalAndExpression(); final void RelationalExpression(); final void UnaryExpression(); final void PrimaryExpression(); final void ExpressionParameter(); final void IntegerLiteral(); final void StringLiteral(); final void True(); final void False(); final void Null(); void ReInit(java.io.InputStream stream); void ReInit(java.io.InputStream stream, String encoding); void ReInit(Reader stream); void ReInit(ParserTokenManager tm); final Token getNextToken(); final Token getToken(int index); ParseException generateParseException(); final void enable_tracing(); final void disable_tracing(); public ParserTokenManager token_source; public Token token; public Token jj_nt; }
|
@Test public void testInvalidLevelsFile() { StringWriter stringWriter = new StringWriter(); stringWriter.write("x\n"); stringWriter.write("com\\.j256\\.ormlite\\.stmt\\.StatementExecutor = INVALID_LEVEL\n"); LocalLog.readLevelResourceFile(new ByteArrayInputStream(stringWriter.toString().getBytes())); }
|
static List<PatternLevel> readLevelResourceFile(InputStream stream) { List<PatternLevel> levels = null; if (stream != null) { try { levels = configureClassLevels(stream); } catch (IOException e) { System.err.println( "IO exception reading the log properties file '" + LOCAL_LOG_PROPERTIES_FILE + "': " + e); } finally { IOUtils.closeQuietly(stream); } } return levels; }
|
LocalLog implements Log { static List<PatternLevel> readLevelResourceFile(InputStream stream) { List<PatternLevel> levels = null; if (stream != null) { try { levels = configureClassLevels(stream); } catch (IOException e) { System.err.println( "IO exception reading the log properties file '" + LOCAL_LOG_PROPERTIES_FILE + "': " + e); } finally { IOUtils.closeQuietly(stream); } } return levels; } }
|
LocalLog implements Log { static List<PatternLevel> readLevelResourceFile(InputStream stream) { List<PatternLevel> levels = null; if (stream != null) { try { levels = configureClassLevels(stream); } catch (IOException e) { System.err.println( "IO exception reading the log properties file '" + LOCAL_LOG_PROPERTIES_FILE + "': " + e); } finally { IOUtils.closeQuietly(stream); } } return levels; } LocalLog(String className); }
|
LocalLog implements Log { static List<PatternLevel> readLevelResourceFile(InputStream stream) { List<PatternLevel> levels = null; if (stream != null) { try { levels = configureClassLevels(stream); } catch (IOException e) { System.err.println( "IO exception reading the log properties file '" + LOCAL_LOG_PROPERTIES_FILE + "': " + e); } finally { IOUtils.closeQuietly(stream); } } return levels; } LocalLog(String className); static void openLogFile(String logPath); @Override boolean isLevelEnabled(Level level); @Override void log(Level level, String msg); @Override void log(Level level, String msg, Throwable throwable); }
|
LocalLog implements Log { static List<PatternLevel> readLevelResourceFile(InputStream stream) { List<PatternLevel> levels = null; if (stream != null) { try { levels = configureClassLevels(stream); } catch (IOException e) { System.err.println( "IO exception reading the log properties file '" + LOCAL_LOG_PROPERTIES_FILE + "': " + e); } finally { IOUtils.closeQuietly(stream); } } return levels; } LocalLog(String className); static void openLogFile(String logPath); @Override boolean isLevelEnabled(Level level); @Override void log(Level level, String msg); @Override void log(Level level, String msg, Throwable throwable); static final String LOCAL_LOG_LEVEL_PROPERTY; static final String LOCAL_LOG_FILE_PROPERTY; static final String LOCAL_LOG_PROPERTIES_FILE; }
|
@Test public void testIoErrorsReadingLevelFile() { InputStream errorStream = new InputStream() { @Override public int read() throws IOException { throw new IOException("simulated exception"); } @Override public void close() throws IOException { throw new IOException("simulated exception"); } }; LocalLog.readLevelResourceFile(errorStream); }
|
static List<PatternLevel> readLevelResourceFile(InputStream stream) { List<PatternLevel> levels = null; if (stream != null) { try { levels = configureClassLevels(stream); } catch (IOException e) { System.err.println( "IO exception reading the log properties file '" + LOCAL_LOG_PROPERTIES_FILE + "': " + e); } finally { IOUtils.closeQuietly(stream); } } return levels; }
|
LocalLog implements Log { static List<PatternLevel> readLevelResourceFile(InputStream stream) { List<PatternLevel> levels = null; if (stream != null) { try { levels = configureClassLevels(stream); } catch (IOException e) { System.err.println( "IO exception reading the log properties file '" + LOCAL_LOG_PROPERTIES_FILE + "': " + e); } finally { IOUtils.closeQuietly(stream); } } return levels; } }
|
LocalLog implements Log { static List<PatternLevel> readLevelResourceFile(InputStream stream) { List<PatternLevel> levels = null; if (stream != null) { try { levels = configureClassLevels(stream); } catch (IOException e) { System.err.println( "IO exception reading the log properties file '" + LOCAL_LOG_PROPERTIES_FILE + "': " + e); } finally { IOUtils.closeQuietly(stream); } } return levels; } LocalLog(String className); }
|
LocalLog implements Log { static List<PatternLevel> readLevelResourceFile(InputStream stream) { List<PatternLevel> levels = null; if (stream != null) { try { levels = configureClassLevels(stream); } catch (IOException e) { System.err.println( "IO exception reading the log properties file '" + LOCAL_LOG_PROPERTIES_FILE + "': " + e); } finally { IOUtils.closeQuietly(stream); } } return levels; } LocalLog(String className); static void openLogFile(String logPath); @Override boolean isLevelEnabled(Level level); @Override void log(Level level, String msg); @Override void log(Level level, String msg, Throwable throwable); }
|
LocalLog implements Log { static List<PatternLevel> readLevelResourceFile(InputStream stream) { List<PatternLevel> levels = null; if (stream != null) { try { levels = configureClassLevels(stream); } catch (IOException e) { System.err.println( "IO exception reading the log properties file '" + LOCAL_LOG_PROPERTIES_FILE + "': " + e); } finally { IOUtils.closeQuietly(stream); } } return levels; } LocalLog(String className); static void openLogFile(String logPath); @Override boolean isLevelEnabled(Level level); @Override void log(Level level, String msg); @Override void log(Level level, String msg, Throwable throwable); static final String LOCAL_LOG_LEVEL_PROPERTY; static final String LOCAL_LOG_FILE_PROPERTY; static final String LOCAL_LOG_PROPERTIES_FILE; }
|
@Test public void testInputStreamNull() { LocalLog.readLevelResourceFile(null); }
|
static List<PatternLevel> readLevelResourceFile(InputStream stream) { List<PatternLevel> levels = null; if (stream != null) { try { levels = configureClassLevels(stream); } catch (IOException e) { System.err.println( "IO exception reading the log properties file '" + LOCAL_LOG_PROPERTIES_FILE + "': " + e); } finally { IOUtils.closeQuietly(stream); } } return levels; }
|
LocalLog implements Log { static List<PatternLevel> readLevelResourceFile(InputStream stream) { List<PatternLevel> levels = null; if (stream != null) { try { levels = configureClassLevels(stream); } catch (IOException e) { System.err.println( "IO exception reading the log properties file '" + LOCAL_LOG_PROPERTIES_FILE + "': " + e); } finally { IOUtils.closeQuietly(stream); } } return levels; } }
|
LocalLog implements Log { static List<PatternLevel> readLevelResourceFile(InputStream stream) { List<PatternLevel> levels = null; if (stream != null) { try { levels = configureClassLevels(stream); } catch (IOException e) { System.err.println( "IO exception reading the log properties file '" + LOCAL_LOG_PROPERTIES_FILE + "': " + e); } finally { IOUtils.closeQuietly(stream); } } return levels; } LocalLog(String className); }
|
LocalLog implements Log { static List<PatternLevel> readLevelResourceFile(InputStream stream) { List<PatternLevel> levels = null; if (stream != null) { try { levels = configureClassLevels(stream); } catch (IOException e) { System.err.println( "IO exception reading the log properties file '" + LOCAL_LOG_PROPERTIES_FILE + "': " + e); } finally { IOUtils.closeQuietly(stream); } } return levels; } LocalLog(String className); static void openLogFile(String logPath); @Override boolean isLevelEnabled(Level level); @Override void log(Level level, String msg); @Override void log(Level level, String msg, Throwable throwable); }
|
LocalLog implements Log { static List<PatternLevel> readLevelResourceFile(InputStream stream) { List<PatternLevel> levels = null; if (stream != null) { try { levels = configureClassLevels(stream); } catch (IOException e) { System.err.println( "IO exception reading the log properties file '" + LOCAL_LOG_PROPERTIES_FILE + "': " + e); } finally { IOUtils.closeQuietly(stream); } } return levels; } LocalLog(String className); static void openLogFile(String logPath); @Override boolean isLevelEnabled(Level level); @Override void log(Level level, String msg); @Override void log(Level level, String msg, Throwable throwable); static final String LOCAL_LOG_LEVEL_PROPERTY; static final String LOCAL_LOG_FILE_PROPERTY; static final String LOCAL_LOG_PROPERTIES_FILE; }
|
@Test public void testGetLoggerClass() { assertNotNull(LoggerFactory.getLogger(getClass())); }
|
public static Logger getLogger(Class<?> clazz) { return getLogger(clazz.getName()); }
|
LoggerFactory { public static Logger getLogger(Class<?> clazz) { return getLogger(clazz.getName()); } }
|
LoggerFactory { public static Logger getLogger(Class<?> clazz) { return getLogger(clazz.getName()); } private LoggerFactory(); }
|
LoggerFactory { public static Logger getLogger(Class<?> clazz) { return getLogger(clazz.getName()); } private LoggerFactory(); static Logger getLogger(Class<?> clazz); static Logger getLogger(String className); static String getSimpleClassName(String className); }
|
LoggerFactory { public static Logger getLogger(Class<?> clazz) { return getLogger(clazz.getName()); } private LoggerFactory(); static Logger getLogger(Class<?> clazz); static Logger getLogger(String className); static String getSimpleClassName(String className); static final String LOG_TYPE_SYSTEM_PROPERTY; }
|
@Test public void testGetLoggerString() { assertNotNull(LoggerFactory.getLogger(getClass().getName())); }
|
public static Logger getLogger(Class<?> clazz) { return getLogger(clazz.getName()); }
|
LoggerFactory { public static Logger getLogger(Class<?> clazz) { return getLogger(clazz.getName()); } }
|
LoggerFactory { public static Logger getLogger(Class<?> clazz) { return getLogger(clazz.getName()); } private LoggerFactory(); }
|
LoggerFactory { public static Logger getLogger(Class<?> clazz) { return getLogger(clazz.getName()); } private LoggerFactory(); static Logger getLogger(Class<?> clazz); static Logger getLogger(String className); static String getSimpleClassName(String className); }
|
LoggerFactory { public static Logger getLogger(Class<?> clazz) { return getLogger(clazz.getName()); } private LoggerFactory(); static Logger getLogger(Class<?> clazz); static Logger getLogger(String className); static String getSimpleClassName(String className); static final String LOG_TYPE_SYSTEM_PROPERTY; }
|
@Test public void testGetSimpleClassName() { String first = "foo"; String name = LoggerFactory.getSimpleClassName(first); assertEquals(first, name); String second = "bar"; String className = first + "." + second; name = LoggerFactory.getSimpleClassName(className); assertEquals(second, name); }
|
public static String getSimpleClassName(String className) { String[] parts = className.split("\\."); if (parts.length <= 1) { return className; } else { return parts[parts.length - 1]; } }
|
LoggerFactory { public static String getSimpleClassName(String className) { String[] parts = className.split("\\."); if (parts.length <= 1) { return className; } else { return parts[parts.length - 1]; } } }
|
LoggerFactory { public static String getSimpleClassName(String className) { String[] parts = className.split("\\."); if (parts.length <= 1) { return className; } else { return parts[parts.length - 1]; } } private LoggerFactory(); }
|
LoggerFactory { public static String getSimpleClassName(String className) { String[] parts = className.split("\\."); if (parts.length <= 1) { return className; } else { return parts[parts.length - 1]; } } private LoggerFactory(); static Logger getLogger(Class<?> clazz); static Logger getLogger(String className); static String getSimpleClassName(String className); }
|
LoggerFactory { public static String getSimpleClassName(String className) { String[] parts = className.split("\\."); if (parts.length <= 1) { return className; } else { return parts[parts.length - 1]; } } private LoggerFactory(); static Logger getLogger(Class<?> clazz); static Logger getLogger(String className); static String getSimpleClassName(String className); static final String LOG_TYPE_SYSTEM_PROPERTY; }
|
@Test(expected = IllegalArgumentException.class) public void testTableInfo() throws SQLException { new TableInfo<NoFieldAnnotations, Void>(connectionSource, null, NoFieldAnnotations.class); }
|
public TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass) throws SQLException { this(connectionSource.getDatabaseType(), baseDaoImpl, DatabaseTableConfig.fromClass(connectionSource, dataClass)); }
|
TableInfo { public TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass) throws SQLException { this(connectionSource.getDatabaseType(), baseDaoImpl, DatabaseTableConfig.fromClass(connectionSource, dataClass)); } }
|
TableInfo { public TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass) throws SQLException { this(connectionSource.getDatabaseType(), baseDaoImpl, DatabaseTableConfig.fromClass(connectionSource, dataClass)); } TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass); TableInfo(DatabaseType databaseType, BaseDaoImpl<T, ID> baseDaoImpl, DatabaseTableConfig<T> tableConfig); }
|
TableInfo { public TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass) throws SQLException { this(connectionSource.getDatabaseType(), baseDaoImpl, DatabaseTableConfig.fromClass(connectionSource, dataClass)); } TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass); TableInfo(DatabaseType databaseType, BaseDaoImpl<T, ID> baseDaoImpl, DatabaseTableConfig<T> tableConfig); Class<T> getDataClass(); String getTableName(); FieldType[] getFieldTypes(); FieldType getFieldTypeByColumnName(String columnName); FieldType getIdField(); Constructor<T> getConstructor(); String objectToString(T object); T createObject(); boolean isUpdatable(); boolean isForeignAutoCreate(); FieldType[] getForeignCollections(); boolean hasColumnName(String columnName); }
|
TableInfo { public TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass) throws SQLException { this(connectionSource.getDatabaseType(), baseDaoImpl, DatabaseTableConfig.fromClass(connectionSource, dataClass)); } TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass); TableInfo(DatabaseType databaseType, BaseDaoImpl<T, ID> baseDaoImpl, DatabaseTableConfig<T> tableConfig); Class<T> getDataClass(); String getTableName(); FieldType[] getFieldTypes(); FieldType getFieldTypeByColumnName(String columnName); FieldType getIdField(); Constructor<T> getConstructor(); String objectToString(T object); T createObject(); boolean isUpdatable(); boolean isForeignAutoCreate(); FieldType[] getForeignCollections(); boolean hasColumnName(String columnName); }
|
@Test public void testObjectToString() throws Exception { String id = "f11232oo"; Foo foo = new Foo(); foo.id = id; assertEquals(id, foo.id); TableInfo<Foo, String> tableInfo = new TableInfo<Foo, String>(connectionSource, null, Foo.class); assertTrue(tableInfo.objectToString(foo).contains(id)); }
|
public String objectToString(T object) { StringBuilder sb = new StringBuilder(64); sb.append(object.getClass().getSimpleName()); for (FieldType fieldType : fieldTypes) { sb.append(' ').append(fieldType.getColumnName()).append('='); try { sb.append(fieldType.extractJavaFieldValue(object)); } catch (Exception e) { throw new IllegalStateException("Could not generate toString of field " + fieldType, e); } } return sb.toString(); }
|
TableInfo { public String objectToString(T object) { StringBuilder sb = new StringBuilder(64); sb.append(object.getClass().getSimpleName()); for (FieldType fieldType : fieldTypes) { sb.append(' ').append(fieldType.getColumnName()).append('='); try { sb.append(fieldType.extractJavaFieldValue(object)); } catch (Exception e) { throw new IllegalStateException("Could not generate toString of field " + fieldType, e); } } return sb.toString(); } }
|
TableInfo { public String objectToString(T object) { StringBuilder sb = new StringBuilder(64); sb.append(object.getClass().getSimpleName()); for (FieldType fieldType : fieldTypes) { sb.append(' ').append(fieldType.getColumnName()).append('='); try { sb.append(fieldType.extractJavaFieldValue(object)); } catch (Exception e) { throw new IllegalStateException("Could not generate toString of field " + fieldType, e); } } return sb.toString(); } TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass); TableInfo(DatabaseType databaseType, BaseDaoImpl<T, ID> baseDaoImpl, DatabaseTableConfig<T> tableConfig); }
|
TableInfo { public String objectToString(T object) { StringBuilder sb = new StringBuilder(64); sb.append(object.getClass().getSimpleName()); for (FieldType fieldType : fieldTypes) { sb.append(' ').append(fieldType.getColumnName()).append('='); try { sb.append(fieldType.extractJavaFieldValue(object)); } catch (Exception e) { throw new IllegalStateException("Could not generate toString of field " + fieldType, e); } } return sb.toString(); } TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass); TableInfo(DatabaseType databaseType, BaseDaoImpl<T, ID> baseDaoImpl, DatabaseTableConfig<T> tableConfig); Class<T> getDataClass(); String getTableName(); FieldType[] getFieldTypes(); FieldType getFieldTypeByColumnName(String columnName); FieldType getIdField(); Constructor<T> getConstructor(); String objectToString(T object); T createObject(); boolean isUpdatable(); boolean isForeignAutoCreate(); FieldType[] getForeignCollections(); boolean hasColumnName(String columnName); }
|
TableInfo { public String objectToString(T object) { StringBuilder sb = new StringBuilder(64); sb.append(object.getClass().getSimpleName()); for (FieldType fieldType : fieldTypes) { sb.append(' ').append(fieldType.getColumnName()).append('='); try { sb.append(fieldType.extractJavaFieldValue(object)); } catch (Exception e) { throw new IllegalStateException("Could not generate toString of field " + fieldType, e); } } return sb.toString(); } TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass); TableInfo(DatabaseType databaseType, BaseDaoImpl<T, ID> baseDaoImpl, DatabaseTableConfig<T> tableConfig); Class<T> getDataClass(); String getTableName(); FieldType[] getFieldTypes(); FieldType getFieldTypeByColumnName(String columnName); FieldType getIdField(); Constructor<T> getConstructor(); String objectToString(T object); T createObject(); boolean isUpdatable(); boolean isForeignAutoCreate(); FieldType[] getForeignCollections(); boolean hasColumnName(String columnName); }
|
@Test public void testNoTableNameInAnnotation() throws Exception { TableInfo<NoTableNameAnnotation, Void> tableInfo = new TableInfo<NoTableNameAnnotation, Void>(connectionSource, null, NoTableNameAnnotation.class); assertEquals(NoTableNameAnnotation.class.getSimpleName().toLowerCase(), tableInfo.getTableName()); }
|
public String getTableName() { return tableName; }
|
TableInfo { public String getTableName() { return tableName; } }
|
TableInfo { public String getTableName() { return tableName; } TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass); TableInfo(DatabaseType databaseType, BaseDaoImpl<T, ID> baseDaoImpl, DatabaseTableConfig<T> tableConfig); }
|
TableInfo { public String getTableName() { return tableName; } TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass); TableInfo(DatabaseType databaseType, BaseDaoImpl<T, ID> baseDaoImpl, DatabaseTableConfig<T> tableConfig); Class<T> getDataClass(); String getTableName(); FieldType[] getFieldTypes(); FieldType getFieldTypeByColumnName(String columnName); FieldType getIdField(); Constructor<T> getConstructor(); String objectToString(T object); T createObject(); boolean isUpdatable(); boolean isForeignAutoCreate(); FieldType[] getForeignCollections(); boolean hasColumnName(String columnName); }
|
TableInfo { public String getTableName() { return tableName; } TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass); TableInfo(DatabaseType databaseType, BaseDaoImpl<T, ID> baseDaoImpl, DatabaseTableConfig<T> tableConfig); Class<T> getDataClass(); String getTableName(); FieldType[] getFieldTypes(); FieldType getFieldTypeByColumnName(String columnName); FieldType getIdField(); Constructor<T> getConstructor(); String objectToString(T object); T createObject(); boolean isUpdatable(); boolean isForeignAutoCreate(); FieldType[] getForeignCollections(); boolean hasColumnName(String columnName); }
|
@Test public void testConstruct() throws Exception { TableInfo<Foo, String> tableInfo = new TableInfo<Foo, String>(connectionSource, null, Foo.class); Foo foo = tableInfo.createObject(); assertNotNull(foo); }
|
public T createObject() throws SQLException { try { T instance; ObjectFactory<T> factory = null; if (baseDaoImpl != null) { factory = baseDaoImpl.getObjectFactory(); } if (factory == null) { instance = constructor.newInstance(); } else { instance = factory.createObject(constructor, baseDaoImpl.getDataClass()); } wireNewInstance(baseDaoImpl, instance); return instance; } catch (Exception e) { throw SqlExceptionUtil.create("Could not create object for " + constructor.getDeclaringClass(), e); } }
|
TableInfo { public T createObject() throws SQLException { try { T instance; ObjectFactory<T> factory = null; if (baseDaoImpl != null) { factory = baseDaoImpl.getObjectFactory(); } if (factory == null) { instance = constructor.newInstance(); } else { instance = factory.createObject(constructor, baseDaoImpl.getDataClass()); } wireNewInstance(baseDaoImpl, instance); return instance; } catch (Exception e) { throw SqlExceptionUtil.create("Could not create object for " + constructor.getDeclaringClass(), e); } } }
|
TableInfo { public T createObject() throws SQLException { try { T instance; ObjectFactory<T> factory = null; if (baseDaoImpl != null) { factory = baseDaoImpl.getObjectFactory(); } if (factory == null) { instance = constructor.newInstance(); } else { instance = factory.createObject(constructor, baseDaoImpl.getDataClass()); } wireNewInstance(baseDaoImpl, instance); return instance; } catch (Exception e) { throw SqlExceptionUtil.create("Could not create object for " + constructor.getDeclaringClass(), e); } } TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass); TableInfo(DatabaseType databaseType, BaseDaoImpl<T, ID> baseDaoImpl, DatabaseTableConfig<T> tableConfig); }
|
TableInfo { public T createObject() throws SQLException { try { T instance; ObjectFactory<T> factory = null; if (baseDaoImpl != null) { factory = baseDaoImpl.getObjectFactory(); } if (factory == null) { instance = constructor.newInstance(); } else { instance = factory.createObject(constructor, baseDaoImpl.getDataClass()); } wireNewInstance(baseDaoImpl, instance); return instance; } catch (Exception e) { throw SqlExceptionUtil.create("Could not create object for " + constructor.getDeclaringClass(), e); } } TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass); TableInfo(DatabaseType databaseType, BaseDaoImpl<T, ID> baseDaoImpl, DatabaseTableConfig<T> tableConfig); Class<T> getDataClass(); String getTableName(); FieldType[] getFieldTypes(); FieldType getFieldTypeByColumnName(String columnName); FieldType getIdField(); Constructor<T> getConstructor(); String objectToString(T object); T createObject(); boolean isUpdatable(); boolean isForeignAutoCreate(); FieldType[] getForeignCollections(); boolean hasColumnName(String columnName); }
|
TableInfo { public T createObject() throws SQLException { try { T instance; ObjectFactory<T> factory = null; if (baseDaoImpl != null) { factory = baseDaoImpl.getObjectFactory(); } if (factory == null) { instance = constructor.newInstance(); } else { instance = factory.createObject(constructor, baseDaoImpl.getDataClass()); } wireNewInstance(baseDaoImpl, instance); return instance; } catch (Exception e) { throw SqlExceptionUtil.create("Could not create object for " + constructor.getDeclaringClass(), e); } } TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass); TableInfo(DatabaseType databaseType, BaseDaoImpl<T, ID> baseDaoImpl, DatabaseTableConfig<T> tableConfig); Class<T> getDataClass(); String getTableName(); FieldType[] getFieldTypes(); FieldType getFieldTypeByColumnName(String columnName); FieldType getIdField(); Constructor<T> getConstructor(); String objectToString(T object); T createObject(); boolean isUpdatable(); boolean isForeignAutoCreate(); FieldType[] getForeignCollections(); boolean hasColumnName(String columnName); }
|
@Test public void testStringLiteral3() throws Exception { String sql = "select #if ('') ok #end"; ASTRootNode n = new Parser(sql).parse().init(); ParameterContext ctx = getParameterContext(Lists.newArrayList((Type) String.class)); n.checkAndBind(ctx); InvocationContext context = DefaultInvocationContext.create(); context.addParameter("1", "hello2"); n.render(context); BoundSql boundSql = context.getBoundSql(); assertThat(boundSql.getSql(), Matchers.equalTo("select ")); }
|
final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); final ASTRootNode parse(); final void DML(); final void Insert(); final void Delete(); final void Update(); final void Select(); final void Replace(); final void Merge(); final void Truncate(); final void Statement(); final void JDBCParameter(); final void JDBCIterableParameter(); final void GlobalTable(); final void JoinParameter(); final void QuoteText(); final void Text(); final void Blank(); final void IfStatement(); final void ElseStatement(); final void ElseIfStatement(); final void Expression(); final void ConditionalOrExpression(); final void ConditionalAndExpression(); final void RelationalExpression(); final void UnaryExpression(); final void PrimaryExpression(); final void ExpressionParameter(); final void IntegerLiteral(); final void StringLiteral(); final void True(); final void False(); final void Null(); void ReInit(java.io.InputStream stream); void ReInit(java.io.InputStream stream, String encoding); void ReInit(Reader stream); void ReInit(ParserTokenManager tm); final Token getNextToken(); final Token getToken(int index); ParseException generateParseException(); final void enable_tracing(); final void disable_tracing(); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); final ASTRootNode parse(); final void DML(); final void Insert(); final void Delete(); final void Update(); final void Select(); final void Replace(); final void Merge(); final void Truncate(); final void Statement(); final void JDBCParameter(); final void JDBCIterableParameter(); final void GlobalTable(); final void JoinParameter(); final void QuoteText(); final void Text(); final void Blank(); final void IfStatement(); final void ElseStatement(); final void ElseIfStatement(); final void Expression(); final void ConditionalOrExpression(); final void ConditionalAndExpression(); final void RelationalExpression(); final void UnaryExpression(); final void PrimaryExpression(); final void ExpressionParameter(); final void IntegerLiteral(); final void StringLiteral(); final void True(); final void False(); final void Null(); void ReInit(java.io.InputStream stream); void ReInit(java.io.InputStream stream, String encoding); void ReInit(Reader stream); void ReInit(ParserTokenManager tm); final Token getNextToken(); final Token getToken(int index); ParseException generateParseException(); final void enable_tracing(); final void disable_tracing(); public ParserTokenManager token_source; public Token token; public Token jj_nt; }
|
@Test public void testUnknownForeignField() throws Exception { TableInfo<Foreign, Void> tableInfo = new TableInfo<Foreign, Void>(connectionSource, null, Foreign.class); try { tableInfo.getFieldTypeByColumnName("foo"); fail("expected exception"); } catch (IllegalArgumentException e) { assertTrue(e.getMessage().contains("'" + Foreign.FOREIGN_FIELD_NAME + "'")); assertTrue(e.getMessage().contains("'foo'")); } }
|
public FieldType getFieldTypeByColumnName(String columnName) { if (fieldNameMap == null) { Map<String, FieldType> map = new HashMap<String, FieldType>(); for (FieldType fieldType : fieldTypes) { map.put(fieldType.getColumnName().toLowerCase(), fieldType); } fieldNameMap = map; } FieldType fieldType = fieldNameMap.get(columnName.toLowerCase()); if (fieldType != null) { return fieldType; } for (FieldType fieldType2 : fieldTypes) { if (fieldType2.getFieldName().equals(columnName)) { throw new IllegalArgumentException("You should use columnName '" + fieldType2.getColumnName() + "' for table " + tableName + " instead of fieldName '" + fieldType2.getFieldName() + "'"); } } throw new IllegalArgumentException("Unknown column name '" + columnName + "' in table " + tableName); }
|
TableInfo { public FieldType getFieldTypeByColumnName(String columnName) { if (fieldNameMap == null) { Map<String, FieldType> map = new HashMap<String, FieldType>(); for (FieldType fieldType : fieldTypes) { map.put(fieldType.getColumnName().toLowerCase(), fieldType); } fieldNameMap = map; } FieldType fieldType = fieldNameMap.get(columnName.toLowerCase()); if (fieldType != null) { return fieldType; } for (FieldType fieldType2 : fieldTypes) { if (fieldType2.getFieldName().equals(columnName)) { throw new IllegalArgumentException("You should use columnName '" + fieldType2.getColumnName() + "' for table " + tableName + " instead of fieldName '" + fieldType2.getFieldName() + "'"); } } throw new IllegalArgumentException("Unknown column name '" + columnName + "' in table " + tableName); } }
|
TableInfo { public FieldType getFieldTypeByColumnName(String columnName) { if (fieldNameMap == null) { Map<String, FieldType> map = new HashMap<String, FieldType>(); for (FieldType fieldType : fieldTypes) { map.put(fieldType.getColumnName().toLowerCase(), fieldType); } fieldNameMap = map; } FieldType fieldType = fieldNameMap.get(columnName.toLowerCase()); if (fieldType != null) { return fieldType; } for (FieldType fieldType2 : fieldTypes) { if (fieldType2.getFieldName().equals(columnName)) { throw new IllegalArgumentException("You should use columnName '" + fieldType2.getColumnName() + "' for table " + tableName + " instead of fieldName '" + fieldType2.getFieldName() + "'"); } } throw new IllegalArgumentException("Unknown column name '" + columnName + "' in table " + tableName); } TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass); TableInfo(DatabaseType databaseType, BaseDaoImpl<T, ID> baseDaoImpl, DatabaseTableConfig<T> tableConfig); }
|
TableInfo { public FieldType getFieldTypeByColumnName(String columnName) { if (fieldNameMap == null) { Map<String, FieldType> map = new HashMap<String, FieldType>(); for (FieldType fieldType : fieldTypes) { map.put(fieldType.getColumnName().toLowerCase(), fieldType); } fieldNameMap = map; } FieldType fieldType = fieldNameMap.get(columnName.toLowerCase()); if (fieldType != null) { return fieldType; } for (FieldType fieldType2 : fieldTypes) { if (fieldType2.getFieldName().equals(columnName)) { throw new IllegalArgumentException("You should use columnName '" + fieldType2.getColumnName() + "' for table " + tableName + " instead of fieldName '" + fieldType2.getFieldName() + "'"); } } throw new IllegalArgumentException("Unknown column name '" + columnName + "' in table " + tableName); } TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass); TableInfo(DatabaseType databaseType, BaseDaoImpl<T, ID> baseDaoImpl, DatabaseTableConfig<T> tableConfig); Class<T> getDataClass(); String getTableName(); FieldType[] getFieldTypes(); FieldType getFieldTypeByColumnName(String columnName); FieldType getIdField(); Constructor<T> getConstructor(); String objectToString(T object); T createObject(); boolean isUpdatable(); boolean isForeignAutoCreate(); FieldType[] getForeignCollections(); boolean hasColumnName(String columnName); }
|
TableInfo { public FieldType getFieldTypeByColumnName(String columnName) { if (fieldNameMap == null) { Map<String, FieldType> map = new HashMap<String, FieldType>(); for (FieldType fieldType : fieldTypes) { map.put(fieldType.getColumnName().toLowerCase(), fieldType); } fieldNameMap = map; } FieldType fieldType = fieldNameMap.get(columnName.toLowerCase()); if (fieldType != null) { return fieldType; } for (FieldType fieldType2 : fieldTypes) { if (fieldType2.getFieldName().equals(columnName)) { throw new IllegalArgumentException("You should use columnName '" + fieldType2.getColumnName() + "' for table " + tableName + " instead of fieldName '" + fieldType2.getFieldName() + "'"); } } throw new IllegalArgumentException("Unknown column name '" + columnName + "' in table " + tableName); } TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass); TableInfo(DatabaseType databaseType, BaseDaoImpl<T, ID> baseDaoImpl, DatabaseTableConfig<T> tableConfig); Class<T> getDataClass(); String getTableName(); FieldType[] getFieldTypes(); FieldType getFieldTypeByColumnName(String columnName); FieldType getIdField(); Constructor<T> getConstructor(); String objectToString(T object); T createObject(); boolean isUpdatable(); boolean isForeignAutoCreate(); FieldType[] getForeignCollections(); boolean hasColumnName(String columnName); }
|
@Test public void testHasColumnName() throws Exception { Dao<Foo, String> dao = createDao(Foo.class, true); TableInfo<Foo, String> tableInfo = ((BaseDaoImpl<Foo, String>) dao).getTableInfo(); assertTrue(tableInfo.hasColumnName(COLUMN_NAME)); assertFalse(tableInfo.hasColumnName("not this name")); }
|
public boolean hasColumnName(String columnName) { for (FieldType fieldType : fieldTypes) { if (fieldType.getColumnName().equals(columnName)) { return true; } } return false; }
|
TableInfo { public boolean hasColumnName(String columnName) { for (FieldType fieldType : fieldTypes) { if (fieldType.getColumnName().equals(columnName)) { return true; } } return false; } }
|
TableInfo { public boolean hasColumnName(String columnName) { for (FieldType fieldType : fieldTypes) { if (fieldType.getColumnName().equals(columnName)) { return true; } } return false; } TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass); TableInfo(DatabaseType databaseType, BaseDaoImpl<T, ID> baseDaoImpl, DatabaseTableConfig<T> tableConfig); }
|
TableInfo { public boolean hasColumnName(String columnName) { for (FieldType fieldType : fieldTypes) { if (fieldType.getColumnName().equals(columnName)) { return true; } } return false; } TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass); TableInfo(DatabaseType databaseType, BaseDaoImpl<T, ID> baseDaoImpl, DatabaseTableConfig<T> tableConfig); Class<T> getDataClass(); String getTableName(); FieldType[] getFieldTypes(); FieldType getFieldTypeByColumnName(String columnName); FieldType getIdField(); Constructor<T> getConstructor(); String objectToString(T object); T createObject(); boolean isUpdatable(); boolean isForeignAutoCreate(); FieldType[] getForeignCollections(); boolean hasColumnName(String columnName); }
|
TableInfo { public boolean hasColumnName(String columnName) { for (FieldType fieldType : fieldTypes) { if (fieldType.getColumnName().equals(columnName)) { return true; } } return false; } TableInfo(ConnectionSource connectionSource, BaseDaoImpl<T, ID> baseDaoImpl, Class<T> dataClass); TableInfo(DatabaseType databaseType, BaseDaoImpl<T, ID> baseDaoImpl, DatabaseTableConfig<T> tableConfig); Class<T> getDataClass(); String getTableName(); FieldType[] getFieldTypes(); FieldType getFieldTypeByColumnName(String columnName); FieldType getIdField(); Constructor<T> getConstructor(); String objectToString(T object); T createObject(); boolean isUpdatable(); boolean isForeignAutoCreate(); FieldType[] getForeignCollections(); boolean hasColumnName(String columnName); }
|
@Test public void testConfigFile() throws Exception { DatabaseTableConfig<NoFields> config = new DatabaseTableConfig<NoFields>(); StringBuilder body = new StringBuilder(); StringWriter writer = new StringWriter(); BufferedWriter buffer = new BufferedWriter(writer); Class<NoFields> clazz = NoFields.class; config.setDataClass(clazz); body.append("dataClass=").append(clazz.getName()).append(LINE_SEP); checkConfigOutput(config, body, writer, buffer, false); String tableName = "pojgefwpjoefwpjo"; config.setTableName(tableName); body.append("tableName=").append(tableName).append(LINE_SEP); checkConfigOutput(config, body, writer, buffer, false); DatabaseFieldConfig field1 = new DatabaseFieldConfig(); String columnName = "efjpowefpjoefw"; field1.setColumnName(columnName); config.setFieldConfigs(Arrays.asList(field1)); StringWriter fieldWriter = new StringWriter(); BufferedWriter fieldBuffer = new BufferedWriter(fieldWriter); DatabaseFieldConfigLoader.write(fieldBuffer, field1, tableName); fieldBuffer.flush(); body.append("# --table-fields-start--").append(LINE_SEP); body.append(fieldWriter.toString()); checkConfigOutput(config, body, writer, buffer, true); }
|
public static <T> void write(BufferedWriter writer, DatabaseTableConfig<T> config) throws SQLException { try { writeConfig(writer, config); } catch (IOException e) { throw SqlExceptionUtil.create("Could not write config to writer", e); } }
|
DatabaseTableConfigLoader { public static <T> void write(BufferedWriter writer, DatabaseTableConfig<T> config) throws SQLException { try { writeConfig(writer, config); } catch (IOException e) { throw SqlExceptionUtil.create("Could not write config to writer", e); } } }
|
DatabaseTableConfigLoader { public static <T> void write(BufferedWriter writer, DatabaseTableConfig<T> config) throws SQLException { try { writeConfig(writer, config); } catch (IOException e) { throw SqlExceptionUtil.create("Could not write config to writer", e); } } }
|
DatabaseTableConfigLoader { public static <T> void write(BufferedWriter writer, DatabaseTableConfig<T> config) throws SQLException { try { writeConfig(writer, config); } catch (IOException e) { throw SqlExceptionUtil.create("Could not write config to writer", e); } } static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader); static DatabaseTableConfig<T> fromReader(BufferedReader reader); static void write(BufferedWriter writer, DatabaseTableConfig<T> config); }
|
DatabaseTableConfigLoader { public static <T> void write(BufferedWriter writer, DatabaseTableConfig<T> config) throws SQLException { try { writeConfig(writer, config); } catch (IOException e) { throw SqlExceptionUtil.create("Could not write config to writer", e); } } static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader); static DatabaseTableConfig<T> fromReader(BufferedReader reader); static void write(BufferedWriter writer, DatabaseTableConfig<T> config); }
|
@Test public void testConfigEntriesFromStream() throws Exception { StringBuilder value = new StringBuilder(); value.append(TABLE_START); value.append("# random comment").append(LINE_SEP); value.append(LINE_SEP); value.append("dataClass=").append(Foo.class.getName()).append(LINE_SEP); String tableName = "fprwojfgopwejfw"; value.append("tableName=").append(tableName).append(LINE_SEP); value.append("# --table-fields-start--").append(LINE_SEP); value.append("# --field-start--").append(LINE_SEP); String fieldName = "weopjfwefjw"; value.append("fieldName=").append(fieldName).append(LINE_SEP); value.append("canBeNull=true").append(LINE_SEP); value.append("generatedId=true").append(LINE_SEP); value.append("# --field-end--").append(LINE_SEP); value.append("# --table-fields-end--").append(LINE_SEP); value.append(TABLE_END); List<DatabaseTableConfig<?>> tables = DatabaseTableConfigLoader.loadDatabaseConfigFromReader(new BufferedReader(new StringReader( value.toString()))); assertEquals(1, tables.size()); assertEquals(tableName, tables.get(0).getTableName()); DatabaseTableConfig<?> config = tables.get(0); List<DatabaseFieldConfig> fields = config.getFieldConfigs(); assertEquals(1, fields.size()); assertEquals(fieldName, fields.get(0).getFieldName()); }
|
public static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader) throws SQLException { List<DatabaseTableConfig<?>> list = new ArrayList<DatabaseTableConfig<?>>(); while (true) { DatabaseTableConfig<?> config = DatabaseTableConfigLoader.fromReader(reader); if (config == null) { break; } list.add(config); } return list; }
|
DatabaseTableConfigLoader { public static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader) throws SQLException { List<DatabaseTableConfig<?>> list = new ArrayList<DatabaseTableConfig<?>>(); while (true) { DatabaseTableConfig<?> config = DatabaseTableConfigLoader.fromReader(reader); if (config == null) { break; } list.add(config); } return list; } }
|
DatabaseTableConfigLoader { public static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader) throws SQLException { List<DatabaseTableConfig<?>> list = new ArrayList<DatabaseTableConfig<?>>(); while (true) { DatabaseTableConfig<?> config = DatabaseTableConfigLoader.fromReader(reader); if (config == null) { break; } list.add(config); } return list; } }
|
DatabaseTableConfigLoader { public static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader) throws SQLException { List<DatabaseTableConfig<?>> list = new ArrayList<DatabaseTableConfig<?>>(); while (true) { DatabaseTableConfig<?> config = DatabaseTableConfigLoader.fromReader(reader); if (config == null) { break; } list.add(config); } return list; } static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader); static DatabaseTableConfig<T> fromReader(BufferedReader reader); static void write(BufferedWriter writer, DatabaseTableConfig<T> config); }
|
DatabaseTableConfigLoader { public static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader) throws SQLException { List<DatabaseTableConfig<?>> list = new ArrayList<DatabaseTableConfig<?>>(); while (true) { DatabaseTableConfig<?> config = DatabaseTableConfigLoader.fromReader(reader); if (config == null) { break; } list.add(config); } return list; } static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader); static DatabaseTableConfig<T> fromReader(BufferedReader reader); static void write(BufferedWriter writer, DatabaseTableConfig<T> config); }
|
@Test(expected = SQLException.class) public void testConfigInvalidLine() throws Exception { StringBuilder value = new StringBuilder(); value.append(TABLE_START); value.append("dataClass").append(LINE_SEP); DatabaseTableConfigLoader.loadDatabaseConfigFromReader(new BufferedReader(new StringReader(value.toString()))); }
|
public static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader) throws SQLException { List<DatabaseTableConfig<?>> list = new ArrayList<DatabaseTableConfig<?>>(); while (true) { DatabaseTableConfig<?> config = DatabaseTableConfigLoader.fromReader(reader); if (config == null) { break; } list.add(config); } return list; }
|
DatabaseTableConfigLoader { public static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader) throws SQLException { List<DatabaseTableConfig<?>> list = new ArrayList<DatabaseTableConfig<?>>(); while (true) { DatabaseTableConfig<?> config = DatabaseTableConfigLoader.fromReader(reader); if (config == null) { break; } list.add(config); } return list; } }
|
DatabaseTableConfigLoader { public static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader) throws SQLException { List<DatabaseTableConfig<?>> list = new ArrayList<DatabaseTableConfig<?>>(); while (true) { DatabaseTableConfig<?> config = DatabaseTableConfigLoader.fromReader(reader); if (config == null) { break; } list.add(config); } return list; } }
|
DatabaseTableConfigLoader { public static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader) throws SQLException { List<DatabaseTableConfig<?>> list = new ArrayList<DatabaseTableConfig<?>>(); while (true) { DatabaseTableConfig<?> config = DatabaseTableConfigLoader.fromReader(reader); if (config == null) { break; } list.add(config); } return list; } static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader); static DatabaseTableConfig<T> fromReader(BufferedReader reader); static void write(BufferedWriter writer, DatabaseTableConfig<T> config); }
|
DatabaseTableConfigLoader { public static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader) throws SQLException { List<DatabaseTableConfig<?>> list = new ArrayList<DatabaseTableConfig<?>>(); while (true) { DatabaseTableConfig<?> config = DatabaseTableConfigLoader.fromReader(reader); if (config == null) { break; } list.add(config); } return list; } static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader); static DatabaseTableConfig<T> fromReader(BufferedReader reader); static void write(BufferedWriter writer, DatabaseTableConfig<T> config); }
|
@Test(expected = IllegalArgumentException.class) public void testConfigUnknownClass() throws Exception { StringBuilder value = new StringBuilder(); value.append(TABLE_START); value.append("dataClass=unknown.class.name.okay").append(LINE_SEP); value.append("# --table-fields-start--").append(LINE_SEP); value.append("# --field-start--").append(LINE_SEP); value.append("fieldName=xxx").append(LINE_SEP); value.append("# --field-end--").append(LINE_SEP); value.append("# --table-fields-end--").append(LINE_SEP); value.append(TABLE_END); DatabaseTableConfigLoader.loadDatabaseConfigFromReader(new BufferedReader(new StringReader(value.toString()))); }
|
public static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader) throws SQLException { List<DatabaseTableConfig<?>> list = new ArrayList<DatabaseTableConfig<?>>(); while (true) { DatabaseTableConfig<?> config = DatabaseTableConfigLoader.fromReader(reader); if (config == null) { break; } list.add(config); } return list; }
|
DatabaseTableConfigLoader { public static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader) throws SQLException { List<DatabaseTableConfig<?>> list = new ArrayList<DatabaseTableConfig<?>>(); while (true) { DatabaseTableConfig<?> config = DatabaseTableConfigLoader.fromReader(reader); if (config == null) { break; } list.add(config); } return list; } }
|
DatabaseTableConfigLoader { public static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader) throws SQLException { List<DatabaseTableConfig<?>> list = new ArrayList<DatabaseTableConfig<?>>(); while (true) { DatabaseTableConfig<?> config = DatabaseTableConfigLoader.fromReader(reader); if (config == null) { break; } list.add(config); } return list; } }
|
DatabaseTableConfigLoader { public static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader) throws SQLException { List<DatabaseTableConfig<?>> list = new ArrayList<DatabaseTableConfig<?>>(); while (true) { DatabaseTableConfig<?> config = DatabaseTableConfigLoader.fromReader(reader); if (config == null) { break; } list.add(config); } return list; } static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader); static DatabaseTableConfig<T> fromReader(BufferedReader reader); static void write(BufferedWriter writer, DatabaseTableConfig<T> config); }
|
DatabaseTableConfigLoader { public static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader) throws SQLException { List<DatabaseTableConfig<?>> list = new ArrayList<DatabaseTableConfig<?>>(); while (true) { DatabaseTableConfig<?> config = DatabaseTableConfigLoader.fromReader(reader); if (config == null) { break; } list.add(config); } return list; } static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader); static DatabaseTableConfig<T> fromReader(BufferedReader reader); static void write(BufferedWriter writer, DatabaseTableConfig<T> config); }
|
@Test public void testQuickEndOfConfig() throws Exception { StringBuilder value = new StringBuilder(); value.append(TABLE_START); value.append("dataClass=").append(Foo.class.getName()).append(LINE_SEP); value.append("# --table-fields-start--").append(LINE_SEP); value.append("# --field-start--").append(LINE_SEP); value.append("fieldName=xxx").append(LINE_SEP); value.append("# --field-end--").append(LINE_SEP); value.append("# --field-start--").append(LINE_SEP); List<DatabaseTableConfig<?>> tables = DatabaseTableConfigLoader.loadDatabaseConfigFromReader(new BufferedReader(new StringReader( value.toString()))); assertEquals(1, tables.size()); DatabaseTableConfig<?> config = tables.get(0); List<DatabaseFieldConfig> fields = config.getFieldConfigs(); assertEquals(1, fields.size()); }
|
public static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader) throws SQLException { List<DatabaseTableConfig<?>> list = new ArrayList<DatabaseTableConfig<?>>(); while (true) { DatabaseTableConfig<?> config = DatabaseTableConfigLoader.fromReader(reader); if (config == null) { break; } list.add(config); } return list; }
|
DatabaseTableConfigLoader { public static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader) throws SQLException { List<DatabaseTableConfig<?>> list = new ArrayList<DatabaseTableConfig<?>>(); while (true) { DatabaseTableConfig<?> config = DatabaseTableConfigLoader.fromReader(reader); if (config == null) { break; } list.add(config); } return list; } }
|
DatabaseTableConfigLoader { public static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader) throws SQLException { List<DatabaseTableConfig<?>> list = new ArrayList<DatabaseTableConfig<?>>(); while (true) { DatabaseTableConfig<?> config = DatabaseTableConfigLoader.fromReader(reader); if (config == null) { break; } list.add(config); } return list; } }
|
DatabaseTableConfigLoader { public static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader) throws SQLException { List<DatabaseTableConfig<?>> list = new ArrayList<DatabaseTableConfig<?>>(); while (true) { DatabaseTableConfig<?> config = DatabaseTableConfigLoader.fromReader(reader); if (config == null) { break; } list.add(config); } return list; } static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader); static DatabaseTableConfig<T> fromReader(BufferedReader reader); static void write(BufferedWriter writer, DatabaseTableConfig<T> config); }
|
DatabaseTableConfigLoader { public static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader) throws SQLException { List<DatabaseTableConfig<?>> list = new ArrayList<DatabaseTableConfig<?>>(); while (true) { DatabaseTableConfig<?> config = DatabaseTableConfigLoader.fromReader(reader); if (config == null) { break; } list.add(config); } return list; } static List<DatabaseTableConfig<?>> loadDatabaseConfigFromReader(BufferedReader reader); static DatabaseTableConfig<T> fromReader(BufferedReader reader); static void write(BufferedWriter writer, DatabaseTableConfig<T> config); }
|
@Test public void testDatabaseTableConfig() throws SQLException { DatabaseTableConfig<DatabaseTableAnno> dbTableConf = DatabaseTableConfig.fromClass(connectionSource, DatabaseTableAnno.class); assertEquals(DatabaseTableAnno.class, dbTableConf.getDataClass()); assertEquals(TABLE_NAME, dbTableConf.getTableName()); dbTableConf.extractFieldTypes(connectionSource); FieldType[] fieldTypes = dbTableConf.getFieldTypes(databaseType); assertEquals(1, fieldTypes.length); assertEquals("stuff", fieldTypes[0].getColumnName()); }
|
public DatabaseTableConfig() { }
|
DatabaseTableConfig { public DatabaseTableConfig() { } }
|
DatabaseTableConfig { public DatabaseTableConfig() { } DatabaseTableConfig(); DatabaseTableConfig(Class<T> dataClass, List<DatabaseFieldConfig> fieldConfigs); DatabaseTableConfig(Class<T> dataClass, String tableName, List<DatabaseFieldConfig> fieldConfigs); private DatabaseTableConfig(Class<T> dataClass, String tableName, FieldType[] fieldTypes); }
|
DatabaseTableConfig { public DatabaseTableConfig() { } DatabaseTableConfig(); DatabaseTableConfig(Class<T> dataClass, List<DatabaseFieldConfig> fieldConfigs); DatabaseTableConfig(Class<T> dataClass, String tableName, List<DatabaseFieldConfig> fieldConfigs); private DatabaseTableConfig(Class<T> dataClass, String tableName, FieldType[] fieldTypes); void initialize(); Class<T> getDataClass(); void setDataClass(Class<T> dataClass); String getTableName(); void setTableName(String tableName); void setFieldConfigs(List<DatabaseFieldConfig> fieldConfigs); void extractFieldTypes(ConnectionSource connectionSource); FieldType[] getFieldTypes(DatabaseType databaseType); List<DatabaseFieldConfig> getFieldConfigs(); Constructor<T> getConstructor(); void setConstructor(Constructor<T> constructor); static DatabaseTableConfig<T> fromClass(ConnectionSource connectionSource, Class<T> clazz); static String extractTableName(Class<T> clazz); static Constructor<T> findNoArgConstructor(Class<T> dataClass); }
|
DatabaseTableConfig { public DatabaseTableConfig() { } DatabaseTableConfig(); DatabaseTableConfig(Class<T> dataClass, List<DatabaseFieldConfig> fieldConfigs); DatabaseTableConfig(Class<T> dataClass, String tableName, List<DatabaseFieldConfig> fieldConfigs); private DatabaseTableConfig(Class<T> dataClass, String tableName, FieldType[] fieldTypes); void initialize(); Class<T> getDataClass(); void setDataClass(Class<T> dataClass); String getTableName(); void setTableName(String tableName); void setFieldConfigs(List<DatabaseFieldConfig> fieldConfigs); void extractFieldTypes(ConnectionSource connectionSource); FieldType[] getFieldTypes(DatabaseType databaseType); List<DatabaseFieldConfig> getFieldConfigs(); Constructor<T> getConstructor(); void setConstructor(Constructor<T> constructor); static DatabaseTableConfig<T> fromClass(ConnectionSource connectionSource, Class<T> clazz); static String extractTableName(Class<T> clazz); static Constructor<T> findNoArgConstructor(Class<T> dataClass); }
|
@Test public void testSetFieldConfigs() throws SQLException { DatabaseTableConfig<DatabaseTableAnno> dbTableConf = new DatabaseTableConfig<DatabaseTableAnno>(); dbTableConf.setDataClass(DatabaseTableAnno.class); dbTableConf.setTableName(TABLE_NAME); List<DatabaseFieldConfig> fieldConfigs = new ArrayList<DatabaseFieldConfig>(); fieldConfigs.add(new DatabaseFieldConfig("stuff", null, DataType.UNKNOWN, "", 0, true, false, false, null, false, null, false, null, false, null, false, null, null, false, DatabaseFieldConfig.NO_MAX_FOREIGN_AUTO_REFRESH_LEVEL_SPECIFIED, 0)); dbTableConf.setFieldConfigs(fieldConfigs); dbTableConf.initialize(); assertEquals(DatabaseTableAnno.class, dbTableConf.getDataClass()); assertEquals(TABLE_NAME, dbTableConf.getTableName()); dbTableConf.extractFieldTypes(connectionSource); FieldType[] fieldTypes = dbTableConf.getFieldTypes(databaseType); assertEquals(1, fieldTypes.length); assertEquals("stuff", fieldTypes[0].getColumnName()); }
|
public void setFieldConfigs(List<DatabaseFieldConfig> fieldConfigs) { this.fieldConfigs = fieldConfigs; }
|
DatabaseTableConfig { public void setFieldConfigs(List<DatabaseFieldConfig> fieldConfigs) { this.fieldConfigs = fieldConfigs; } }
|
DatabaseTableConfig { public void setFieldConfigs(List<DatabaseFieldConfig> fieldConfigs) { this.fieldConfigs = fieldConfigs; } DatabaseTableConfig(); DatabaseTableConfig(Class<T> dataClass, List<DatabaseFieldConfig> fieldConfigs); DatabaseTableConfig(Class<T> dataClass, String tableName, List<DatabaseFieldConfig> fieldConfigs); private DatabaseTableConfig(Class<T> dataClass, String tableName, FieldType[] fieldTypes); }
|
DatabaseTableConfig { public void setFieldConfigs(List<DatabaseFieldConfig> fieldConfigs) { this.fieldConfigs = fieldConfigs; } DatabaseTableConfig(); DatabaseTableConfig(Class<T> dataClass, List<DatabaseFieldConfig> fieldConfigs); DatabaseTableConfig(Class<T> dataClass, String tableName, List<DatabaseFieldConfig> fieldConfigs); private DatabaseTableConfig(Class<T> dataClass, String tableName, FieldType[] fieldTypes); void initialize(); Class<T> getDataClass(); void setDataClass(Class<T> dataClass); String getTableName(); void setTableName(String tableName); void setFieldConfigs(List<DatabaseFieldConfig> fieldConfigs); void extractFieldTypes(ConnectionSource connectionSource); FieldType[] getFieldTypes(DatabaseType databaseType); List<DatabaseFieldConfig> getFieldConfigs(); Constructor<T> getConstructor(); void setConstructor(Constructor<T> constructor); static DatabaseTableConfig<T> fromClass(ConnectionSource connectionSource, Class<T> clazz); static String extractTableName(Class<T> clazz); static Constructor<T> findNoArgConstructor(Class<T> dataClass); }
|
DatabaseTableConfig { public void setFieldConfigs(List<DatabaseFieldConfig> fieldConfigs) { this.fieldConfigs = fieldConfigs; } DatabaseTableConfig(); DatabaseTableConfig(Class<T> dataClass, List<DatabaseFieldConfig> fieldConfigs); DatabaseTableConfig(Class<T> dataClass, String tableName, List<DatabaseFieldConfig> fieldConfigs); private DatabaseTableConfig(Class<T> dataClass, String tableName, FieldType[] fieldTypes); void initialize(); Class<T> getDataClass(); void setDataClass(Class<T> dataClass); String getTableName(); void setTableName(String tableName); void setFieldConfigs(List<DatabaseFieldConfig> fieldConfigs); void extractFieldTypes(ConnectionSource connectionSource); FieldType[] getFieldTypes(DatabaseType databaseType); List<DatabaseFieldConfig> getFieldConfigs(); Constructor<T> getConstructor(); void setConstructor(Constructor<T> constructor); static DatabaseTableConfig<T> fromClass(ConnectionSource connectionSource, Class<T> clazz); static String extractTableName(Class<T> clazz); static Constructor<T> findNoArgConstructor(Class<T> dataClass); }
|
@Test(expected = IllegalStateException.class) public void testBadSpringWiring() { DatabaseTableConfig<NoFields> dbTableConf = new DatabaseTableConfig<NoFields>(); dbTableConf.initialize(); }
|
public void initialize() { if (dataClass == null) { throw new IllegalStateException("dataClass was never set on " + getClass().getSimpleName()); } if (tableName == null) { tableName = extractTableName(dataClass); } }
|
DatabaseTableConfig { public void initialize() { if (dataClass == null) { throw new IllegalStateException("dataClass was never set on " + getClass().getSimpleName()); } if (tableName == null) { tableName = extractTableName(dataClass); } } }
|
DatabaseTableConfig { public void initialize() { if (dataClass == null) { throw new IllegalStateException("dataClass was never set on " + getClass().getSimpleName()); } if (tableName == null) { tableName = extractTableName(dataClass); } } DatabaseTableConfig(); DatabaseTableConfig(Class<T> dataClass, List<DatabaseFieldConfig> fieldConfigs); DatabaseTableConfig(Class<T> dataClass, String tableName, List<DatabaseFieldConfig> fieldConfigs); private DatabaseTableConfig(Class<T> dataClass, String tableName, FieldType[] fieldTypes); }
|
DatabaseTableConfig { public void initialize() { if (dataClass == null) { throw new IllegalStateException("dataClass was never set on " + getClass().getSimpleName()); } if (tableName == null) { tableName = extractTableName(dataClass); } } DatabaseTableConfig(); DatabaseTableConfig(Class<T> dataClass, List<DatabaseFieldConfig> fieldConfigs); DatabaseTableConfig(Class<T> dataClass, String tableName, List<DatabaseFieldConfig> fieldConfigs); private DatabaseTableConfig(Class<T> dataClass, String tableName, FieldType[] fieldTypes); void initialize(); Class<T> getDataClass(); void setDataClass(Class<T> dataClass); String getTableName(); void setTableName(String tableName); void setFieldConfigs(List<DatabaseFieldConfig> fieldConfigs); void extractFieldTypes(ConnectionSource connectionSource); FieldType[] getFieldTypes(DatabaseType databaseType); List<DatabaseFieldConfig> getFieldConfigs(); Constructor<T> getConstructor(); void setConstructor(Constructor<T> constructor); static DatabaseTableConfig<T> fromClass(ConnectionSource connectionSource, Class<T> clazz); static String extractTableName(Class<T> clazz); static Constructor<T> findNoArgConstructor(Class<T> dataClass); }
|
DatabaseTableConfig { public void initialize() { if (dataClass == null) { throw new IllegalStateException("dataClass was never set on " + getClass().getSimpleName()); } if (tableName == null) { tableName = extractTableName(dataClass); } } DatabaseTableConfig(); DatabaseTableConfig(Class<T> dataClass, List<DatabaseFieldConfig> fieldConfigs); DatabaseTableConfig(Class<T> dataClass, String tableName, List<DatabaseFieldConfig> fieldConfigs); private DatabaseTableConfig(Class<T> dataClass, String tableName, FieldType[] fieldTypes); void initialize(); Class<T> getDataClass(); void setDataClass(Class<T> dataClass); String getTableName(); void setTableName(String tableName); void setFieldConfigs(List<DatabaseFieldConfig> fieldConfigs); void extractFieldTypes(ConnectionSource connectionSource); FieldType[] getFieldTypes(DatabaseType databaseType); List<DatabaseFieldConfig> getFieldConfigs(); Constructor<T> getConstructor(); void setConstructor(Constructor<T> constructor); static DatabaseTableConfig<T> fromClass(ConnectionSource connectionSource, Class<T> clazz); static String extractTableName(Class<T> clazz); static Constructor<T> findNoArgConstructor(Class<T> dataClass); }
|
@Test public void testStringLiteral4() throws Exception { String sql = "select #if (!'') ok #end"; ASTRootNode n = new Parser(sql).parse().init(); ParameterContext ctx = getParameterContext(Lists.newArrayList((Type) String.class)); n.checkAndBind(ctx); InvocationContext context = DefaultInvocationContext.create(); context.addParameter("1", "hello2"); n.render(context); BoundSql boundSql = context.getBoundSql(); assertThat(boundSql.getSql(), Matchers.equalTo("select ok ")); }
|
final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); final ASTRootNode parse(); final void DML(); final void Insert(); final void Delete(); final void Update(); final void Select(); final void Replace(); final void Merge(); final void Truncate(); final void Statement(); final void JDBCParameter(); final void JDBCIterableParameter(); final void GlobalTable(); final void JoinParameter(); final void QuoteText(); final void Text(); final void Blank(); final void IfStatement(); final void ElseStatement(); final void ElseIfStatement(); final void Expression(); final void ConditionalOrExpression(); final void ConditionalAndExpression(); final void RelationalExpression(); final void UnaryExpression(); final void PrimaryExpression(); final void ExpressionParameter(); final void IntegerLiteral(); final void StringLiteral(); final void True(); final void False(); final void Null(); void ReInit(java.io.InputStream stream); void ReInit(java.io.InputStream stream, String encoding); void ReInit(Reader stream); void ReInit(ParserTokenManager tm); final Token getNextToken(); final Token getToken(int index); ParseException generateParseException(); final void enable_tracing(); final void disable_tracing(); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); final ASTRootNode parse(); final void DML(); final void Insert(); final void Delete(); final void Update(); final void Select(); final void Replace(); final void Merge(); final void Truncate(); final void Statement(); final void JDBCParameter(); final void JDBCIterableParameter(); final void GlobalTable(); final void JoinParameter(); final void QuoteText(); final void Text(); final void Blank(); final void IfStatement(); final void ElseStatement(); final void ElseIfStatement(); final void Expression(); final void ConditionalOrExpression(); final void ConditionalAndExpression(); final void RelationalExpression(); final void UnaryExpression(); final void PrimaryExpression(); final void ExpressionParameter(); final void IntegerLiteral(); final void StringLiteral(); final void True(); final void False(); final void Null(); void ReInit(java.io.InputStream stream); void ReInit(java.io.InputStream stream, String encoding); void ReInit(Reader stream); void ReInit(ParserTokenManager tm); final Token getNextToken(); final Token getToken(int index); ParseException generateParseException(); final void enable_tracing(); final void disable_tracing(); public ParserTokenManager token_source; public Token token; public Token jj_nt; }
|
@Test public void testMsg() throws Exception { ConsoleLogger logger = new ConsoleLogger("org"); logger.trace("ok"); }
|
@Override public void trace(String msg) { println(msg); }
|
ConsoleLogger extends AbstractInternalLogger { @Override public void trace(String msg) { println(msg); } }
|
ConsoleLogger extends AbstractInternalLogger { @Override public void trace(String msg) { println(msg); } protected ConsoleLogger(String name); }
|
ConsoleLogger extends AbstractInternalLogger { @Override public void trace(String msg) { println(msg); } protected ConsoleLogger(String name); @Override boolean isTraceEnabled(); @Override void trace(String msg); @Override void trace(String format, Object arg); @Override void trace(String format, Object argA, Object argB); @Override void trace(String format, Object... arguments); @Override void trace(String msg, Throwable t); @Override boolean isDebugEnabled(); @Override void debug(String msg); @Override void debug(String format, Object arg); @Override void debug(String format, Object argA, Object argB); @Override void debug(String format, Object... arguments); @Override void debug(String msg, Throwable t); @Override boolean isInfoEnabled(); @Override void info(String msg); @Override void info(String format, Object arg); @Override void info(String format, Object argA, Object argB); @Override void info(String format, Object... arguments); @Override void info(String msg, Throwable t); @Override boolean isWarnEnabled(); @Override void warn(String msg); @Override void warn(String format, Object arg); @Override void warn(String format, Object... arguments); @Override void warn(String format, Object argA, Object argB); @Override void warn(String msg, Throwable t); @Override boolean isErrorEnabled(); @Override void error(String msg); @Override void error(String format, Object arg); @Override void error(String format, Object argA, Object argB); @Override void error(String format, Object... arguments); @Override void error(String msg, Throwable t); }
|
ConsoleLogger extends AbstractInternalLogger { @Override public void trace(String msg) { println(msg); } protected ConsoleLogger(String name); @Override boolean isTraceEnabled(); @Override void trace(String msg); @Override void trace(String format, Object arg); @Override void trace(String format, Object argA, Object argB); @Override void trace(String format, Object... arguments); @Override void trace(String msg, Throwable t); @Override boolean isDebugEnabled(); @Override void debug(String msg); @Override void debug(String format, Object arg); @Override void debug(String format, Object argA, Object argB); @Override void debug(String format, Object... arguments); @Override void debug(String msg, Throwable t); @Override boolean isInfoEnabled(); @Override void info(String msg); @Override void info(String format, Object arg); @Override void info(String format, Object argA, Object argB); @Override void info(String format, Object... arguments); @Override void info(String msg, Throwable t); @Override boolean isWarnEnabled(); @Override void warn(String msg); @Override void warn(String format, Object arg); @Override void warn(String format, Object... arguments); @Override void warn(String format, Object argA, Object argB); @Override void warn(String msg, Throwable t); @Override boolean isErrorEnabled(); @Override void error(String msg); @Override void error(String format, Object arg); @Override void error(String format, Object argA, Object argB); @Override void error(String format, Object... arguments); @Override void error(String msg, Throwable t); }
|
@Test(expected = SQLException.class) public void testNoFields() throws SQLException { new DatabaseTableConfig<DatabaseTableAnno>().getFieldTypes(databaseType); }
|
public FieldType[] getFieldTypes(DatabaseType databaseType) throws SQLException { if (fieldTypes == null) { throw new SQLException("Field types have not been extracted in table config"); } return fieldTypes; }
|
DatabaseTableConfig { public FieldType[] getFieldTypes(DatabaseType databaseType) throws SQLException { if (fieldTypes == null) { throw new SQLException("Field types have not been extracted in table config"); } return fieldTypes; } }
|
DatabaseTableConfig { public FieldType[] getFieldTypes(DatabaseType databaseType) throws SQLException { if (fieldTypes == null) { throw new SQLException("Field types have not been extracted in table config"); } return fieldTypes; } DatabaseTableConfig(); DatabaseTableConfig(Class<T> dataClass, List<DatabaseFieldConfig> fieldConfigs); DatabaseTableConfig(Class<T> dataClass, String tableName, List<DatabaseFieldConfig> fieldConfigs); private DatabaseTableConfig(Class<T> dataClass, String tableName, FieldType[] fieldTypes); }
|
DatabaseTableConfig { public FieldType[] getFieldTypes(DatabaseType databaseType) throws SQLException { if (fieldTypes == null) { throw new SQLException("Field types have not been extracted in table config"); } return fieldTypes; } DatabaseTableConfig(); DatabaseTableConfig(Class<T> dataClass, List<DatabaseFieldConfig> fieldConfigs); DatabaseTableConfig(Class<T> dataClass, String tableName, List<DatabaseFieldConfig> fieldConfigs); private DatabaseTableConfig(Class<T> dataClass, String tableName, FieldType[] fieldTypes); void initialize(); Class<T> getDataClass(); void setDataClass(Class<T> dataClass); String getTableName(); void setTableName(String tableName); void setFieldConfigs(List<DatabaseFieldConfig> fieldConfigs); void extractFieldTypes(ConnectionSource connectionSource); FieldType[] getFieldTypes(DatabaseType databaseType); List<DatabaseFieldConfig> getFieldConfigs(); Constructor<T> getConstructor(); void setConstructor(Constructor<T> constructor); static DatabaseTableConfig<T> fromClass(ConnectionSource connectionSource, Class<T> clazz); static String extractTableName(Class<T> clazz); static Constructor<T> findNoArgConstructor(Class<T> dataClass); }
|
DatabaseTableConfig { public FieldType[] getFieldTypes(DatabaseType databaseType) throws SQLException { if (fieldTypes == null) { throw new SQLException("Field types have not been extracted in table config"); } return fieldTypes; } DatabaseTableConfig(); DatabaseTableConfig(Class<T> dataClass, List<DatabaseFieldConfig> fieldConfigs); DatabaseTableConfig(Class<T> dataClass, String tableName, List<DatabaseFieldConfig> fieldConfigs); private DatabaseTableConfig(Class<T> dataClass, String tableName, FieldType[] fieldTypes); void initialize(); Class<T> getDataClass(); void setDataClass(Class<T> dataClass); String getTableName(); void setTableName(String tableName); void setFieldConfigs(List<DatabaseFieldConfig> fieldConfigs); void extractFieldTypes(ConnectionSource connectionSource); FieldType[] getFieldTypes(DatabaseType databaseType); List<DatabaseFieldConfig> getFieldConfigs(); Constructor<T> getConstructor(); void setConstructor(Constructor<T> constructor); static DatabaseTableConfig<T> fromClass(ConnectionSource connectionSource, Class<T> clazz); static String extractTableName(Class<T> clazz); static Constructor<T> findNoArgConstructor(Class<T> dataClass); }
|
@Test public void testCreateStatements() throws Exception { List<String> stmts = TableUtils.getCreateTableStatements(connectionSource, LocalFoo.class); assertEquals(1, stmts.size()); assertEquals(expectedCreateStatement(), stmts.get(0)); }
|
public static <T, ID> List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); if (dao instanceof BaseDaoImpl<?, ?>) { return addCreateTableStatements(connectionSource, ((BaseDaoImpl<?, ?>) dao).getTableInfo(), false); } else { TableInfo<T, ID> tableInfo = new TableInfo<T, ID>(connectionSource, null, dataClass); return addCreateTableStatements(connectionSource, tableInfo, false); } }
|
TableUtils { public static <T, ID> List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); if (dao instanceof BaseDaoImpl<?, ?>) { return addCreateTableStatements(connectionSource, ((BaseDaoImpl<?, ?>) dao).getTableInfo(), false); } else { TableInfo<T, ID> tableInfo = new TableInfo<T, ID>(connectionSource, null, dataClass); return addCreateTableStatements(connectionSource, tableInfo, false); } } }
|
TableUtils { public static <T, ID> List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); if (dao instanceof BaseDaoImpl<?, ?>) { return addCreateTableStatements(connectionSource, ((BaseDaoImpl<?, ?>) dao).getTableInfo(), false); } else { TableInfo<T, ID> tableInfo = new TableInfo<T, ID>(connectionSource, null, dataClass); return addCreateTableStatements(connectionSource, tableInfo, false); } } private TableUtils(); }
|
TableUtils { public static <T, ID> List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); if (dao instanceof BaseDaoImpl<?, ?>) { return addCreateTableStatements(connectionSource, ((BaseDaoImpl<?, ?>) dao).getTableInfo(), false); } else { TableInfo<T, ID> tableInfo = new TableInfo<T, ID>(connectionSource, null, dataClass); return addCreateTableStatements(connectionSource, tableInfo, false); } } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
TableUtils { public static <T, ID> List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); if (dao instanceof BaseDaoImpl<?, ?>) { return addCreateTableStatements(connectionSource, ((BaseDaoImpl<?, ?>) dao).getTableInfo(), false); } else { TableInfo<T, ID> tableInfo = new TableInfo<T, ID>(connectionSource, null, dataClass); return addCreateTableStatements(connectionSource, tableInfo, false); } } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
@Test public void testCreateStatementsTableConfig() throws Exception { List<String> stmts = TableUtils.getCreateTableStatements(connectionSource, DatabaseTableConfig.fromClass(connectionSource, LocalFoo.class)); assertEquals(1, stmts.size()); assertEquals(expectedCreateStatement(), stmts.get(0)); }
|
public static <T, ID> List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); if (dao instanceof BaseDaoImpl<?, ?>) { return addCreateTableStatements(connectionSource, ((BaseDaoImpl<?, ?>) dao).getTableInfo(), false); } else { TableInfo<T, ID> tableInfo = new TableInfo<T, ID>(connectionSource, null, dataClass); return addCreateTableStatements(connectionSource, tableInfo, false); } }
|
TableUtils { public static <T, ID> List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); if (dao instanceof BaseDaoImpl<?, ?>) { return addCreateTableStatements(connectionSource, ((BaseDaoImpl<?, ?>) dao).getTableInfo(), false); } else { TableInfo<T, ID> tableInfo = new TableInfo<T, ID>(connectionSource, null, dataClass); return addCreateTableStatements(connectionSource, tableInfo, false); } } }
|
TableUtils { public static <T, ID> List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); if (dao instanceof BaseDaoImpl<?, ?>) { return addCreateTableStatements(connectionSource, ((BaseDaoImpl<?, ?>) dao).getTableInfo(), false); } else { TableInfo<T, ID> tableInfo = new TableInfo<T, ID>(connectionSource, null, dataClass); return addCreateTableStatements(connectionSource, tableInfo, false); } } private TableUtils(); }
|
TableUtils { public static <T, ID> List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); if (dao instanceof BaseDaoImpl<?, ?>) { return addCreateTableStatements(connectionSource, ((BaseDaoImpl<?, ?>) dao).getTableInfo(), false); } else { TableInfo<T, ID> tableInfo = new TableInfo<T, ID>(connectionSource, null, dataClass); return addCreateTableStatements(connectionSource, tableInfo, false); } } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
TableUtils { public static <T, ID> List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); if (dao instanceof BaseDaoImpl<?, ?>) { return addCreateTableStatements(connectionSource, ((BaseDaoImpl<?, ?>) dao).getTableInfo(), false); } else { TableInfo<T, ID> tableInfo = new TableInfo<T, ID>(connectionSource, null, dataClass); return addCreateTableStatements(connectionSource, tableInfo, false); } } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
@Test public void testCreateTableQueriesAfter() throws Exception { final String queryAfter = "SELECT * from foo"; DatabaseType databaseType = new H2DatabaseType() { @Override public void appendColumnArg(String tableName, StringBuilder sb, FieldType fieldType, List<String> additionalArgs, List<String> statementsBefore, List<String> statementsAfter, List<String> queriesAfter) throws SQLException { super.appendColumnArg(tableName, sb, fieldType, additionalArgs, statementsBefore, statementsAfter, queriesAfter); if (fieldType.getColumnName().equals(LocalFoo.ID_FIELD_NAME)) { queriesAfter.add(queryAfter); } } }; final ConnectionSource connectionSource = createMock(ConnectionSource.class); testCreate("localfoo", connectionSource, databaseType, 0, false, queryAfter, new Callable<Integer>() { @Override public Integer call() throws Exception { return TableUtils.createTable(connectionSource, LocalFoo.class); } }); }
|
public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } private TableUtils(); }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
@Test(expected = SQLException.class) public void testCreateTableThrow() throws Exception { final ConnectionSource connectionSource = createMock(ConnectionSource.class); testCreate("localfoo", connectionSource, databaseType, 1, true, null, new Callable<Integer>() { @Override public Integer call() throws Exception { return TableUtils.createTable(connectionSource, LocalFoo.class); } }); }
|
public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } private TableUtils(); }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
@Test(expected = SQLException.class) public void testCreateTableAboveZero() throws Exception { final ConnectionSource connectionSource = createMock(ConnectionSource.class); testCreate("localfoo", connectionSource, databaseType, 1, false, null, new Callable<Integer>() { @Override public Integer call() throws Exception { return TableUtils.createTable(connectionSource, LocalFoo.class); } }); }
|
public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } private TableUtils(); }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
@Test(expected = SQLException.class) public void testCreateTableBelowZero() throws Exception { final ConnectionSource connectionSource = createMock(ConnectionSource.class); testCreate("localfoo", connectionSource, databaseType, -1, false, null, new Callable<Integer>() { @Override public Integer call() throws Exception { return TableUtils.createTable(connectionSource, LocalFoo.class); } }); }
|
public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } private TableUtils(); }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
@Test public void testCreateTableTableConfig() throws Exception { final ConnectionSource connectionSource = createMock(ConnectionSource.class); testCreate("localfoo", connectionSource, databaseType, 0, false, null, new Callable<Integer>() { @Override public Integer call() throws Exception { return (int) TableUtils.createTable(connectionSource, DatabaseTableConfig.fromClass(connectionSource, LocalFoo.class)); } }); }
|
public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } private TableUtils(); }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
@Test public void testDropTable() throws Exception { final ConnectionSource connectionSource = createMock(ConnectionSource.class); testDrop("localfoo", connectionSource, 0, false, new Callable<Integer>() { @Override public Integer call() throws Exception { return (int) TableUtils.dropTable(connectionSource, LocalFoo.class, false); } }); }
|
public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } private TableUtils(); }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
@Test(expected = SQLException.class) public void testDropTableThrow() throws Exception { final ConnectionSource connectionSource = createMock(ConnectionSource.class); testDrop("localfoo", connectionSource, 0, true, new Callable<Integer>() { @Override public Integer call() throws Exception { return (int) TableUtils.dropTable(connectionSource, LocalFoo.class, false); } }); }
|
public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } private TableUtils(); }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
@Test public void testStringLiteral5() throws Exception { String sql = "select #if (:1) ok #end"; ASTRootNode n = new Parser(sql).parse().init(); ParameterContext ctx = getParameterContext(Lists.newArrayList((Type) String.class)); n.checkAndBind(ctx); InvocationContext context = DefaultInvocationContext.create(); context.addParameter("1", "he"); n.render(context); BoundSql boundSql = context.getBoundSql(); assertThat(boundSql.getSql(), Matchers.equalTo("select ok ")); }
|
final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); final ASTRootNode parse(); final void DML(); final void Insert(); final void Delete(); final void Update(); final void Select(); final void Replace(); final void Merge(); final void Truncate(); final void Statement(); final void JDBCParameter(); final void JDBCIterableParameter(); final void GlobalTable(); final void JoinParameter(); final void QuoteText(); final void Text(); final void Blank(); final void IfStatement(); final void ElseStatement(); final void ElseIfStatement(); final void Expression(); final void ConditionalOrExpression(); final void ConditionalAndExpression(); final void RelationalExpression(); final void UnaryExpression(); final void PrimaryExpression(); final void ExpressionParameter(); final void IntegerLiteral(); final void StringLiteral(); final void True(); final void False(); final void Null(); void ReInit(java.io.InputStream stream); void ReInit(java.io.InputStream stream, String encoding); void ReInit(Reader stream); void ReInit(ParserTokenManager tm); final Token getNextToken(); final Token getToken(int index); ParseException generateParseException(); final void enable_tracing(); final void disable_tracing(); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); final ASTRootNode parse(); final void DML(); final void Insert(); final void Delete(); final void Update(); final void Select(); final void Replace(); final void Merge(); final void Truncate(); final void Statement(); final void JDBCParameter(); final void JDBCIterableParameter(); final void GlobalTable(); final void JoinParameter(); final void QuoteText(); final void Text(); final void Blank(); final void IfStatement(); final void ElseStatement(); final void ElseIfStatement(); final void Expression(); final void ConditionalOrExpression(); final void ConditionalAndExpression(); final void RelationalExpression(); final void UnaryExpression(); final void PrimaryExpression(); final void ExpressionParameter(); final void IntegerLiteral(); final void StringLiteral(); final void True(); final void False(); final void Null(); void ReInit(java.io.InputStream stream); void ReInit(java.io.InputStream stream, String encoding); void ReInit(Reader stream); void ReInit(ParserTokenManager tm); final Token getNextToken(); final Token getToken(int index); ParseException generateParseException(); final void enable_tracing(); final void disable_tracing(); public ParserTokenManager token_source; public Token token; public Token jj_nt; }
|
@Test public void testDropTableThrowIgnore() throws Exception { final ConnectionSource connectionSource = createMock(ConnectionSource.class); testDrop("localfoo", connectionSource, 0, true, new Callable<Integer>() { @Override public Integer call() throws Exception { return (int) TableUtils.dropTable(connectionSource, LocalFoo.class, true); } }); }
|
public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } private TableUtils(); }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
@Test(expected = SQLException.class) public void testDropTableNegRows() throws Exception { final ConnectionSource connectionSource = createMock(ConnectionSource.class); testDrop("localfoo", connectionSource, -1, false, new Callable<Integer>() { @Override public Integer call() throws Exception { return (int) TableUtils.dropTable(connectionSource, LocalFoo.class, false); } }); }
|
public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } private TableUtils(); }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
@Test public void testDropTableTableConfig() throws Exception { final ConnectionSource connectionSource = createMock(ConnectionSource.class); testDrop("localfoo", connectionSource, 0, false, new Callable<Integer>() { @Override public Integer call() throws Exception { return (int) TableUtils.dropTable(connectionSource, DatabaseTableConfig.fromClass(connectionSource, LocalFoo.class), false); } }); }
|
public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } private TableUtils(); }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
@Test public void testCreateTable() throws Exception { Dao<LocalFoo, Integer> fooDao = createDao(LocalFoo.class, false); createTable(LocalFoo.class, false); assertEquals(0, fooDao.queryForAll().size()); dropTable(LocalFoo.class, true); try { fooDao.countOf(); fail("Was expecting a SQL exception"); } catch (Exception expected) { } createTable(LocalFoo.class, false); assertEquals(0, fooDao.queryForAll().size()); dropTable(LocalFoo.class, true); }
|
public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } private TableUtils(); }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
TableUtils { public static <T> int createTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, false); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
@Test public void testDropThenQuery() throws Exception { Dao<LocalFoo, Integer> fooDao = createDao(LocalFoo.class, true); assertEquals(0, fooDao.queryForAll().size()); dropTable(LocalFoo.class, true); try { fooDao.queryForAll(); fail("Should have thrown"); } catch (SQLException e) { } }
|
public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } private TableUtils(); }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
TableUtils { public static <T, ID> int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors) throws SQLException { Dao<T, ID> dao = DaoManager.createDao(connectionSource, dataClass); return dropTable(dao, ignoreErrors); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
@Test public void testClearTable() throws Exception { Dao<LocalFoo, Integer> fooDao = createDao(LocalFoo.class, true); assertEquals(0, fooDao.countOf()); LocalFoo foo = new LocalFoo(); assertEquals(1, fooDao.create(foo)); assertEquals(1, fooDao.countOf()); TableUtils.clearTable(connectionSource, LocalFoo.class); assertEquals(0, fooDao.countOf()); }
|
public static <T> int clearTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { String tableName = DatabaseTableConfig.extractTableName(dataClass); DatabaseType databaseType = connectionSource.getDatabaseType(); if (databaseType.isEntityNamesMustBeUpCase()) { tableName = databaseType.upCaseEntityName(tableName); } return clearTable(connectionSource, tableName); }
|
TableUtils { public static <T> int clearTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { String tableName = DatabaseTableConfig.extractTableName(dataClass); DatabaseType databaseType = connectionSource.getDatabaseType(); if (databaseType.isEntityNamesMustBeUpCase()) { tableName = databaseType.upCaseEntityName(tableName); } return clearTable(connectionSource, tableName); } }
|
TableUtils { public static <T> int clearTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { String tableName = DatabaseTableConfig.extractTableName(dataClass); DatabaseType databaseType = connectionSource.getDatabaseType(); if (databaseType.isEntityNamesMustBeUpCase()) { tableName = databaseType.upCaseEntityName(tableName); } return clearTable(connectionSource, tableName); } private TableUtils(); }
|
TableUtils { public static <T> int clearTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { String tableName = DatabaseTableConfig.extractTableName(dataClass); DatabaseType databaseType = connectionSource.getDatabaseType(); if (databaseType.isEntityNamesMustBeUpCase()) { tableName = databaseType.upCaseEntityName(tableName); } return clearTable(connectionSource, tableName); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
TableUtils { public static <T> int clearTable(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { String tableName = DatabaseTableConfig.extractTableName(dataClass); DatabaseType databaseType = connectionSource.getDatabaseType(); if (databaseType.isEntityNamesMustBeUpCase()) { tableName = databaseType.upCaseEntityName(tableName); } return clearTable(connectionSource, tableName); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
@Test public void testCreateTableIfNotExists() throws Exception { dropTable(LocalFoo.class, true); Dao<LocalFoo, Integer> fooDao = createDao(LocalFoo.class, false); try { fooDao.countOf(); fail("Should have thrown an exception"); } catch (Exception e) { } TableUtils.createTableIfNotExists(connectionSource, LocalFoo.class); assertEquals(0, fooDao.countOf()); TableUtils.createTableIfNotExists(connectionSource, LocalFoo.class); assertEquals(0, fooDao.countOf()); }
|
public static <T> int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, true); }
|
TableUtils { public static <T> int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, true); } }
|
TableUtils { public static <T> int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, true); } private TableUtils(); }
|
TableUtils { public static <T> int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, true); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
TableUtils { public static <T> int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass) throws SQLException { Dao<T, ?> dao = DaoManager.createDao(connectionSource, dataClass); return doCreateTable(dao, true); } private TableUtils(); static int createTable(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(Dao<?, ?> dao); static int createTableIfNotExists(ConnectionSource connectionSource, Class<T> dataClass); static int createTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static int createTableIfNotExists(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); static List<String> getCreateTableStatements(ConnectionSource connectionSource, Class<T> dataClass); static List<String> getCreateTableStatements(ConnectionSource connectionSource,
DatabaseTableConfig<T> tableConfig); static int dropTable(ConnectionSource connectionSource, Class<T> dataClass, boolean ignoreErrors); static int dropTable(Dao<T, ID> dao, boolean ignoreErrors); static int dropTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig,
boolean ignoreErrors); static int clearTable(ConnectionSource connectionSource, Class<T> dataClass); static int clearTable(ConnectionSource connectionSource, DatabaseTableConfig<T> tableConfig); }
|
@Test(expected = SQLException.class) public void testDriverNotFound() throws SQLException { new TestDatabaseType().loadDriver(); }
|
@Override public void loadDriver() throws SQLException { String className = getDriverClassName(); if (className != null) { try { Class.forName(className); } catch (ClassNotFoundException e) { throw SqlExceptionUtil.create("Driver class was not found for " + getDatabaseName() + " database. Missing jar with class " + className + ".", e); } } }
|
BaseDatabaseType implements DatabaseType { @Override public void loadDriver() throws SQLException { String className = getDriverClassName(); if (className != null) { try { Class.forName(className); } catch (ClassNotFoundException e) { throw SqlExceptionUtil.create("Driver class was not found for " + getDatabaseName() + " database. Missing jar with class " + className + ".", e); } } } }
|
BaseDatabaseType implements DatabaseType { @Override public void loadDriver() throws SQLException { String className = getDriverClassName(); if (className != null) { try { Class.forName(className); } catch (ClassNotFoundException e) { throw SqlExceptionUtil.create("Driver class was not found for " + getDatabaseName() + " database. Missing jar with class " + className + ".", e); } } } }
|
BaseDatabaseType implements DatabaseType { @Override public void loadDriver() throws SQLException { String className = getDriverClassName(); if (className != null) { try { Class.forName(className); } catch (ClassNotFoundException e) { throw SqlExceptionUtil.create("Driver class was not found for " + getDatabaseName() + " database. Missing jar with class " + className + ".", e); } } } @Override void loadDriver(); @Override void setDriver(Driver driver); @Override void appendColumnArg(String tableName, StringBuilder sb, FieldType fieldType, List<String> additionalArgs,
List<String> statementsBefore, List<String> statementsAfter, List<String> queriesAfter); @Override void addPrimaryKeySql(FieldType[] fieldTypes, List<String> additionalArgs, List<String> statementsBefore,
List<String> statementsAfter, List<String> queriesAfter); @Override void addUniqueComboSql(FieldType[] fieldTypes, List<String> additionalArgs, List<String> statementsBefore,
List<String> statementsAfter, List<String> queriesAfter); @Override void dropColumnArg(FieldType fieldType, List<String> statementsBefore, List<String> statementsAfter); @Override void appendEscapedWord(StringBuilder sb, String word); @Override void appendEscapedEntityName(StringBuilder sb, String name); @Override String generateIdSequenceName(String tableName, FieldType idFieldType); @Override String getCommentLinePrefix(); @Override DataPersister getDataPersister(DataPersister defaultPersister, FieldType fieldType); @Override FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType); @Override boolean isIdSequenceNeeded(); @Override boolean isVarcharFieldWidthSupported(); @Override boolean isLimitSqlSupported(); @Override boolean isOffsetSqlSupported(); @Override boolean isOffsetLimitArgument(); @Override boolean isLimitAfterSelect(); @Override void appendLimitValue(StringBuilder sb, long limit, Long offset); @Override void appendOffsetValue(StringBuilder sb, long offset); @Override void appendSelectNextValFromSequence(StringBuilder sb, String sequenceName); @Override void appendCreateTableSuffix(StringBuilder sb); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateTableReturnsNegative(); @Override boolean isEntityNamesMustBeUpCase(); @Override String upCaseEntityName(String entityName); @Override boolean isNestedSavePointsSupported(); @Override String getPingStatement(); @Override boolean isBatchUseTransaction(); @Override boolean isTruncateSupported(); @Override boolean isCreateIfNotExistsSupported(); @Override boolean isCreateIndexIfNotExistsSupported(); @Override boolean isSelectSequenceBeforeInsert(); @Override boolean isAllowGeneratedIdInsertSupported(); @Override DatabaseTableConfig<T> extractDatabaseTableConfig(ConnectionSource connectionSource, Class<T> clazz); @Override void appendInsertNoColumns(StringBuilder sb); }
|
BaseDatabaseType implements DatabaseType { @Override public void loadDriver() throws SQLException { String className = getDriverClassName(); if (className != null) { try { Class.forName(className); } catch (ClassNotFoundException e) { throw SqlExceptionUtil.create("Driver class was not found for " + getDatabaseName() + " database. Missing jar with class " + className + ".", e); } } } @Override void loadDriver(); @Override void setDriver(Driver driver); @Override void appendColumnArg(String tableName, StringBuilder sb, FieldType fieldType, List<String> additionalArgs,
List<String> statementsBefore, List<String> statementsAfter, List<String> queriesAfter); @Override void addPrimaryKeySql(FieldType[] fieldTypes, List<String> additionalArgs, List<String> statementsBefore,
List<String> statementsAfter, List<String> queriesAfter); @Override void addUniqueComboSql(FieldType[] fieldTypes, List<String> additionalArgs, List<String> statementsBefore,
List<String> statementsAfter, List<String> queriesAfter); @Override void dropColumnArg(FieldType fieldType, List<String> statementsBefore, List<String> statementsAfter); @Override void appendEscapedWord(StringBuilder sb, String word); @Override void appendEscapedEntityName(StringBuilder sb, String name); @Override String generateIdSequenceName(String tableName, FieldType idFieldType); @Override String getCommentLinePrefix(); @Override DataPersister getDataPersister(DataPersister defaultPersister, FieldType fieldType); @Override FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType); @Override boolean isIdSequenceNeeded(); @Override boolean isVarcharFieldWidthSupported(); @Override boolean isLimitSqlSupported(); @Override boolean isOffsetSqlSupported(); @Override boolean isOffsetLimitArgument(); @Override boolean isLimitAfterSelect(); @Override void appendLimitValue(StringBuilder sb, long limit, Long offset); @Override void appendOffsetValue(StringBuilder sb, long offset); @Override void appendSelectNextValFromSequence(StringBuilder sb, String sequenceName); @Override void appendCreateTableSuffix(StringBuilder sb); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateTableReturnsNegative(); @Override boolean isEntityNamesMustBeUpCase(); @Override String upCaseEntityName(String entityName); @Override boolean isNestedSavePointsSupported(); @Override String getPingStatement(); @Override boolean isBatchUseTransaction(); @Override boolean isTruncateSupported(); @Override boolean isCreateIfNotExistsSupported(); @Override boolean isCreateIndexIfNotExistsSupported(); @Override boolean isSelectSequenceBeforeInsert(); @Override boolean isAllowGeneratedIdInsertSupported(); @Override DatabaseTableConfig<T> extractDatabaseTableConfig(ConnectionSource connectionSource, Class<T> clazz); @Override void appendInsertNoColumns(StringBuilder sb); }
|
@Test(expected = IllegalStateException.class) public void testConfigureGeneratedId() { new TestDatabaseType().configureGeneratedId(null, new StringBuilder(), null, new ArrayList<String>(), null, new ArrayList<String>(), new ArrayList<String>()); }
|
protected void configureGeneratedId(String tableName, StringBuilder sb, FieldType fieldType, List<String> statementsBefore, List<String> statementsAfter, List<String> additionalArgs, List<String> queriesAfter) { throw new IllegalStateException( "GeneratedId is not supported by database " + getDatabaseName() + " for field " + fieldType); }
|
BaseDatabaseType implements DatabaseType { protected void configureGeneratedId(String tableName, StringBuilder sb, FieldType fieldType, List<String> statementsBefore, List<String> statementsAfter, List<String> additionalArgs, List<String> queriesAfter) { throw new IllegalStateException( "GeneratedId is not supported by database " + getDatabaseName() + " for field " + fieldType); } }
|
BaseDatabaseType implements DatabaseType { protected void configureGeneratedId(String tableName, StringBuilder sb, FieldType fieldType, List<String> statementsBefore, List<String> statementsAfter, List<String> additionalArgs, List<String> queriesAfter) { throw new IllegalStateException( "GeneratedId is not supported by database " + getDatabaseName() + " for field " + fieldType); } }
|
BaseDatabaseType implements DatabaseType { protected void configureGeneratedId(String tableName, StringBuilder sb, FieldType fieldType, List<String> statementsBefore, List<String> statementsAfter, List<String> additionalArgs, List<String> queriesAfter) { throw new IllegalStateException( "GeneratedId is not supported by database " + getDatabaseName() + " for field " + fieldType); } @Override void loadDriver(); @Override void setDriver(Driver driver); @Override void appendColumnArg(String tableName, StringBuilder sb, FieldType fieldType, List<String> additionalArgs,
List<String> statementsBefore, List<String> statementsAfter, List<String> queriesAfter); @Override void addPrimaryKeySql(FieldType[] fieldTypes, List<String> additionalArgs, List<String> statementsBefore,
List<String> statementsAfter, List<String> queriesAfter); @Override void addUniqueComboSql(FieldType[] fieldTypes, List<String> additionalArgs, List<String> statementsBefore,
List<String> statementsAfter, List<String> queriesAfter); @Override void dropColumnArg(FieldType fieldType, List<String> statementsBefore, List<String> statementsAfter); @Override void appendEscapedWord(StringBuilder sb, String word); @Override void appendEscapedEntityName(StringBuilder sb, String name); @Override String generateIdSequenceName(String tableName, FieldType idFieldType); @Override String getCommentLinePrefix(); @Override DataPersister getDataPersister(DataPersister defaultPersister, FieldType fieldType); @Override FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType); @Override boolean isIdSequenceNeeded(); @Override boolean isVarcharFieldWidthSupported(); @Override boolean isLimitSqlSupported(); @Override boolean isOffsetSqlSupported(); @Override boolean isOffsetLimitArgument(); @Override boolean isLimitAfterSelect(); @Override void appendLimitValue(StringBuilder sb, long limit, Long offset); @Override void appendOffsetValue(StringBuilder sb, long offset); @Override void appendSelectNextValFromSequence(StringBuilder sb, String sequenceName); @Override void appendCreateTableSuffix(StringBuilder sb); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateTableReturnsNegative(); @Override boolean isEntityNamesMustBeUpCase(); @Override String upCaseEntityName(String entityName); @Override boolean isNestedSavePointsSupported(); @Override String getPingStatement(); @Override boolean isBatchUseTransaction(); @Override boolean isTruncateSupported(); @Override boolean isCreateIfNotExistsSupported(); @Override boolean isCreateIndexIfNotExistsSupported(); @Override boolean isSelectSequenceBeforeInsert(); @Override boolean isAllowGeneratedIdInsertSupported(); @Override DatabaseTableConfig<T> extractDatabaseTableConfig(ConnectionSource connectionSource, Class<T> clazz); @Override void appendInsertNoColumns(StringBuilder sb); }
|
BaseDatabaseType implements DatabaseType { protected void configureGeneratedId(String tableName, StringBuilder sb, FieldType fieldType, List<String> statementsBefore, List<String> statementsAfter, List<String> additionalArgs, List<String> queriesAfter) { throw new IllegalStateException( "GeneratedId is not supported by database " + getDatabaseName() + " for field " + fieldType); } @Override void loadDriver(); @Override void setDriver(Driver driver); @Override void appendColumnArg(String tableName, StringBuilder sb, FieldType fieldType, List<String> additionalArgs,
List<String> statementsBefore, List<String> statementsAfter, List<String> queriesAfter); @Override void addPrimaryKeySql(FieldType[] fieldTypes, List<String> additionalArgs, List<String> statementsBefore,
List<String> statementsAfter, List<String> queriesAfter); @Override void addUniqueComboSql(FieldType[] fieldTypes, List<String> additionalArgs, List<String> statementsBefore,
List<String> statementsAfter, List<String> queriesAfter); @Override void dropColumnArg(FieldType fieldType, List<String> statementsBefore, List<String> statementsAfter); @Override void appendEscapedWord(StringBuilder sb, String word); @Override void appendEscapedEntityName(StringBuilder sb, String name); @Override String generateIdSequenceName(String tableName, FieldType idFieldType); @Override String getCommentLinePrefix(); @Override DataPersister getDataPersister(DataPersister defaultPersister, FieldType fieldType); @Override FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType); @Override boolean isIdSequenceNeeded(); @Override boolean isVarcharFieldWidthSupported(); @Override boolean isLimitSqlSupported(); @Override boolean isOffsetSqlSupported(); @Override boolean isOffsetLimitArgument(); @Override boolean isLimitAfterSelect(); @Override void appendLimitValue(StringBuilder sb, long limit, Long offset); @Override void appendOffsetValue(StringBuilder sb, long offset); @Override void appendSelectNextValFromSequence(StringBuilder sb, String sequenceName); @Override void appendCreateTableSuffix(StringBuilder sb); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateTableReturnsNegative(); @Override boolean isEntityNamesMustBeUpCase(); @Override String upCaseEntityName(String entityName); @Override boolean isNestedSavePointsSupported(); @Override String getPingStatement(); @Override boolean isBatchUseTransaction(); @Override boolean isTruncateSupported(); @Override boolean isCreateIfNotExistsSupported(); @Override boolean isCreateIndexIfNotExistsSupported(); @Override boolean isSelectSequenceBeforeInsert(); @Override boolean isAllowGeneratedIdInsertSupported(); @Override DatabaseTableConfig<T> extractDatabaseTableConfig(ConnectionSource connectionSource, Class<T> clazz); @Override void appendInsertNoColumns(StringBuilder sb); }
|
@Test(expected = IllegalArgumentException.class) public void testConfigureGeneratedIdNotInteger() throws Exception { Field field = Foo.class.getField("stringField"); FieldType fieldType = FieldType.createFieldType(connectionSource, "foo", field, Foo.class); OurSqliteDatabaseType dbType = new OurSqliteDatabaseType(); StringBuilder sb = new StringBuilder(); dbType.configureGeneratedId(null, sb, fieldType, new ArrayList<String>(), null, new ArrayList<String>(), new ArrayList<String>()); }
|
@Override protected void configureGeneratedId(String tableName, StringBuilder sb, FieldType fieldType, List<String> statementsBefore, List<String> statementsAfter, List<String> additionalArgs, List<String> queriesAfter) { if (fieldType.getSqlType() != SqlType.INTEGER && fieldType.getSqlType() != SqlType.LONG) { throw new IllegalArgumentException( "Sqlite requires that auto-increment generated-id be integer or long type"); } sb.append("PRIMARY KEY AUTOINCREMENT "); }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override protected void configureGeneratedId(String tableName, StringBuilder sb, FieldType fieldType, List<String> statementsBefore, List<String> statementsAfter, List<String> additionalArgs, List<String> queriesAfter) { if (fieldType.getSqlType() != SqlType.INTEGER && fieldType.getSqlType() != SqlType.LONG) { throw new IllegalArgumentException( "Sqlite requires that auto-increment generated-id be integer or long type"); } sb.append("PRIMARY KEY AUTOINCREMENT "); } }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override protected void configureGeneratedId(String tableName, StringBuilder sb, FieldType fieldType, List<String> statementsBefore, List<String> statementsAfter, List<String> additionalArgs, List<String> queriesAfter) { if (fieldType.getSqlType() != SqlType.INTEGER && fieldType.getSqlType() != SqlType.LONG) { throw new IllegalArgumentException( "Sqlite requires that auto-increment generated-id be integer or long type"); } sb.append("PRIMARY KEY AUTOINCREMENT "); } }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override protected void configureGeneratedId(String tableName, StringBuilder sb, FieldType fieldType, List<String> statementsBefore, List<String> statementsAfter, List<String> additionalArgs, List<String> queriesAfter) { if (fieldType.getSqlType() != SqlType.INTEGER && fieldType.getSqlType() != SqlType.LONG) { throw new IllegalArgumentException( "Sqlite requires that auto-increment generated-id be integer or long type"); } sb.append("PRIMARY KEY AUTOINCREMENT "); } @Override boolean isVarcharFieldWidthSupported(); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateIfNotExistsSupported(); @Override FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType); @Override void appendInsertNoColumns(StringBuilder sb); }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override protected void configureGeneratedId(String tableName, StringBuilder sb, FieldType fieldType, List<String> statementsBefore, List<String> statementsAfter, List<String> additionalArgs, List<String> queriesAfter) { if (fieldType.getSqlType() != SqlType.INTEGER && fieldType.getSqlType() != SqlType.LONG) { throw new IllegalArgumentException( "Sqlite requires that auto-increment generated-id be integer or long type"); } sb.append("PRIMARY KEY AUTOINCREMENT "); } @Override boolean isVarcharFieldWidthSupported(); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateIfNotExistsSupported(); @Override FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType); @Override void appendInsertNoColumns(StringBuilder sb); }
|
@Test public void testStringLiteral6() throws Exception { String sql = "select #if (:1) ok #end"; ASTRootNode n = new Parser(sql).parse().init(); ParameterContext ctx = getParameterContext(Lists.newArrayList((Type) String.class)); n.checkAndBind(ctx); InvocationContext context = DefaultInvocationContext.create(); context.addParameter("1", ""); n.render(context); BoundSql boundSql = context.getBoundSql(); assertThat(boundSql.getSql(), Matchers.equalTo("select ")); }
|
final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); final ASTRootNode parse(); final void DML(); final void Insert(); final void Delete(); final void Update(); final void Select(); final void Replace(); final void Merge(); final void Truncate(); final void Statement(); final void JDBCParameter(); final void JDBCIterableParameter(); final void GlobalTable(); final void JoinParameter(); final void QuoteText(); final void Text(); final void Blank(); final void IfStatement(); final void ElseStatement(); final void ElseIfStatement(); final void Expression(); final void ConditionalOrExpression(); final void ConditionalAndExpression(); final void RelationalExpression(); final void UnaryExpression(); final void PrimaryExpression(); final void ExpressionParameter(); final void IntegerLiteral(); final void StringLiteral(); final void True(); final void False(); final void Null(); void ReInit(java.io.InputStream stream); void ReInit(java.io.InputStream stream, String encoding); void ReInit(Reader stream); void ReInit(ParserTokenManager tm); final Token getNextToken(); final Token getToken(int index); ParseException generateParseException(); final void enable_tracing(); final void disable_tracing(); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); final ASTRootNode parse(); final void DML(); final void Insert(); final void Delete(); final void Update(); final void Select(); final void Replace(); final void Merge(); final void Truncate(); final void Statement(); final void JDBCParameter(); final void JDBCIterableParameter(); final void GlobalTable(); final void JoinParameter(); final void QuoteText(); final void Text(); final void Blank(); final void IfStatement(); final void ElseStatement(); final void ElseIfStatement(); final void Expression(); final void ConditionalOrExpression(); final void ConditionalAndExpression(); final void RelationalExpression(); final void UnaryExpression(); final void PrimaryExpression(); final void ExpressionParameter(); final void IntegerLiteral(); final void StringLiteral(); final void True(); final void False(); final void Null(); void ReInit(java.io.InputStream stream); void ReInit(java.io.InputStream stream, String encoding); void ReInit(Reader stream); void ReInit(ParserTokenManager tm); final Token getNextToken(); final Token getToken(int index); ParseException generateParseException(); final void enable_tracing(); final void disable_tracing(); public ParserTokenManager token_source; public Token token; public Token jj_nt; }
|
@Test public void testConfigureGeneratedIdInteger() throws Exception { Field field = Foo.class.getField("val"); FieldType fieldType = FieldType.createFieldType(connectionSource, "foo", field, Foo.class); OurSqliteDatabaseType dbType = new OurSqliteDatabaseType(); StringBuilder sb = new StringBuilder(); dbType.configureGeneratedId(null, sb, fieldType, new ArrayList<String>(), null, new ArrayList<String>(), new ArrayList<String>()); assertTrue(sb.toString().contains("PRIMARY KEY AUTOINCREMENT")); }
|
@Override protected void configureGeneratedId(String tableName, StringBuilder sb, FieldType fieldType, List<String> statementsBefore, List<String> statementsAfter, List<String> additionalArgs, List<String> queriesAfter) { if (fieldType.getSqlType() != SqlType.INTEGER && fieldType.getSqlType() != SqlType.LONG) { throw new IllegalArgumentException( "Sqlite requires that auto-increment generated-id be integer or long type"); } sb.append("PRIMARY KEY AUTOINCREMENT "); }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override protected void configureGeneratedId(String tableName, StringBuilder sb, FieldType fieldType, List<String> statementsBefore, List<String> statementsAfter, List<String> additionalArgs, List<String> queriesAfter) { if (fieldType.getSqlType() != SqlType.INTEGER && fieldType.getSqlType() != SqlType.LONG) { throw new IllegalArgumentException( "Sqlite requires that auto-increment generated-id be integer or long type"); } sb.append("PRIMARY KEY AUTOINCREMENT "); } }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override protected void configureGeneratedId(String tableName, StringBuilder sb, FieldType fieldType, List<String> statementsBefore, List<String> statementsAfter, List<String> additionalArgs, List<String> queriesAfter) { if (fieldType.getSqlType() != SqlType.INTEGER && fieldType.getSqlType() != SqlType.LONG) { throw new IllegalArgumentException( "Sqlite requires that auto-increment generated-id be integer or long type"); } sb.append("PRIMARY KEY AUTOINCREMENT "); } }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override protected void configureGeneratedId(String tableName, StringBuilder sb, FieldType fieldType, List<String> statementsBefore, List<String> statementsAfter, List<String> additionalArgs, List<String> queriesAfter) { if (fieldType.getSqlType() != SqlType.INTEGER && fieldType.getSqlType() != SqlType.LONG) { throw new IllegalArgumentException( "Sqlite requires that auto-increment generated-id be integer or long type"); } sb.append("PRIMARY KEY AUTOINCREMENT "); } @Override boolean isVarcharFieldWidthSupported(); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateIfNotExistsSupported(); @Override FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType); @Override void appendInsertNoColumns(StringBuilder sb); }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override protected void configureGeneratedId(String tableName, StringBuilder sb, FieldType fieldType, List<String> statementsBefore, List<String> statementsAfter, List<String> additionalArgs, List<String> queriesAfter) { if (fieldType.getSqlType() != SqlType.INTEGER && fieldType.getSqlType() != SqlType.LONG) { throw new IllegalArgumentException( "Sqlite requires that auto-increment generated-id be integer or long type"); } sb.append("PRIMARY KEY AUTOINCREMENT "); } @Override boolean isVarcharFieldWidthSupported(); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateIfNotExistsSupported(); @Override FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType); @Override void appendInsertNoColumns(StringBuilder sb); }
|
@Test public void testIsVarcharFieldWidthSupported() { assertFalse(new OurSqliteDatabaseType().isVarcharFieldWidthSupported()); }
|
@Override public boolean isVarcharFieldWidthSupported() { return false; }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public boolean isVarcharFieldWidthSupported() { return false; } }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public boolean isVarcharFieldWidthSupported() { return false; } }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public boolean isVarcharFieldWidthSupported() { return false; } @Override boolean isVarcharFieldWidthSupported(); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateIfNotExistsSupported(); @Override FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType); @Override void appendInsertNoColumns(StringBuilder sb); }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public boolean isVarcharFieldWidthSupported() { return false; } @Override boolean isVarcharFieldWidthSupported(); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateIfNotExistsSupported(); @Override FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType); @Override void appendInsertNoColumns(StringBuilder sb); }
|
@Test public void testIsCreateTableReturnsZero() { assertFalse(new OurSqliteDatabaseType().isCreateTableReturnsZero()); }
|
@Override public boolean isCreateTableReturnsZero() { return false; }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public boolean isCreateTableReturnsZero() { return false; } }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public boolean isCreateTableReturnsZero() { return false; } }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public boolean isCreateTableReturnsZero() { return false; } @Override boolean isVarcharFieldWidthSupported(); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateIfNotExistsSupported(); @Override FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType); @Override void appendInsertNoColumns(StringBuilder sb); }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public boolean isCreateTableReturnsZero() { return false; } @Override boolean isVarcharFieldWidthSupported(); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateIfNotExistsSupported(); @Override FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType); @Override void appendInsertNoColumns(StringBuilder sb); }
|
@Test public void testGeneratedIdSqlAtEnd() { assertFalse(new OurSqliteDatabaseType().generatedIdSqlAtEnd()); }
|
@Override protected boolean generatedIdSqlAtEnd() { return false; }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override protected boolean generatedIdSqlAtEnd() { return false; } }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override protected boolean generatedIdSqlAtEnd() { return false; } }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override protected boolean generatedIdSqlAtEnd() { return false; } @Override boolean isVarcharFieldWidthSupported(); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateIfNotExistsSupported(); @Override FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType); @Override void appendInsertNoColumns(StringBuilder sb); }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override protected boolean generatedIdSqlAtEnd() { return false; } @Override boolean isVarcharFieldWidthSupported(); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateIfNotExistsSupported(); @Override FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType); @Override void appendInsertNoColumns(StringBuilder sb); }
|
@Test public void testIsCreateIfNotExistsSupported() { assertTrue(new OurSqliteDatabaseType().isCreateIfNotExistsSupported()); }
|
@Override public boolean isCreateIfNotExistsSupported() { return true; }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public boolean isCreateIfNotExistsSupported() { return true; } }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public boolean isCreateIfNotExistsSupported() { return true; } }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public boolean isCreateIfNotExistsSupported() { return true; } @Override boolean isVarcharFieldWidthSupported(); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateIfNotExistsSupported(); @Override FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType); @Override void appendInsertNoColumns(StringBuilder sb); }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public boolean isCreateIfNotExistsSupported() { return true; } @Override boolean isVarcharFieldWidthSupported(); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateIfNotExistsSupported(); @Override FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType); @Override void appendInsertNoColumns(StringBuilder sb); }
|
@Test public void testGetFieldConverter() throws Exception { OurSqliteDatabaseType dbType = new OurSqliteDatabaseType(); assertEquals(Byte.valueOf((byte) 1), dbType.getFieldConverter(DataType.BOOLEAN.getDataPersister(), null) .parseDefaultString(null, "true")); }
|
@Override public FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType) { switch (dataPersister.getSqlType()) { case BOOLEAN : return booleanConverter; case BIG_DECIMAL : return BigDecimalStringType.getSingleton(); default : return super.getFieldConverter(dataPersister, fieldType); } }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType) { switch (dataPersister.getSqlType()) { case BOOLEAN : return booleanConverter; case BIG_DECIMAL : return BigDecimalStringType.getSingleton(); default : return super.getFieldConverter(dataPersister, fieldType); } } }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType) { switch (dataPersister.getSqlType()) { case BOOLEAN : return booleanConverter; case BIG_DECIMAL : return BigDecimalStringType.getSingleton(); default : return super.getFieldConverter(dataPersister, fieldType); } } }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType) { switch (dataPersister.getSqlType()) { case BOOLEAN : return booleanConverter; case BIG_DECIMAL : return BigDecimalStringType.getSingleton(); default : return super.getFieldConverter(dataPersister, fieldType); } } @Override boolean isVarcharFieldWidthSupported(); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateIfNotExistsSupported(); @Override FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType); @Override void appendInsertNoColumns(StringBuilder sb); }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType) { switch (dataPersister.getSqlType()) { case BOOLEAN : return booleanConverter; case BIG_DECIMAL : return BigDecimalStringType.getSingleton(); default : return super.getFieldConverter(dataPersister, fieldType); } } @Override boolean isVarcharFieldWidthSupported(); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateIfNotExistsSupported(); @Override FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType); @Override void appendInsertNoColumns(StringBuilder sb); }
|
@Test public void testDefaultFieldConverter() { OurSqliteDatabaseType dbType = new OurSqliteDatabaseType(); assertSame(DataType.STRING.getDataPersister(), dbType.getFieldConverter(DataType.STRING.getDataPersister(), null)); }
|
@Override public FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType) { switch (dataPersister.getSqlType()) { case BOOLEAN : return booleanConverter; case BIG_DECIMAL : return BigDecimalStringType.getSingleton(); default : return super.getFieldConverter(dataPersister, fieldType); } }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType) { switch (dataPersister.getSqlType()) { case BOOLEAN : return booleanConverter; case BIG_DECIMAL : return BigDecimalStringType.getSingleton(); default : return super.getFieldConverter(dataPersister, fieldType); } } }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType) { switch (dataPersister.getSqlType()) { case BOOLEAN : return booleanConverter; case BIG_DECIMAL : return BigDecimalStringType.getSingleton(); default : return super.getFieldConverter(dataPersister, fieldType); } } }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType) { switch (dataPersister.getSqlType()) { case BOOLEAN : return booleanConverter; case BIG_DECIMAL : return BigDecimalStringType.getSingleton(); default : return super.getFieldConverter(dataPersister, fieldType); } } @Override boolean isVarcharFieldWidthSupported(); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateIfNotExistsSupported(); @Override FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType); @Override void appendInsertNoColumns(StringBuilder sb); }
|
BaseSqliteDatabaseType extends BaseDatabaseType { @Override public FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType) { switch (dataPersister.getSqlType()) { case BOOLEAN : return booleanConverter; case BIG_DECIMAL : return BigDecimalStringType.getSingleton(); default : return super.getFieldConverter(dataPersister, fieldType); } } @Override boolean isVarcharFieldWidthSupported(); @Override boolean isCreateTableReturnsZero(); @Override boolean isCreateIfNotExistsSupported(); @Override FieldConverter getFieldConverter(DataPersister dataPersister, FieldType fieldType); @Override void appendInsertNoColumns(StringBuilder sb); }
|
@Test(expected = IllegalArgumentException.class) public void testUnknownEnumVal() throws Exception { Field[] fields = BadUnknownVal.class.getDeclaredFields(); assertTrue(fields.length >= 1); DatabaseFieldConfig.fromField(databaseType, "foo", fields[0]); }
|
public static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field) throws SQLException { DatabaseField databaseField = field.getAnnotation(DatabaseField.class); if (databaseField != null) { if (databaseField.persisted()) { return fromDatabaseField(databaseType, tableName, field, databaseField); } else { return null; } } ForeignCollectionField foreignCollection = field.getAnnotation(ForeignCollectionField.class); if (foreignCollection != null) { return fromForeignCollection(databaseType, field, foreignCollection); } if (javaxPersistenceConfigurer == null) { return null; } else { return javaxPersistenceConfigurer.createFieldConfig(databaseType, field); } }
|
DatabaseFieldConfig { public static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field) throws SQLException { DatabaseField databaseField = field.getAnnotation(DatabaseField.class); if (databaseField != null) { if (databaseField.persisted()) { return fromDatabaseField(databaseType, tableName, field, databaseField); } else { return null; } } ForeignCollectionField foreignCollection = field.getAnnotation(ForeignCollectionField.class); if (foreignCollection != null) { return fromForeignCollection(databaseType, field, foreignCollection); } if (javaxPersistenceConfigurer == null) { return null; } else { return javaxPersistenceConfigurer.createFieldConfig(databaseType, field); } } }
|
DatabaseFieldConfig { public static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field) throws SQLException { DatabaseField databaseField = field.getAnnotation(DatabaseField.class); if (databaseField != null) { if (databaseField.persisted()) { return fromDatabaseField(databaseType, tableName, field, databaseField); } else { return null; } } ForeignCollectionField foreignCollection = field.getAnnotation(ForeignCollectionField.class); if (foreignCollection != null) { return fromForeignCollection(databaseType, field, foreignCollection); } if (javaxPersistenceConfigurer == null) { return null; } else { return javaxPersistenceConfigurer.createFieldConfig(databaseType, field); } } DatabaseFieldConfig(); DatabaseFieldConfig(String fieldName); DatabaseFieldConfig(String fieldName, String columnName, DataType dataType, String defaultValue, int width,
boolean canBeNull, boolean id, boolean generatedId, String generatedIdSequence, boolean foreign,
DatabaseTableConfig<?> foreignTableConfig, boolean useGetSet, Enum<?> unknownEnumValue,
boolean throwIfNull, String format, boolean unique, String indexName, String uniqueIndexName,
boolean autoRefresh, int maxForeignAutoRefreshLevel, int maxForeignCollectionLevel); }
|
DatabaseFieldConfig { public static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field) throws SQLException { DatabaseField databaseField = field.getAnnotation(DatabaseField.class); if (databaseField != null) { if (databaseField.persisted()) { return fromDatabaseField(databaseType, tableName, field, databaseField); } else { return null; } } ForeignCollectionField foreignCollection = field.getAnnotation(ForeignCollectionField.class); if (foreignCollection != null) { return fromForeignCollection(databaseType, field, foreignCollection); } if (javaxPersistenceConfigurer == null) { return null; } else { return javaxPersistenceConfigurer.createFieldConfig(databaseType, field); } } DatabaseFieldConfig(); DatabaseFieldConfig(String fieldName); DatabaseFieldConfig(String fieldName, String columnName, DataType dataType, String defaultValue, int width,
boolean canBeNull, boolean id, boolean generatedId, String generatedIdSequence, boolean foreign,
DatabaseTableConfig<?> foreignTableConfig, boolean useGetSet, Enum<?> unknownEnumValue,
boolean throwIfNull, String format, boolean unique, String indexName, String uniqueIndexName,
boolean autoRefresh, int maxForeignAutoRefreshLevel, int maxForeignCollectionLevel); String getFieldName(); void setFieldName(String fieldName); String getColumnName(); void setColumnName(String columnName); DataType getDataType(); void setDataType(DataType dataType); DataPersister getDataPersister(); void setDataPersister(DataPersister dataPersister); String getDefaultValue(); void setDefaultValue(String defaultValue); int getWidth(); void setWidth(int width); boolean isCanBeNull(); void setCanBeNull(boolean canBeNull); boolean isId(); void setId(boolean id); boolean isGeneratedId(); void setGeneratedId(boolean generatedId); String getGeneratedIdSequence(); void setGeneratedIdSequence(String generatedIdSequence); boolean isForeign(); void setForeign(boolean foreign); DatabaseTableConfig<?> getForeignTableConfig(); void setForeignTableConfig(DatabaseTableConfig<?> foreignTableConfig); boolean isUseGetSet(); void setUseGetSet(boolean useGetSet); Enum<?> getUnknownEnumValue(); void setUnknownEnumValue(Enum<?> unknownEnumValue); boolean isThrowIfNull(); void setThrowIfNull(boolean throwIfNull); boolean isPersisted(); void setPersisted(boolean persisted); String getFormat(); void setFormat(String format); boolean isUnique(); void setUnique(boolean unique); boolean isUniqueCombo(); void setUniqueCombo(boolean uniqueCombo); boolean isIndex(); void setIndex(boolean index); String getIndexName(String tableName); void setIndexName(String indexName); boolean isUniqueIndex(); void setUniqueIndex(boolean uniqueIndex); String getUniqueIndexName(String tableName); void setUniqueIndexName(String uniqueIndexName); void setForeignAutoRefresh(boolean foreignAutoRefresh); boolean isForeignAutoRefresh(); int getMaxForeignAutoRefreshLevel(); void setMaxForeignAutoRefreshLevel(int maxForeignLevel); boolean isForeignCollection(); void setForeignCollection(boolean foreignCollection); boolean isForeignCollectionEager(); void setForeignCollectionEager(boolean foreignCollectionEager); int getForeignCollectionMaxEagerLevel(); void setForeignCollectionMaxEagerLevel(int foreignCollectionMaxEagerLevel); String getForeignCollectionColumnName(); void setForeignCollectionColumnName(String foreignCollectionColumn); String getForeignCollectionOrderColumnName(); void setForeignCollectionOrderColumnName(String foreignCollectionOrderColumn); boolean isForeignCollectionOrderAscending(); void setForeignCollectionOrderAscending(boolean foreignCollectionOrderAscending); String getForeignCollectionForeignFieldName(); void setForeignCollectionForeignFieldName(String foreignCollectionForeignFieldName); Class<? extends DataPersister> getPersisterClass(); void setPersisterClass(Class<? extends DataPersister> persisterClass); boolean isAllowGeneratedIdInsert(); void setAllowGeneratedIdInsert(boolean allowGeneratedIdInsert); String getColumnDefinition(); void setColumnDefinition(String columnDefinition); boolean isForeignAutoCreate(); void setForeignAutoCreate(boolean foreignAutoCreate); boolean isVersion(); void setVersion(boolean version); String getForeignColumnName(); void setForeignColumnName(String foreignColumnName); boolean isReadOnly(); void setReadOnly(boolean readOnly); static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field); static Method findGetMethod(Field field, boolean throwExceptions); static Method findSetMethod(Field field, boolean throwExceptions); static DatabaseFieldConfig fromDatabaseField(DatabaseType databaseType, String tableName, Field field,
DatabaseField databaseField); void postProcess(); static Enum<?> findMatchingEnumVal(Field field, String unknownEnumName); }
|
DatabaseFieldConfig { public static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field) throws SQLException { DatabaseField databaseField = field.getAnnotation(DatabaseField.class); if (databaseField != null) { if (databaseField.persisted()) { return fromDatabaseField(databaseType, tableName, field, databaseField); } else { return null; } } ForeignCollectionField foreignCollection = field.getAnnotation(ForeignCollectionField.class); if (foreignCollection != null) { return fromForeignCollection(databaseType, field, foreignCollection); } if (javaxPersistenceConfigurer == null) { return null; } else { return javaxPersistenceConfigurer.createFieldConfig(databaseType, field); } } DatabaseFieldConfig(); DatabaseFieldConfig(String fieldName); DatabaseFieldConfig(String fieldName, String columnName, DataType dataType, String defaultValue, int width,
boolean canBeNull, boolean id, boolean generatedId, String generatedIdSequence, boolean foreign,
DatabaseTableConfig<?> foreignTableConfig, boolean useGetSet, Enum<?> unknownEnumValue,
boolean throwIfNull, String format, boolean unique, String indexName, String uniqueIndexName,
boolean autoRefresh, int maxForeignAutoRefreshLevel, int maxForeignCollectionLevel); String getFieldName(); void setFieldName(String fieldName); String getColumnName(); void setColumnName(String columnName); DataType getDataType(); void setDataType(DataType dataType); DataPersister getDataPersister(); void setDataPersister(DataPersister dataPersister); String getDefaultValue(); void setDefaultValue(String defaultValue); int getWidth(); void setWidth(int width); boolean isCanBeNull(); void setCanBeNull(boolean canBeNull); boolean isId(); void setId(boolean id); boolean isGeneratedId(); void setGeneratedId(boolean generatedId); String getGeneratedIdSequence(); void setGeneratedIdSequence(String generatedIdSequence); boolean isForeign(); void setForeign(boolean foreign); DatabaseTableConfig<?> getForeignTableConfig(); void setForeignTableConfig(DatabaseTableConfig<?> foreignTableConfig); boolean isUseGetSet(); void setUseGetSet(boolean useGetSet); Enum<?> getUnknownEnumValue(); void setUnknownEnumValue(Enum<?> unknownEnumValue); boolean isThrowIfNull(); void setThrowIfNull(boolean throwIfNull); boolean isPersisted(); void setPersisted(boolean persisted); String getFormat(); void setFormat(String format); boolean isUnique(); void setUnique(boolean unique); boolean isUniqueCombo(); void setUniqueCombo(boolean uniqueCombo); boolean isIndex(); void setIndex(boolean index); String getIndexName(String tableName); void setIndexName(String indexName); boolean isUniqueIndex(); void setUniqueIndex(boolean uniqueIndex); String getUniqueIndexName(String tableName); void setUniqueIndexName(String uniqueIndexName); void setForeignAutoRefresh(boolean foreignAutoRefresh); boolean isForeignAutoRefresh(); int getMaxForeignAutoRefreshLevel(); void setMaxForeignAutoRefreshLevel(int maxForeignLevel); boolean isForeignCollection(); void setForeignCollection(boolean foreignCollection); boolean isForeignCollectionEager(); void setForeignCollectionEager(boolean foreignCollectionEager); int getForeignCollectionMaxEagerLevel(); void setForeignCollectionMaxEagerLevel(int foreignCollectionMaxEagerLevel); String getForeignCollectionColumnName(); void setForeignCollectionColumnName(String foreignCollectionColumn); String getForeignCollectionOrderColumnName(); void setForeignCollectionOrderColumnName(String foreignCollectionOrderColumn); boolean isForeignCollectionOrderAscending(); void setForeignCollectionOrderAscending(boolean foreignCollectionOrderAscending); String getForeignCollectionForeignFieldName(); void setForeignCollectionForeignFieldName(String foreignCollectionForeignFieldName); Class<? extends DataPersister> getPersisterClass(); void setPersisterClass(Class<? extends DataPersister> persisterClass); boolean isAllowGeneratedIdInsert(); void setAllowGeneratedIdInsert(boolean allowGeneratedIdInsert); String getColumnDefinition(); void setColumnDefinition(String columnDefinition); boolean isForeignAutoCreate(); void setForeignAutoCreate(boolean foreignAutoCreate); boolean isVersion(); void setVersion(boolean version); String getForeignColumnName(); void setForeignColumnName(String foreignColumnName); boolean isReadOnly(); void setReadOnly(boolean readOnly); static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field); static Method findGetMethod(Field field, boolean throwExceptions); static Method findSetMethod(Field field, boolean throwExceptions); static DatabaseFieldConfig fromDatabaseField(DatabaseType databaseType, String tableName, Field field,
DatabaseField databaseField); void postProcess(); static Enum<?> findMatchingEnumVal(Field field, String unknownEnumName); static final Class<? extends DataPersister> DEFAULT_PERSISTER_CLASS; static final DataType DEFAULT_DATA_TYPE; static final boolean DEFAULT_CAN_BE_NULL; static final boolean DEFAULT_FOREIGN_COLLECTION_ORDER_ASCENDING; static final int NO_MAX_FOREIGN_AUTO_REFRESH_LEVEL_SPECIFIED; }
|
@Test public void testNotPersisted() throws Exception { DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, "foo", NotPersisted.class.getDeclaredField("field")); assertNull(fieldConfig); }
|
public static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field) throws SQLException { DatabaseField databaseField = field.getAnnotation(DatabaseField.class); if (databaseField != null) { if (databaseField.persisted()) { return fromDatabaseField(databaseType, tableName, field, databaseField); } else { return null; } } ForeignCollectionField foreignCollection = field.getAnnotation(ForeignCollectionField.class); if (foreignCollection != null) { return fromForeignCollection(databaseType, field, foreignCollection); } if (javaxPersistenceConfigurer == null) { return null; } else { return javaxPersistenceConfigurer.createFieldConfig(databaseType, field); } }
|
DatabaseFieldConfig { public static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field) throws SQLException { DatabaseField databaseField = field.getAnnotation(DatabaseField.class); if (databaseField != null) { if (databaseField.persisted()) { return fromDatabaseField(databaseType, tableName, field, databaseField); } else { return null; } } ForeignCollectionField foreignCollection = field.getAnnotation(ForeignCollectionField.class); if (foreignCollection != null) { return fromForeignCollection(databaseType, field, foreignCollection); } if (javaxPersistenceConfigurer == null) { return null; } else { return javaxPersistenceConfigurer.createFieldConfig(databaseType, field); } } }
|
DatabaseFieldConfig { public static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field) throws SQLException { DatabaseField databaseField = field.getAnnotation(DatabaseField.class); if (databaseField != null) { if (databaseField.persisted()) { return fromDatabaseField(databaseType, tableName, field, databaseField); } else { return null; } } ForeignCollectionField foreignCollection = field.getAnnotation(ForeignCollectionField.class); if (foreignCollection != null) { return fromForeignCollection(databaseType, field, foreignCollection); } if (javaxPersistenceConfigurer == null) { return null; } else { return javaxPersistenceConfigurer.createFieldConfig(databaseType, field); } } DatabaseFieldConfig(); DatabaseFieldConfig(String fieldName); DatabaseFieldConfig(String fieldName, String columnName, DataType dataType, String defaultValue, int width,
boolean canBeNull, boolean id, boolean generatedId, String generatedIdSequence, boolean foreign,
DatabaseTableConfig<?> foreignTableConfig, boolean useGetSet, Enum<?> unknownEnumValue,
boolean throwIfNull, String format, boolean unique, String indexName, String uniqueIndexName,
boolean autoRefresh, int maxForeignAutoRefreshLevel, int maxForeignCollectionLevel); }
|
DatabaseFieldConfig { public static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field) throws SQLException { DatabaseField databaseField = field.getAnnotation(DatabaseField.class); if (databaseField != null) { if (databaseField.persisted()) { return fromDatabaseField(databaseType, tableName, field, databaseField); } else { return null; } } ForeignCollectionField foreignCollection = field.getAnnotation(ForeignCollectionField.class); if (foreignCollection != null) { return fromForeignCollection(databaseType, field, foreignCollection); } if (javaxPersistenceConfigurer == null) { return null; } else { return javaxPersistenceConfigurer.createFieldConfig(databaseType, field); } } DatabaseFieldConfig(); DatabaseFieldConfig(String fieldName); DatabaseFieldConfig(String fieldName, String columnName, DataType dataType, String defaultValue, int width,
boolean canBeNull, boolean id, boolean generatedId, String generatedIdSequence, boolean foreign,
DatabaseTableConfig<?> foreignTableConfig, boolean useGetSet, Enum<?> unknownEnumValue,
boolean throwIfNull, String format, boolean unique, String indexName, String uniqueIndexName,
boolean autoRefresh, int maxForeignAutoRefreshLevel, int maxForeignCollectionLevel); String getFieldName(); void setFieldName(String fieldName); String getColumnName(); void setColumnName(String columnName); DataType getDataType(); void setDataType(DataType dataType); DataPersister getDataPersister(); void setDataPersister(DataPersister dataPersister); String getDefaultValue(); void setDefaultValue(String defaultValue); int getWidth(); void setWidth(int width); boolean isCanBeNull(); void setCanBeNull(boolean canBeNull); boolean isId(); void setId(boolean id); boolean isGeneratedId(); void setGeneratedId(boolean generatedId); String getGeneratedIdSequence(); void setGeneratedIdSequence(String generatedIdSequence); boolean isForeign(); void setForeign(boolean foreign); DatabaseTableConfig<?> getForeignTableConfig(); void setForeignTableConfig(DatabaseTableConfig<?> foreignTableConfig); boolean isUseGetSet(); void setUseGetSet(boolean useGetSet); Enum<?> getUnknownEnumValue(); void setUnknownEnumValue(Enum<?> unknownEnumValue); boolean isThrowIfNull(); void setThrowIfNull(boolean throwIfNull); boolean isPersisted(); void setPersisted(boolean persisted); String getFormat(); void setFormat(String format); boolean isUnique(); void setUnique(boolean unique); boolean isUniqueCombo(); void setUniqueCombo(boolean uniqueCombo); boolean isIndex(); void setIndex(boolean index); String getIndexName(String tableName); void setIndexName(String indexName); boolean isUniqueIndex(); void setUniqueIndex(boolean uniqueIndex); String getUniqueIndexName(String tableName); void setUniqueIndexName(String uniqueIndexName); void setForeignAutoRefresh(boolean foreignAutoRefresh); boolean isForeignAutoRefresh(); int getMaxForeignAutoRefreshLevel(); void setMaxForeignAutoRefreshLevel(int maxForeignLevel); boolean isForeignCollection(); void setForeignCollection(boolean foreignCollection); boolean isForeignCollectionEager(); void setForeignCollectionEager(boolean foreignCollectionEager); int getForeignCollectionMaxEagerLevel(); void setForeignCollectionMaxEagerLevel(int foreignCollectionMaxEagerLevel); String getForeignCollectionColumnName(); void setForeignCollectionColumnName(String foreignCollectionColumn); String getForeignCollectionOrderColumnName(); void setForeignCollectionOrderColumnName(String foreignCollectionOrderColumn); boolean isForeignCollectionOrderAscending(); void setForeignCollectionOrderAscending(boolean foreignCollectionOrderAscending); String getForeignCollectionForeignFieldName(); void setForeignCollectionForeignFieldName(String foreignCollectionForeignFieldName); Class<? extends DataPersister> getPersisterClass(); void setPersisterClass(Class<? extends DataPersister> persisterClass); boolean isAllowGeneratedIdInsert(); void setAllowGeneratedIdInsert(boolean allowGeneratedIdInsert); String getColumnDefinition(); void setColumnDefinition(String columnDefinition); boolean isForeignAutoCreate(); void setForeignAutoCreate(boolean foreignAutoCreate); boolean isVersion(); void setVersion(boolean version); String getForeignColumnName(); void setForeignColumnName(String foreignColumnName); boolean isReadOnly(); void setReadOnly(boolean readOnly); static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field); static Method findGetMethod(Field field, boolean throwExceptions); static Method findSetMethod(Field field, boolean throwExceptions); static DatabaseFieldConfig fromDatabaseField(DatabaseType databaseType, String tableName, Field field,
DatabaseField databaseField); void postProcess(); static Enum<?> findMatchingEnumVal(Field field, String unknownEnumName); }
|
DatabaseFieldConfig { public static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field) throws SQLException { DatabaseField databaseField = field.getAnnotation(DatabaseField.class); if (databaseField != null) { if (databaseField.persisted()) { return fromDatabaseField(databaseType, tableName, field, databaseField); } else { return null; } } ForeignCollectionField foreignCollection = field.getAnnotation(ForeignCollectionField.class); if (foreignCollection != null) { return fromForeignCollection(databaseType, field, foreignCollection); } if (javaxPersistenceConfigurer == null) { return null; } else { return javaxPersistenceConfigurer.createFieldConfig(databaseType, field); } } DatabaseFieldConfig(); DatabaseFieldConfig(String fieldName); DatabaseFieldConfig(String fieldName, String columnName, DataType dataType, String defaultValue, int width,
boolean canBeNull, boolean id, boolean generatedId, String generatedIdSequence, boolean foreign,
DatabaseTableConfig<?> foreignTableConfig, boolean useGetSet, Enum<?> unknownEnumValue,
boolean throwIfNull, String format, boolean unique, String indexName, String uniqueIndexName,
boolean autoRefresh, int maxForeignAutoRefreshLevel, int maxForeignCollectionLevel); String getFieldName(); void setFieldName(String fieldName); String getColumnName(); void setColumnName(String columnName); DataType getDataType(); void setDataType(DataType dataType); DataPersister getDataPersister(); void setDataPersister(DataPersister dataPersister); String getDefaultValue(); void setDefaultValue(String defaultValue); int getWidth(); void setWidth(int width); boolean isCanBeNull(); void setCanBeNull(boolean canBeNull); boolean isId(); void setId(boolean id); boolean isGeneratedId(); void setGeneratedId(boolean generatedId); String getGeneratedIdSequence(); void setGeneratedIdSequence(String generatedIdSequence); boolean isForeign(); void setForeign(boolean foreign); DatabaseTableConfig<?> getForeignTableConfig(); void setForeignTableConfig(DatabaseTableConfig<?> foreignTableConfig); boolean isUseGetSet(); void setUseGetSet(boolean useGetSet); Enum<?> getUnknownEnumValue(); void setUnknownEnumValue(Enum<?> unknownEnumValue); boolean isThrowIfNull(); void setThrowIfNull(boolean throwIfNull); boolean isPersisted(); void setPersisted(boolean persisted); String getFormat(); void setFormat(String format); boolean isUnique(); void setUnique(boolean unique); boolean isUniqueCombo(); void setUniqueCombo(boolean uniqueCombo); boolean isIndex(); void setIndex(boolean index); String getIndexName(String tableName); void setIndexName(String indexName); boolean isUniqueIndex(); void setUniqueIndex(boolean uniqueIndex); String getUniqueIndexName(String tableName); void setUniqueIndexName(String uniqueIndexName); void setForeignAutoRefresh(boolean foreignAutoRefresh); boolean isForeignAutoRefresh(); int getMaxForeignAutoRefreshLevel(); void setMaxForeignAutoRefreshLevel(int maxForeignLevel); boolean isForeignCollection(); void setForeignCollection(boolean foreignCollection); boolean isForeignCollectionEager(); void setForeignCollectionEager(boolean foreignCollectionEager); int getForeignCollectionMaxEagerLevel(); void setForeignCollectionMaxEagerLevel(int foreignCollectionMaxEagerLevel); String getForeignCollectionColumnName(); void setForeignCollectionColumnName(String foreignCollectionColumn); String getForeignCollectionOrderColumnName(); void setForeignCollectionOrderColumnName(String foreignCollectionOrderColumn); boolean isForeignCollectionOrderAscending(); void setForeignCollectionOrderAscending(boolean foreignCollectionOrderAscending); String getForeignCollectionForeignFieldName(); void setForeignCollectionForeignFieldName(String foreignCollectionForeignFieldName); Class<? extends DataPersister> getPersisterClass(); void setPersisterClass(Class<? extends DataPersister> persisterClass); boolean isAllowGeneratedIdInsert(); void setAllowGeneratedIdInsert(boolean allowGeneratedIdInsert); String getColumnDefinition(); void setColumnDefinition(String columnDefinition); boolean isForeignAutoCreate(); void setForeignAutoCreate(boolean foreignAutoCreate); boolean isVersion(); void setVersion(boolean version); String getForeignColumnName(); void setForeignColumnName(String foreignColumnName); boolean isReadOnly(); void setReadOnly(boolean readOnly); static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field); static Method findGetMethod(Field field, boolean throwExceptions); static Method findSetMethod(Field field, boolean throwExceptions); static DatabaseFieldConfig fromDatabaseField(DatabaseType databaseType, String tableName, Field field,
DatabaseField databaseField); void postProcess(); static Enum<?> findMatchingEnumVal(Field field, String unknownEnumName); static final Class<? extends DataPersister> DEFAULT_PERSISTER_CLASS; static final DataType DEFAULT_DATA_TYPE; static final boolean DEFAULT_CAN_BE_NULL; static final boolean DEFAULT_FOREIGN_COLLECTION_ORDER_ASCENDING; static final int NO_MAX_FOREIGN_AUTO_REFRESH_LEVEL_SPECIFIED; }
|
@Test public void testFieldType() throws Exception { Field[] fields = LocalFoo.class.getDeclaredFields(); assertTrue(fields.length >= 4); Field nameField = fields[0]; Field rankField = fields[1]; Field serialField = fields[2]; Field intLongField = fields[3]; FieldType fieldType = FieldType.createFieldType(connectionSource, LocalFoo.class.getSimpleName(), nameField, LocalFoo.class); assertEquals(nameField.getName(), fieldType.getFieldName()); assertEquals(nameField.getName(), fieldType.getColumnName()); assertEquals(DataType.STRING.getDataPersister(), fieldType.getDataPersister()); assertEquals(0, fieldType.getWidth()); assertTrue(fieldType.toString().contains("Foo")); assertTrue(fieldType.toString().contains(nameField.getName())); fieldType = FieldType.createFieldType(connectionSource, LocalFoo.class.getSimpleName(), rankField, LocalFoo.class); assertEquals(RANK_DB_COLUMN_NAME, fieldType.getColumnName()); assertEquals(DataType.STRING.getDataPersister(), fieldType.getDataPersister()); assertEquals(RANK_WIDTH, fieldType.getWidth()); fieldType = FieldType.createFieldType(connectionSource, LocalFoo.class.getSimpleName(), serialField, LocalFoo.class); assertEquals(serialField.getName(), fieldType.getColumnName()); assertEquals(DataType.INTEGER_OBJ.getDataPersister(), fieldType.getDataPersister()); assertEquals(Integer.parseInt(SERIAL_DEFAULT_VALUE), fieldType.getDefaultValue()); String tableName = LocalFoo.class.getSimpleName(); fieldType = FieldType.createFieldType(connectionSource, tableName, intLongField, LocalFoo.class); assertEquals(intLongField.getName(), fieldType.getColumnName()); assertFalse(fieldType.isGeneratedId()); assertEquals(DataType.LONG.getDataPersister(), fieldType.getDataPersister()); }
|
public FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig, Class<?> parentClass) throws SQLException { this.connectionSource = connectionSource; this.tableName = tableName; DatabaseType databaseType = connectionSource.getDatabaseType(); this.field = field; this.parentClass = parentClass; fieldConfig.postProcess(); Class<?> clazz = field.getType(); DataPersister dataPersister; if (fieldConfig.getDataPersister() == null) { Class<? extends DataPersister> persisterClass = fieldConfig.getPersisterClass(); if (persisterClass == null || persisterClass == VoidType.class) { dataPersister = DataPersisterManager.lookupForField(field); } else { Method method; try { method = persisterClass.getDeclaredMethod("getSingleton"); } catch (Exception e) { throw SqlExceptionUtil .create("Could not find getSingleton static method on class " + persisterClass, e); } Object result; try { result = method.invoke(null); } catch (InvocationTargetException e) { throw SqlExceptionUtil.create("Could not run getSingleton method on class " + persisterClass, e.getTargetException()); } catch (Exception e) { throw SqlExceptionUtil.create("Could not run getSingleton method on class " + persisterClass, e); } if (result == null) { throw new SQLException( "Static getSingleton method should not return null on class " + persisterClass); } try { dataPersister = (DataPersister) result; } catch (Exception e) { throw SqlExceptionUtil .create("Could not cast result of static getSingleton method to DataPersister from class " + persisterClass, e); } } } else { dataPersister = fieldConfig.getDataPersister(); if (!dataPersister.isValidForField(field)) { StringBuilder sb = new StringBuilder(); sb.append("Field class ").append(clazz.getName()); sb.append(" for field ").append(this); sb.append(" is not valid for type ").append(dataPersister); Class<?> primaryClass = dataPersister.getPrimaryClass(); if (primaryClass != null) { sb.append(", maybe should be " + primaryClass); } throw new IllegalArgumentException(sb.toString()); } } String foreignColumnName = fieldConfig.getForeignColumnName(); String defaultFieldName = field.getName(); if (fieldConfig.isForeign() || fieldConfig.isForeignAutoRefresh() || foreignColumnName != null) { if (dataPersister != null && dataPersister.isPrimitive()) { throw new IllegalArgumentException( "Field " + this + " is a primitive class " + clazz + " but marked as foreign"); } if (foreignColumnName == null) { defaultFieldName = defaultFieldName + FOREIGN_ID_FIELD_SUFFIX; } else { defaultFieldName = defaultFieldName + "_" + foreignColumnName; } if (ForeignCollection.class.isAssignableFrom(clazz)) { throw new SQLException("Field '" + field.getName() + "' in class " + clazz + "' should use the @" + ForeignCollectionField.class.getSimpleName() + " annotation not foreign=true"); } } else if (fieldConfig.isForeignCollection()) { if (clazz != Collection.class && !ForeignCollection.class.isAssignableFrom(clazz)) { throw new SQLException("Field class for '" + field.getName() + "' must be of class " + ForeignCollection.class.getSimpleName() + " or Collection."); } Type type = field.getGenericType(); if (!(type instanceof ParameterizedType)) { throw new SQLException("Field class for '" + field.getName() + "' must be a parameterized Collection."); } Type[] genericArguments = ((ParameterizedType) type).getActualTypeArguments(); if (genericArguments.length == 0) { throw new SQLException("Field class for '" + field.getName() + "' must be a parameterized Collection with at least 1 type."); } } else if (dataPersister == null && (!fieldConfig.isForeignCollection())) { if (byte[].class.isAssignableFrom(clazz)) { throw new SQLException("ORMLite does not know how to store " + clazz + " for field '" + field.getName() + "'. byte[] fields must specify dataType=DataType.BYTE_ARRAY or SERIALIZABLE"); } else if (Serializable.class.isAssignableFrom(clazz)) { throw new SQLException("ORMLite does not know how to store " + clazz + " for field '" + field.getName() + "'. Use another class, custom persister, or to serialize it use " + "dataType=DataType.SERIALIZABLE"); } else { throw new IllegalArgumentException("ORMLite does not know how to store " + clazz + " for field " + field.getName() + ". Use another class or a custom persister."); } } if (fieldConfig.getColumnName() == null) { this.columnName = defaultFieldName; } else { this.columnName = fieldConfig.getColumnName(); } this.fieldConfig = fieldConfig; if (fieldConfig.isId()) { if (fieldConfig.isGeneratedId() || fieldConfig.getGeneratedIdSequence() != null) { throw new IllegalArgumentException( "Must specify one of id, generatedId, and generatedIdSequence with " + field.getName()); } this.isId = true; this.isGeneratedId = false; this.generatedIdSequence = null; } else if (fieldConfig.isGeneratedId()) { if (fieldConfig.getGeneratedIdSequence() != null) { throw new IllegalArgumentException( "Must specify one of id, generatedId, and generatedIdSequence with " + field.getName()); } this.isId = true; this.isGeneratedId = true; if (databaseType.isIdSequenceNeeded()) { this.generatedIdSequence = databaseType.generateIdSequenceName(tableName, this); } else { this.generatedIdSequence = null; } } else if (fieldConfig.getGeneratedIdSequence() != null) { this.isId = true; this.isGeneratedId = true; String seqName = fieldConfig.getGeneratedIdSequence(); if (databaseType.isEntityNamesMustBeUpCase()) { seqName = databaseType.upCaseEntityName(seqName); } this.generatedIdSequence = seqName; } else { this.isId = false; this.isGeneratedId = false; this.generatedIdSequence = null; } if (this.isId && (fieldConfig.isForeign() || fieldConfig.isForeignAutoRefresh())) { throw new IllegalArgumentException("Id field " + field.getName() + " cannot also be a foreign object"); } if (fieldConfig.isUseGetSet()) { this.fieldGetMethod = DatabaseFieldConfig.findGetMethod(field, true); this.fieldSetMethod = DatabaseFieldConfig.findSetMethod(field, true); } else { if (!field.isAccessible()) { try { this.field.setAccessible(true); } catch (SecurityException e) { throw new IllegalArgumentException("Could not open access to field " + field.getName() + ". You may have to set useGetSet=true to fix."); } } this.fieldGetMethod = null; this.fieldSetMethod = null; } if (fieldConfig.isAllowGeneratedIdInsert() && !fieldConfig.isGeneratedId()) { throw new IllegalArgumentException( "Field " + field.getName() + " must be a generated-id if allowGeneratedIdInsert = true"); } if (fieldConfig.isForeignAutoRefresh() && !fieldConfig.isForeign()) { throw new IllegalArgumentException( "Field " + field.getName() + " must have foreign = true if foreignAutoRefresh = true"); } if (fieldConfig.isForeignAutoCreate() && !fieldConfig.isForeign()) { throw new IllegalArgumentException( "Field " + field.getName() + " must have foreign = true if foreignAutoCreate = true"); } if (fieldConfig.getForeignColumnName() != null && !fieldConfig.isForeign()) { throw new IllegalArgumentException( "Field " + field.getName() + " must have foreign = true if foreignColumnName is set"); } if (fieldConfig.isVersion() && (dataPersister == null || !dataPersister.isValidForVersion())) { throw new IllegalArgumentException( "Field " + field.getName() + " is not a valid type to be a version field"); } assignDataType(databaseType, dataPersister); }
|
FieldType { public FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig, Class<?> parentClass) throws SQLException { this.connectionSource = connectionSource; this.tableName = tableName; DatabaseType databaseType = connectionSource.getDatabaseType(); this.field = field; this.parentClass = parentClass; fieldConfig.postProcess(); Class<?> clazz = field.getType(); DataPersister dataPersister; if (fieldConfig.getDataPersister() == null) { Class<? extends DataPersister> persisterClass = fieldConfig.getPersisterClass(); if (persisterClass == null || persisterClass == VoidType.class) { dataPersister = DataPersisterManager.lookupForField(field); } else { Method method; try { method = persisterClass.getDeclaredMethod("getSingleton"); } catch (Exception e) { throw SqlExceptionUtil .create("Could not find getSingleton static method on class " + persisterClass, e); } Object result; try { result = method.invoke(null); } catch (InvocationTargetException e) { throw SqlExceptionUtil.create("Could not run getSingleton method on class " + persisterClass, e.getTargetException()); } catch (Exception e) { throw SqlExceptionUtil.create("Could not run getSingleton method on class " + persisterClass, e); } if (result == null) { throw new SQLException( "Static getSingleton method should not return null on class " + persisterClass); } try { dataPersister = (DataPersister) result; } catch (Exception e) { throw SqlExceptionUtil .create("Could not cast result of static getSingleton method to DataPersister from class " + persisterClass, e); } } } else { dataPersister = fieldConfig.getDataPersister(); if (!dataPersister.isValidForField(field)) { StringBuilder sb = new StringBuilder(); sb.append("Field class ").append(clazz.getName()); sb.append(" for field ").append(this); sb.append(" is not valid for type ").append(dataPersister); Class<?> primaryClass = dataPersister.getPrimaryClass(); if (primaryClass != null) { sb.append(", maybe should be " + primaryClass); } throw new IllegalArgumentException(sb.toString()); } } String foreignColumnName = fieldConfig.getForeignColumnName(); String defaultFieldName = field.getName(); if (fieldConfig.isForeign() || fieldConfig.isForeignAutoRefresh() || foreignColumnName != null) { if (dataPersister != null && dataPersister.isPrimitive()) { throw new IllegalArgumentException( "Field " + this + " is a primitive class " + clazz + " but marked as foreign"); } if (foreignColumnName == null) { defaultFieldName = defaultFieldName + FOREIGN_ID_FIELD_SUFFIX; } else { defaultFieldName = defaultFieldName + "_" + foreignColumnName; } if (ForeignCollection.class.isAssignableFrom(clazz)) { throw new SQLException("Field '" + field.getName() + "' in class " + clazz + "' should use the @" + ForeignCollectionField.class.getSimpleName() + " annotation not foreign=true"); } } else if (fieldConfig.isForeignCollection()) { if (clazz != Collection.class && !ForeignCollection.class.isAssignableFrom(clazz)) { throw new SQLException("Field class for '" + field.getName() + "' must be of class " + ForeignCollection.class.getSimpleName() + " or Collection."); } Type type = field.getGenericType(); if (!(type instanceof ParameterizedType)) { throw new SQLException("Field class for '" + field.getName() + "' must be a parameterized Collection."); } Type[] genericArguments = ((ParameterizedType) type).getActualTypeArguments(); if (genericArguments.length == 0) { throw new SQLException("Field class for '" + field.getName() + "' must be a parameterized Collection with at least 1 type."); } } else if (dataPersister == null && (!fieldConfig.isForeignCollection())) { if (byte[].class.isAssignableFrom(clazz)) { throw new SQLException("ORMLite does not know how to store " + clazz + " for field '" + field.getName() + "'. byte[] fields must specify dataType=DataType.BYTE_ARRAY or SERIALIZABLE"); } else if (Serializable.class.isAssignableFrom(clazz)) { throw new SQLException("ORMLite does not know how to store " + clazz + " for field '" + field.getName() + "'. Use another class, custom persister, or to serialize it use " + "dataType=DataType.SERIALIZABLE"); } else { throw new IllegalArgumentException("ORMLite does not know how to store " + clazz + " for field " + field.getName() + ". Use another class or a custom persister."); } } if (fieldConfig.getColumnName() == null) { this.columnName = defaultFieldName; } else { this.columnName = fieldConfig.getColumnName(); } this.fieldConfig = fieldConfig; if (fieldConfig.isId()) { if (fieldConfig.isGeneratedId() || fieldConfig.getGeneratedIdSequence() != null) { throw new IllegalArgumentException( "Must specify one of id, generatedId, and generatedIdSequence with " + field.getName()); } this.isId = true; this.isGeneratedId = false; this.generatedIdSequence = null; } else if (fieldConfig.isGeneratedId()) { if (fieldConfig.getGeneratedIdSequence() != null) { throw new IllegalArgumentException( "Must specify one of id, generatedId, and generatedIdSequence with " + field.getName()); } this.isId = true; this.isGeneratedId = true; if (databaseType.isIdSequenceNeeded()) { this.generatedIdSequence = databaseType.generateIdSequenceName(tableName, this); } else { this.generatedIdSequence = null; } } else if (fieldConfig.getGeneratedIdSequence() != null) { this.isId = true; this.isGeneratedId = true; String seqName = fieldConfig.getGeneratedIdSequence(); if (databaseType.isEntityNamesMustBeUpCase()) { seqName = databaseType.upCaseEntityName(seqName); } this.generatedIdSequence = seqName; } else { this.isId = false; this.isGeneratedId = false; this.generatedIdSequence = null; } if (this.isId && (fieldConfig.isForeign() || fieldConfig.isForeignAutoRefresh())) { throw new IllegalArgumentException("Id field " + field.getName() + " cannot also be a foreign object"); } if (fieldConfig.isUseGetSet()) { this.fieldGetMethod = DatabaseFieldConfig.findGetMethod(field, true); this.fieldSetMethod = DatabaseFieldConfig.findSetMethod(field, true); } else { if (!field.isAccessible()) { try { this.field.setAccessible(true); } catch (SecurityException e) { throw new IllegalArgumentException("Could not open access to field " + field.getName() + ". You may have to set useGetSet=true to fix."); } } this.fieldGetMethod = null; this.fieldSetMethod = null; } if (fieldConfig.isAllowGeneratedIdInsert() && !fieldConfig.isGeneratedId()) { throw new IllegalArgumentException( "Field " + field.getName() + " must be a generated-id if allowGeneratedIdInsert = true"); } if (fieldConfig.isForeignAutoRefresh() && !fieldConfig.isForeign()) { throw new IllegalArgumentException( "Field " + field.getName() + " must have foreign = true if foreignAutoRefresh = true"); } if (fieldConfig.isForeignAutoCreate() && !fieldConfig.isForeign()) { throw new IllegalArgumentException( "Field " + field.getName() + " must have foreign = true if foreignAutoCreate = true"); } if (fieldConfig.getForeignColumnName() != null && !fieldConfig.isForeign()) { throw new IllegalArgumentException( "Field " + field.getName() + " must have foreign = true if foreignColumnName is set"); } if (fieldConfig.isVersion() && (dataPersister == null || !dataPersister.isValidForVersion())) { throw new IllegalArgumentException( "Field " + field.getName() + " is not a valid type to be a version field"); } assignDataType(databaseType, dataPersister); } }
|
FieldType { public FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig, Class<?> parentClass) throws SQLException { this.connectionSource = connectionSource; this.tableName = tableName; DatabaseType databaseType = connectionSource.getDatabaseType(); this.field = field; this.parentClass = parentClass; fieldConfig.postProcess(); Class<?> clazz = field.getType(); DataPersister dataPersister; if (fieldConfig.getDataPersister() == null) { Class<? extends DataPersister> persisterClass = fieldConfig.getPersisterClass(); if (persisterClass == null || persisterClass == VoidType.class) { dataPersister = DataPersisterManager.lookupForField(field); } else { Method method; try { method = persisterClass.getDeclaredMethod("getSingleton"); } catch (Exception e) { throw SqlExceptionUtil .create("Could not find getSingleton static method on class " + persisterClass, e); } Object result; try { result = method.invoke(null); } catch (InvocationTargetException e) { throw SqlExceptionUtil.create("Could not run getSingleton method on class " + persisterClass, e.getTargetException()); } catch (Exception e) { throw SqlExceptionUtil.create("Could not run getSingleton method on class " + persisterClass, e); } if (result == null) { throw new SQLException( "Static getSingleton method should not return null on class " + persisterClass); } try { dataPersister = (DataPersister) result; } catch (Exception e) { throw SqlExceptionUtil .create("Could not cast result of static getSingleton method to DataPersister from class " + persisterClass, e); } } } else { dataPersister = fieldConfig.getDataPersister(); if (!dataPersister.isValidForField(field)) { StringBuilder sb = new StringBuilder(); sb.append("Field class ").append(clazz.getName()); sb.append(" for field ").append(this); sb.append(" is not valid for type ").append(dataPersister); Class<?> primaryClass = dataPersister.getPrimaryClass(); if (primaryClass != null) { sb.append(", maybe should be " + primaryClass); } throw new IllegalArgumentException(sb.toString()); } } String foreignColumnName = fieldConfig.getForeignColumnName(); String defaultFieldName = field.getName(); if (fieldConfig.isForeign() || fieldConfig.isForeignAutoRefresh() || foreignColumnName != null) { if (dataPersister != null && dataPersister.isPrimitive()) { throw new IllegalArgumentException( "Field " + this + " is a primitive class " + clazz + " but marked as foreign"); } if (foreignColumnName == null) { defaultFieldName = defaultFieldName + FOREIGN_ID_FIELD_SUFFIX; } else { defaultFieldName = defaultFieldName + "_" + foreignColumnName; } if (ForeignCollection.class.isAssignableFrom(clazz)) { throw new SQLException("Field '" + field.getName() + "' in class " + clazz + "' should use the @" + ForeignCollectionField.class.getSimpleName() + " annotation not foreign=true"); } } else if (fieldConfig.isForeignCollection()) { if (clazz != Collection.class && !ForeignCollection.class.isAssignableFrom(clazz)) { throw new SQLException("Field class for '" + field.getName() + "' must be of class " + ForeignCollection.class.getSimpleName() + " or Collection."); } Type type = field.getGenericType(); if (!(type instanceof ParameterizedType)) { throw new SQLException("Field class for '" + field.getName() + "' must be a parameterized Collection."); } Type[] genericArguments = ((ParameterizedType) type).getActualTypeArguments(); if (genericArguments.length == 0) { throw new SQLException("Field class for '" + field.getName() + "' must be a parameterized Collection with at least 1 type."); } } else if (dataPersister == null && (!fieldConfig.isForeignCollection())) { if (byte[].class.isAssignableFrom(clazz)) { throw new SQLException("ORMLite does not know how to store " + clazz + " for field '" + field.getName() + "'. byte[] fields must specify dataType=DataType.BYTE_ARRAY or SERIALIZABLE"); } else if (Serializable.class.isAssignableFrom(clazz)) { throw new SQLException("ORMLite does not know how to store " + clazz + " for field '" + field.getName() + "'. Use another class, custom persister, or to serialize it use " + "dataType=DataType.SERIALIZABLE"); } else { throw new IllegalArgumentException("ORMLite does not know how to store " + clazz + " for field " + field.getName() + ". Use another class or a custom persister."); } } if (fieldConfig.getColumnName() == null) { this.columnName = defaultFieldName; } else { this.columnName = fieldConfig.getColumnName(); } this.fieldConfig = fieldConfig; if (fieldConfig.isId()) { if (fieldConfig.isGeneratedId() || fieldConfig.getGeneratedIdSequence() != null) { throw new IllegalArgumentException( "Must specify one of id, generatedId, and generatedIdSequence with " + field.getName()); } this.isId = true; this.isGeneratedId = false; this.generatedIdSequence = null; } else if (fieldConfig.isGeneratedId()) { if (fieldConfig.getGeneratedIdSequence() != null) { throw new IllegalArgumentException( "Must specify one of id, generatedId, and generatedIdSequence with " + field.getName()); } this.isId = true; this.isGeneratedId = true; if (databaseType.isIdSequenceNeeded()) { this.generatedIdSequence = databaseType.generateIdSequenceName(tableName, this); } else { this.generatedIdSequence = null; } } else if (fieldConfig.getGeneratedIdSequence() != null) { this.isId = true; this.isGeneratedId = true; String seqName = fieldConfig.getGeneratedIdSequence(); if (databaseType.isEntityNamesMustBeUpCase()) { seqName = databaseType.upCaseEntityName(seqName); } this.generatedIdSequence = seqName; } else { this.isId = false; this.isGeneratedId = false; this.generatedIdSequence = null; } if (this.isId && (fieldConfig.isForeign() || fieldConfig.isForeignAutoRefresh())) { throw new IllegalArgumentException("Id field " + field.getName() + " cannot also be a foreign object"); } if (fieldConfig.isUseGetSet()) { this.fieldGetMethod = DatabaseFieldConfig.findGetMethod(field, true); this.fieldSetMethod = DatabaseFieldConfig.findSetMethod(field, true); } else { if (!field.isAccessible()) { try { this.field.setAccessible(true); } catch (SecurityException e) { throw new IllegalArgumentException("Could not open access to field " + field.getName() + ". You may have to set useGetSet=true to fix."); } } this.fieldGetMethod = null; this.fieldSetMethod = null; } if (fieldConfig.isAllowGeneratedIdInsert() && !fieldConfig.isGeneratedId()) { throw new IllegalArgumentException( "Field " + field.getName() + " must be a generated-id if allowGeneratedIdInsert = true"); } if (fieldConfig.isForeignAutoRefresh() && !fieldConfig.isForeign()) { throw new IllegalArgumentException( "Field " + field.getName() + " must have foreign = true if foreignAutoRefresh = true"); } if (fieldConfig.isForeignAutoCreate() && !fieldConfig.isForeign()) { throw new IllegalArgumentException( "Field " + field.getName() + " must have foreign = true if foreignAutoCreate = true"); } if (fieldConfig.getForeignColumnName() != null && !fieldConfig.isForeign()) { throw new IllegalArgumentException( "Field " + field.getName() + " must have foreign = true if foreignColumnName is set"); } if (fieldConfig.isVersion() && (dataPersister == null || !dataPersister.isValidForVersion())) { throw new IllegalArgumentException( "Field " + field.getName() + " is not a valid type to be a version field"); } assignDataType(databaseType, dataPersister); } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig, Class<?> parentClass) throws SQLException { this.connectionSource = connectionSource; this.tableName = tableName; DatabaseType databaseType = connectionSource.getDatabaseType(); this.field = field; this.parentClass = parentClass; fieldConfig.postProcess(); Class<?> clazz = field.getType(); DataPersister dataPersister; if (fieldConfig.getDataPersister() == null) { Class<? extends DataPersister> persisterClass = fieldConfig.getPersisterClass(); if (persisterClass == null || persisterClass == VoidType.class) { dataPersister = DataPersisterManager.lookupForField(field); } else { Method method; try { method = persisterClass.getDeclaredMethod("getSingleton"); } catch (Exception e) { throw SqlExceptionUtil .create("Could not find getSingleton static method on class " + persisterClass, e); } Object result; try { result = method.invoke(null); } catch (InvocationTargetException e) { throw SqlExceptionUtil.create("Could not run getSingleton method on class " + persisterClass, e.getTargetException()); } catch (Exception e) { throw SqlExceptionUtil.create("Could not run getSingleton method on class " + persisterClass, e); } if (result == null) { throw new SQLException( "Static getSingleton method should not return null on class " + persisterClass); } try { dataPersister = (DataPersister) result; } catch (Exception e) { throw SqlExceptionUtil .create("Could not cast result of static getSingleton method to DataPersister from class " + persisterClass, e); } } } else { dataPersister = fieldConfig.getDataPersister(); if (!dataPersister.isValidForField(field)) { StringBuilder sb = new StringBuilder(); sb.append("Field class ").append(clazz.getName()); sb.append(" for field ").append(this); sb.append(" is not valid for type ").append(dataPersister); Class<?> primaryClass = dataPersister.getPrimaryClass(); if (primaryClass != null) { sb.append(", maybe should be " + primaryClass); } throw new IllegalArgumentException(sb.toString()); } } String foreignColumnName = fieldConfig.getForeignColumnName(); String defaultFieldName = field.getName(); if (fieldConfig.isForeign() || fieldConfig.isForeignAutoRefresh() || foreignColumnName != null) { if (dataPersister != null && dataPersister.isPrimitive()) { throw new IllegalArgumentException( "Field " + this + " is a primitive class " + clazz + " but marked as foreign"); } if (foreignColumnName == null) { defaultFieldName = defaultFieldName + FOREIGN_ID_FIELD_SUFFIX; } else { defaultFieldName = defaultFieldName + "_" + foreignColumnName; } if (ForeignCollection.class.isAssignableFrom(clazz)) { throw new SQLException("Field '" + field.getName() + "' in class " + clazz + "' should use the @" + ForeignCollectionField.class.getSimpleName() + " annotation not foreign=true"); } } else if (fieldConfig.isForeignCollection()) { if (clazz != Collection.class && !ForeignCollection.class.isAssignableFrom(clazz)) { throw new SQLException("Field class for '" + field.getName() + "' must be of class " + ForeignCollection.class.getSimpleName() + " or Collection."); } Type type = field.getGenericType(); if (!(type instanceof ParameterizedType)) { throw new SQLException("Field class for '" + field.getName() + "' must be a parameterized Collection."); } Type[] genericArguments = ((ParameterizedType) type).getActualTypeArguments(); if (genericArguments.length == 0) { throw new SQLException("Field class for '" + field.getName() + "' must be a parameterized Collection with at least 1 type."); } } else if (dataPersister == null && (!fieldConfig.isForeignCollection())) { if (byte[].class.isAssignableFrom(clazz)) { throw new SQLException("ORMLite does not know how to store " + clazz + " for field '" + field.getName() + "'. byte[] fields must specify dataType=DataType.BYTE_ARRAY or SERIALIZABLE"); } else if (Serializable.class.isAssignableFrom(clazz)) { throw new SQLException("ORMLite does not know how to store " + clazz + " for field '" + field.getName() + "'. Use another class, custom persister, or to serialize it use " + "dataType=DataType.SERIALIZABLE"); } else { throw new IllegalArgumentException("ORMLite does not know how to store " + clazz + " for field " + field.getName() + ". Use another class or a custom persister."); } } if (fieldConfig.getColumnName() == null) { this.columnName = defaultFieldName; } else { this.columnName = fieldConfig.getColumnName(); } this.fieldConfig = fieldConfig; if (fieldConfig.isId()) { if (fieldConfig.isGeneratedId() || fieldConfig.getGeneratedIdSequence() != null) { throw new IllegalArgumentException( "Must specify one of id, generatedId, and generatedIdSequence with " + field.getName()); } this.isId = true; this.isGeneratedId = false; this.generatedIdSequence = null; } else if (fieldConfig.isGeneratedId()) { if (fieldConfig.getGeneratedIdSequence() != null) { throw new IllegalArgumentException( "Must specify one of id, generatedId, and generatedIdSequence with " + field.getName()); } this.isId = true; this.isGeneratedId = true; if (databaseType.isIdSequenceNeeded()) { this.generatedIdSequence = databaseType.generateIdSequenceName(tableName, this); } else { this.generatedIdSequence = null; } } else if (fieldConfig.getGeneratedIdSequence() != null) { this.isId = true; this.isGeneratedId = true; String seqName = fieldConfig.getGeneratedIdSequence(); if (databaseType.isEntityNamesMustBeUpCase()) { seqName = databaseType.upCaseEntityName(seqName); } this.generatedIdSequence = seqName; } else { this.isId = false; this.isGeneratedId = false; this.generatedIdSequence = null; } if (this.isId && (fieldConfig.isForeign() || fieldConfig.isForeignAutoRefresh())) { throw new IllegalArgumentException("Id field " + field.getName() + " cannot also be a foreign object"); } if (fieldConfig.isUseGetSet()) { this.fieldGetMethod = DatabaseFieldConfig.findGetMethod(field, true); this.fieldSetMethod = DatabaseFieldConfig.findSetMethod(field, true); } else { if (!field.isAccessible()) { try { this.field.setAccessible(true); } catch (SecurityException e) { throw new IllegalArgumentException("Could not open access to field " + field.getName() + ". You may have to set useGetSet=true to fix."); } } this.fieldGetMethod = null; this.fieldSetMethod = null; } if (fieldConfig.isAllowGeneratedIdInsert() && !fieldConfig.isGeneratedId()) { throw new IllegalArgumentException( "Field " + field.getName() + " must be a generated-id if allowGeneratedIdInsert = true"); } if (fieldConfig.isForeignAutoRefresh() && !fieldConfig.isForeign()) { throw new IllegalArgumentException( "Field " + field.getName() + " must have foreign = true if foreignAutoRefresh = true"); } if (fieldConfig.isForeignAutoCreate() && !fieldConfig.isForeign()) { throw new IllegalArgumentException( "Field " + field.getName() + " must have foreign = true if foreignAutoCreate = true"); } if (fieldConfig.getForeignColumnName() != null && !fieldConfig.isForeign()) { throw new IllegalArgumentException( "Field " + field.getName() + " must have foreign = true if foreignColumnName is set"); } if (fieldConfig.isVersion() && (dataPersister == null || !dataPersister.isValidForVersion())) { throw new IllegalArgumentException( "Field " + field.getName() + " is not a valid type to be a version field"); } assignDataType(databaseType, dataPersister); } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig, Class<?> parentClass) throws SQLException { this.connectionSource = connectionSource; this.tableName = tableName; DatabaseType databaseType = connectionSource.getDatabaseType(); this.field = field; this.parentClass = parentClass; fieldConfig.postProcess(); Class<?> clazz = field.getType(); DataPersister dataPersister; if (fieldConfig.getDataPersister() == null) { Class<? extends DataPersister> persisterClass = fieldConfig.getPersisterClass(); if (persisterClass == null || persisterClass == VoidType.class) { dataPersister = DataPersisterManager.lookupForField(field); } else { Method method; try { method = persisterClass.getDeclaredMethod("getSingleton"); } catch (Exception e) { throw SqlExceptionUtil .create("Could not find getSingleton static method on class " + persisterClass, e); } Object result; try { result = method.invoke(null); } catch (InvocationTargetException e) { throw SqlExceptionUtil.create("Could not run getSingleton method on class " + persisterClass, e.getTargetException()); } catch (Exception e) { throw SqlExceptionUtil.create("Could not run getSingleton method on class " + persisterClass, e); } if (result == null) { throw new SQLException( "Static getSingleton method should not return null on class " + persisterClass); } try { dataPersister = (DataPersister) result; } catch (Exception e) { throw SqlExceptionUtil .create("Could not cast result of static getSingleton method to DataPersister from class " + persisterClass, e); } } } else { dataPersister = fieldConfig.getDataPersister(); if (!dataPersister.isValidForField(field)) { StringBuilder sb = new StringBuilder(); sb.append("Field class ").append(clazz.getName()); sb.append(" for field ").append(this); sb.append(" is not valid for type ").append(dataPersister); Class<?> primaryClass = dataPersister.getPrimaryClass(); if (primaryClass != null) { sb.append(", maybe should be " + primaryClass); } throw new IllegalArgumentException(sb.toString()); } } String foreignColumnName = fieldConfig.getForeignColumnName(); String defaultFieldName = field.getName(); if (fieldConfig.isForeign() || fieldConfig.isForeignAutoRefresh() || foreignColumnName != null) { if (dataPersister != null && dataPersister.isPrimitive()) { throw new IllegalArgumentException( "Field " + this + " is a primitive class " + clazz + " but marked as foreign"); } if (foreignColumnName == null) { defaultFieldName = defaultFieldName + FOREIGN_ID_FIELD_SUFFIX; } else { defaultFieldName = defaultFieldName + "_" + foreignColumnName; } if (ForeignCollection.class.isAssignableFrom(clazz)) { throw new SQLException("Field '" + field.getName() + "' in class " + clazz + "' should use the @" + ForeignCollectionField.class.getSimpleName() + " annotation not foreign=true"); } } else if (fieldConfig.isForeignCollection()) { if (clazz != Collection.class && !ForeignCollection.class.isAssignableFrom(clazz)) { throw new SQLException("Field class for '" + field.getName() + "' must be of class " + ForeignCollection.class.getSimpleName() + " or Collection."); } Type type = field.getGenericType(); if (!(type instanceof ParameterizedType)) { throw new SQLException("Field class for '" + field.getName() + "' must be a parameterized Collection."); } Type[] genericArguments = ((ParameterizedType) type).getActualTypeArguments(); if (genericArguments.length == 0) { throw new SQLException("Field class for '" + field.getName() + "' must be a parameterized Collection with at least 1 type."); } } else if (dataPersister == null && (!fieldConfig.isForeignCollection())) { if (byte[].class.isAssignableFrom(clazz)) { throw new SQLException("ORMLite does not know how to store " + clazz + " for field '" + field.getName() + "'. byte[] fields must specify dataType=DataType.BYTE_ARRAY or SERIALIZABLE"); } else if (Serializable.class.isAssignableFrom(clazz)) { throw new SQLException("ORMLite does not know how to store " + clazz + " for field '" + field.getName() + "'. Use another class, custom persister, or to serialize it use " + "dataType=DataType.SERIALIZABLE"); } else { throw new IllegalArgumentException("ORMLite does not know how to store " + clazz + " for field " + field.getName() + ". Use another class or a custom persister."); } } if (fieldConfig.getColumnName() == null) { this.columnName = defaultFieldName; } else { this.columnName = fieldConfig.getColumnName(); } this.fieldConfig = fieldConfig; if (fieldConfig.isId()) { if (fieldConfig.isGeneratedId() || fieldConfig.getGeneratedIdSequence() != null) { throw new IllegalArgumentException( "Must specify one of id, generatedId, and generatedIdSequence with " + field.getName()); } this.isId = true; this.isGeneratedId = false; this.generatedIdSequence = null; } else if (fieldConfig.isGeneratedId()) { if (fieldConfig.getGeneratedIdSequence() != null) { throw new IllegalArgumentException( "Must specify one of id, generatedId, and generatedIdSequence with " + field.getName()); } this.isId = true; this.isGeneratedId = true; if (databaseType.isIdSequenceNeeded()) { this.generatedIdSequence = databaseType.generateIdSequenceName(tableName, this); } else { this.generatedIdSequence = null; } } else if (fieldConfig.getGeneratedIdSequence() != null) { this.isId = true; this.isGeneratedId = true; String seqName = fieldConfig.getGeneratedIdSequence(); if (databaseType.isEntityNamesMustBeUpCase()) { seqName = databaseType.upCaseEntityName(seqName); } this.generatedIdSequence = seqName; } else { this.isId = false; this.isGeneratedId = false; this.generatedIdSequence = null; } if (this.isId && (fieldConfig.isForeign() || fieldConfig.isForeignAutoRefresh())) { throw new IllegalArgumentException("Id field " + field.getName() + " cannot also be a foreign object"); } if (fieldConfig.isUseGetSet()) { this.fieldGetMethod = DatabaseFieldConfig.findGetMethod(field, true); this.fieldSetMethod = DatabaseFieldConfig.findSetMethod(field, true); } else { if (!field.isAccessible()) { try { this.field.setAccessible(true); } catch (SecurityException e) { throw new IllegalArgumentException("Could not open access to field " + field.getName() + ". You may have to set useGetSet=true to fix."); } } this.fieldGetMethod = null; this.fieldSetMethod = null; } if (fieldConfig.isAllowGeneratedIdInsert() && !fieldConfig.isGeneratedId()) { throw new IllegalArgumentException( "Field " + field.getName() + " must be a generated-id if allowGeneratedIdInsert = true"); } if (fieldConfig.isForeignAutoRefresh() && !fieldConfig.isForeign()) { throw new IllegalArgumentException( "Field " + field.getName() + " must have foreign = true if foreignAutoRefresh = true"); } if (fieldConfig.isForeignAutoCreate() && !fieldConfig.isForeign()) { throw new IllegalArgumentException( "Field " + field.getName() + " must have foreign = true if foreignAutoCreate = true"); } if (fieldConfig.getForeignColumnName() != null && !fieldConfig.isForeign()) { throw new IllegalArgumentException( "Field " + field.getName() + " must have foreign = true if foreignColumnName is set"); } if (fieldConfig.isVersion() && (dataPersister == null || !dataPersister.isValidForVersion())) { throw new IllegalArgumentException( "Field " + field.getName() + " is not a valid type to be a version field"); } assignDataType(databaseType, dataPersister); } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test public void testQuote() throws Exception { String sql = "insert into table ... values(':dd',':xx')"; ASTRootNode n = new Parser(sql).parse().init(); List<Type> types = Lists.newArrayList(); ParameterContext ctx = getParameterContext(types); n.checkAndBind(ctx); InvocationContext context = DefaultInvocationContext.create(); n.render(context); BoundSql boundSql = context.getBoundSql(); assertThat(boundSql.getSql().toString(), equalTo("insert into table ... values(':dd',':xx')")); assertThat(boundSql.getArgs(), hasSize(0)); }
|
final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); final ASTRootNode parse(); final void DML(); final void Insert(); final void Delete(); final void Update(); final void Select(); final void Replace(); final void Merge(); final void Truncate(); final void Statement(); final void JDBCParameter(); final void JDBCIterableParameter(); final void GlobalTable(); final void JoinParameter(); final void QuoteText(); final void Text(); final void Blank(); final void IfStatement(); final void ElseStatement(); final void ElseIfStatement(); final void Expression(); final void ConditionalOrExpression(); final void ConditionalAndExpression(); final void RelationalExpression(); final void UnaryExpression(); final void PrimaryExpression(); final void ExpressionParameter(); final void IntegerLiteral(); final void StringLiteral(); final void True(); final void False(); final void Null(); void ReInit(java.io.InputStream stream); void ReInit(java.io.InputStream stream, String encoding); void ReInit(Reader stream); void ReInit(ParserTokenManager tm); final Token getNextToken(); final Token getToken(int index); ParseException generateParseException(); final void enable_tracing(); final void disable_tracing(); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); final ASTRootNode parse(); final void DML(); final void Insert(); final void Delete(); final void Update(); final void Select(); final void Replace(); final void Merge(); final void Truncate(); final void Statement(); final void JDBCParameter(); final void JDBCIterableParameter(); final void GlobalTable(); final void JoinParameter(); final void QuoteText(); final void Text(); final void Blank(); final void IfStatement(); final void ElseStatement(); final void ElseIfStatement(); final void Expression(); final void ConditionalOrExpression(); final void ConditionalAndExpression(); final void RelationalExpression(); final void UnaryExpression(); final void PrimaryExpression(); final void ExpressionParameter(); final void IntegerLiteral(); final void StringLiteral(); final void True(); final void False(); final void Null(); void ReInit(java.io.InputStream stream); void ReInit(java.io.InputStream stream, String encoding); void ReInit(Reader stream); void ReInit(ParserTokenManager tm); final Token getNextToken(); final Token getToken(int index); ParseException generateParseException(); final void enable_tracing(); final void disable_tracing(); public ParserTokenManager token_source; public Token token; public Token jj_nt; }
|
@Test(expected = IllegalArgumentException.class) public void testUnknownFieldType() throws Exception { Field[] fields = UnknownFieldType.class.getDeclaredFields(); assertTrue(fields.length >= 1); FieldType.createFieldType(connectionSource, UnknownFieldType.class.getSimpleName(), fields[0], UnknownFieldType.class); }
|
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test(expected = IllegalArgumentException.class) public void testIdAndGeneratedId() throws Exception { Field[] fields = IdAndGeneratedId.class.getDeclaredFields(); assertTrue(fields.length >= 1); FieldType.createFieldType(connectionSource, IdAndGeneratedId.class.getSimpleName(), fields[0], IdAndGeneratedId.class); }
|
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test(expected = IllegalArgumentException.class) public void testGeneratedIdAndSequence() throws Exception { Field[] fields = GeneratedIdAndSequence.class.getDeclaredFields(); assertTrue(fields.length >= 1); FieldType.createFieldType(connectionSource, GeneratedIdAndSequence.class.getSimpleName(), fields[0], GeneratedIdAndSequence.class); }
|
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test(expected = IllegalArgumentException.class) public void testGeneratedIdCantBeGenerated() throws Exception { Field[] fields = GeneratedIdCantBeGenerated.class.getDeclaredFields(); assertTrue(fields.length >= 1); FieldType.createFieldType(connectionSource, GeneratedIdCantBeGenerated.class.getSimpleName(), fields[0], GeneratedIdCantBeGenerated.class); }
|
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test(expected = IllegalArgumentException.class) public void testPrimitiveForeign() throws Exception { Field[] fields = ForeignPrimitive.class.getDeclaredFields(); assertTrue(fields.length >= 1); Field idField = fields[0]; FieldType.createFieldType(connectionSource, ForeignPrimitive.class.getSimpleName(), idField, ForeignPrimitive.class); }
|
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test(expected = IllegalArgumentException.class) public void testForeignAlsoId() throws Exception { Field[] fields = ForeignAlsoId.class.getDeclaredFields(); assertTrue(fields.length >= 1); Field fooField = fields[0]; FieldType.createFieldType(connectionSource, ForeignAlsoId.class.getSimpleName(), fooField, ForeignAlsoId.class); }
|
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test(expected = IllegalArgumentException.class) public void testObjectFieldNotForeign() throws Exception { Field[] fields = ObjectFieldNotForeign.class.getDeclaredFields(); assertTrue(fields.length >= 1); Field fooField = fields[0]; FieldType.createFieldType(connectionSource, ObjectFieldNotForeign.class.getSimpleName(), fooField, ObjectFieldNotForeign.class); }
|
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test(expected = IllegalArgumentException.class) public void testGetSetNoGet() throws Exception { Field[] fields = GetSetNoGet.class.getDeclaredFields(); assertTrue(fields.length >= 1); Field idField = fields[0]; FieldType.createFieldType(connectionSource, GetSetNoGet.class.getSimpleName(), idField, GetSetNoGet.class); }
|
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test(expected = IllegalArgumentException.class) public void testGetSetGetWrongType() throws Exception { Field[] fields = GetSetGetWrongType.class.getDeclaredFields(); assertTrue(fields.length >= 1); Field idField = fields[0]; FieldType.createFieldType(connectionSource, GetSetGetWrongType.class.getSimpleName(), idField, GetSetGetWrongType.class); }
|
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test(expected = IllegalArgumentException.class) public void testGetSetNoSet() throws Exception { Field[] fields = GetSetNoSet.class.getDeclaredFields(); assertTrue(fields.length >= 1); Field idField = fields[0]; FieldType.createFieldType(connectionSource, GetSetNoSet.class.getSimpleName(), idField, GetSetNoSet.class); }
|
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test public void testExpressionParameter4In() throws Exception { String sql = "select #if (:1) id in (:1) #end"; ASTRootNode n = new Parser(sql).parse().init(); ParameterContext ctx = getParameterContext(Lists.newArrayList(new TypeToken<List<Integer>>(){}.getType())); n.checkAndBind(ctx); InvocationContext context = DefaultInvocationContext.create(); List<Integer> ids = Lists.newArrayList(1, 2, 3); context.addParameter("1", ids); n.render(context); BoundSql boundSql = context.getBoundSql(); assertThat(boundSql.getSql(), Matchers.equalTo("select id in (?,?,?) ")); }
|
final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); final ASTRootNode parse(); final void DML(); final void Insert(); final void Delete(); final void Update(); final void Select(); final void Replace(); final void Merge(); final void Truncate(); final void Statement(); final void JDBCParameter(); final void JDBCIterableParameter(); final void GlobalTable(); final void JoinParameter(); final void QuoteText(); final void Text(); final void Blank(); final void IfStatement(); final void ElseStatement(); final void ElseIfStatement(); final void Expression(); final void ConditionalOrExpression(); final void ConditionalAndExpression(); final void RelationalExpression(); final void UnaryExpression(); final void PrimaryExpression(); final void ExpressionParameter(); final void IntegerLiteral(); final void StringLiteral(); final void True(); final void False(); final void Null(); void ReInit(java.io.InputStream stream); void ReInit(java.io.InputStream stream, String encoding); void ReInit(Reader stream); void ReInit(ParserTokenManager tm); final Token getNextToken(); final Token getToken(int index); ParseException generateParseException(); final void enable_tracing(); final void disable_tracing(); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); final ASTRootNode parse(); final void DML(); final void Insert(); final void Delete(); final void Update(); final void Select(); final void Replace(); final void Merge(); final void Truncate(); final void Statement(); final void JDBCParameter(); final void JDBCIterableParameter(); final void GlobalTable(); final void JoinParameter(); final void QuoteText(); final void Text(); final void Blank(); final void IfStatement(); final void ElseStatement(); final void ElseIfStatement(); final void Expression(); final void ConditionalOrExpression(); final void ConditionalAndExpression(); final void RelationalExpression(); final void UnaryExpression(); final void PrimaryExpression(); final void ExpressionParameter(); final void IntegerLiteral(); final void StringLiteral(); final void True(); final void False(); final void Null(); void ReInit(java.io.InputStream stream); void ReInit(java.io.InputStream stream, String encoding); void ReInit(Reader stream); void ReInit(ParserTokenManager tm); final Token getNextToken(); final Token getToken(int index); ParseException generateParseException(); final void enable_tracing(); final void disable_tracing(); public ParserTokenManager token_source; public Token token; public Token jj_nt; }
|
@Test(expected = IllegalArgumentException.class) public void testGetSetSetWrongType() throws Exception { Field[] fields = GetSetSetWrongType.class.getDeclaredFields(); assertTrue(fields.length >= 1); Field idField = fields[0]; FieldType.createFieldType(connectionSource, GetSetSetWrongType.class.getSimpleName(), idField, GetSetSetWrongType.class); }
|
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test(expected = IllegalArgumentException.class) public void testGetSetSetReturnNotVoid() throws Exception { Field[] fields = GetSetReturnNotVoid.class.getDeclaredFields(); assertNotNull(fields); assertTrue(fields.length >= 1); Field idField = fields[0]; FieldType.createFieldType(connectionSource, GetSetReturnNotVoid.class.getSimpleName(), idField, GetSetReturnNotVoid.class); }
|
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test public void testGetSet() throws Exception { Field[] fields = GetSet.class.getDeclaredFields(); assertTrue(fields.length >= 1); Field idField = fields[0]; FieldType.createFieldType(connectionSource, GetSet.class.getSimpleName(), idField, GetSet.class); }
|
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test public void testCreateFieldTypeNull() throws Exception { Field[] fields = NoAnnotation.class.getDeclaredFields(); assertTrue(fields.length >= 1); Field idField = fields[0]; assertNull(FieldType.createFieldType(connectionSource, NoAnnotation.class.getSimpleName(), idField, NoAnnotation.class)); }
|
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test(expected = SQLException.class) public void testGeneratedIdDefaultValue() throws Exception { Field[] fields = GeneratedIdDefault.class.getDeclaredFields(); assertTrue(fields.length >= 1); Field idField = fields[0]; FieldType.createFieldType(connectionSource, GeneratedIdDefault.class.getSimpleName(), idField, GeneratedIdDefault.class); }
|
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test(expected = SQLException.class) public void testThrowIfNullNotPrimitive() throws Exception { Field[] fields = ThrowIfNullNonPrimitive.class.getDeclaredFields(); assertTrue(fields.length >= 1); Field field = fields[0]; FieldType.createFieldType(connectionSource, ThrowIfNullNonPrimitive.class.getSimpleName(), field, ThrowIfNullNonPrimitive.class); }
|
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test(expected = SQLException.class) public void testBadDateDefaultValue() throws Exception { Field[] fields = DateDefaultBad.class.getDeclaredFields(); assertTrue(fields.length >= 1); Field field = fields[0]; FieldType.createFieldType(connectionSource, DateDefaultBad.class.getSimpleName(), field, DateDefaultBad.class); }
|
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test(expected = IllegalArgumentException.class) public void testInvalidEnumField() throws Exception { Field field = InvalidEnumType.class.getDeclaredField("stuff"); FieldType.createFieldType(connectionSource, InvalidEnumType.class.getSimpleName(), field, InvalidEnumType.class); }
|
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test public void testRecursiveForeign() throws Exception { Field field = Recursive.class.getDeclaredField("foreign"); FieldType.createFieldType(connectionSource, Recursive.class.getSimpleName(), field, Recursive.class); }
|
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test(expected = SQLException.class) public void testSerializableNoDataType() throws Exception { Field field = SerializableNoDataType.class.getDeclaredField("serial"); FieldType.createFieldType(connectionSource, SerializableNoDataType.class.getSimpleName(), field, SerializableNoDataType.class); }
|
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test public void testExpressionParameter4InEmpty() throws Exception { String sql = "select #if (:1) id in (:1) #end"; ASTRootNode n = new Parser(sql).parse().init(); ParameterContext ctx = getParameterContext(Lists.newArrayList(new TypeToken<List<Integer>>(){}.getType())); n.checkAndBind(ctx); InvocationContext context = DefaultInvocationContext.create(); List<Integer> ids = Lists.newArrayList(); context.addParameter("1", ids); n.render(context); BoundSql boundSql = context.getBoundSql(); assertThat(boundSql.getSql(), Matchers.equalTo("select ")); }
|
final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); final ASTRootNode parse(); final void DML(); final void Insert(); final void Delete(); final void Update(); final void Select(); final void Replace(); final void Merge(); final void Truncate(); final void Statement(); final void JDBCParameter(); final void JDBCIterableParameter(); final void GlobalTable(); final void JoinParameter(); final void QuoteText(); final void Text(); final void Blank(); final void IfStatement(); final void ElseStatement(); final void ElseIfStatement(); final void Expression(); final void ConditionalOrExpression(); final void ConditionalAndExpression(); final void RelationalExpression(); final void UnaryExpression(); final void PrimaryExpression(); final void ExpressionParameter(); final void IntegerLiteral(); final void StringLiteral(); final void True(); final void False(); final void Null(); void ReInit(java.io.InputStream stream); void ReInit(java.io.InputStream stream, String encoding); void ReInit(Reader stream); void ReInit(ParserTokenManager tm); final Token getNextToken(); final Token getToken(int index); ParseException generateParseException(); final void enable_tracing(); final void disable_tracing(); }
|
Parser implements ParserTreeConstants, ParserConstants { final public ASTRootNode parse() throws ParseException { ASTRootNode jjtn000 = new ASTRootNode(JJTROOTNODE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { DML(); ASTBlock jjtn001 = new ASTBlock(JJTBLOCK); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); jjtn001.jjtSetFirstToken(getToken(1)); try { label_1: while (true) { Statement(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BLANK: case QUOTE_TEXT: case JDBC_ITERABLE_PARAMETER: case JDBC_PARAMETER: case GLOBAL_TABLE: case JOIN_PARAMETER: case IF_DIRECTIVE: case INSERT: case DELETE: case UPDATE: case SELECT: case REPLACE: case MERGE: case TRUNCATE: case TEXT: ; break; default: jj_la1[0] = jj_gen; break label_1; } } } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte001;} } if (jjte001 instanceof ParseException) { {if (true) throw (ParseException)jjte001;} } {if (true) throw (Error)jjte001;} } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); jjtn001.jjtSetLastToken(getToken(0)); } } jj_consume_token(0); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return jjtn000;} } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } throw new Error("Missing return statement in function"); } Parser(String s); Parser(java.io.InputStream stream); Parser(java.io.InputStream stream, String encoding); Parser(Reader stream); Parser(ParserTokenManager tm); final ASTRootNode parse(); final void DML(); final void Insert(); final void Delete(); final void Update(); final void Select(); final void Replace(); final void Merge(); final void Truncate(); final void Statement(); final void JDBCParameter(); final void JDBCIterableParameter(); final void GlobalTable(); final void JoinParameter(); final void QuoteText(); final void Text(); final void Blank(); final void IfStatement(); final void ElseStatement(); final void ElseIfStatement(); final void Expression(); final void ConditionalOrExpression(); final void ConditionalAndExpression(); final void RelationalExpression(); final void UnaryExpression(); final void PrimaryExpression(); final void ExpressionParameter(); final void IntegerLiteral(); final void StringLiteral(); final void True(); final void False(); final void Null(); void ReInit(java.io.InputStream stream); void ReInit(java.io.InputStream stream, String encoding); void ReInit(Reader stream); void ReInit(ParserTokenManager tm); final Token getNextToken(); final Token getToken(int index); ParseException generateParseException(); final void enable_tracing(); final void disable_tracing(); public ParserTokenManager token_source; public Token token; public Token jj_nt; }
|
@Test(expected = SQLException.class) public void testByteArrayNoDataType() throws Exception { Field field = ByteArrayNoDataType.class.getDeclaredField("bytes"); FieldType.createFieldType(connectionSource, ByteArrayNoDataType.class.getSimpleName(), field, ByteArrayNoDataType.class); }
|
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test(expected = SQLException.class) public void testForeignCollectionNoGeneric() throws Exception { Field field = ForeignCollectionNoGeneric.class.getDeclaredField("foreignStuff"); FieldType.createFieldType(connectionSource, ForeignCollectionNoGeneric.class.getSimpleName(), field, ForeignCollectionNoGeneric.class); }
|
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test(expected = SQLException.class) public void testImproperId() throws Exception { Field field = ImproperIdType.class.getDeclaredField("id"); FieldType.createFieldType(connectionSource, ImproperIdType.class.getSimpleName(), field, ImproperIdType.class); }
|
public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { public static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field, Class<?> parentClass) throws SQLException { DatabaseType databaseType = connectionSource.getDatabaseType(); DatabaseFieldConfig fieldConfig = DatabaseFieldConfig.fromField(databaseType, tableName, field); if (fieldConfig == null) { return null; } else { return new FieldType(connectionSource, tableName, field, fieldConfig, parentClass); } } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
@Test public void testEquals() throws Exception { Field field1 = DefaultTypes.class.getDeclaredField("booleanField"); FieldType fieldType1 = FieldType.createFieldType(connectionSource, DefaultTypes.class.getSimpleName(), field1, DefaultTypes.class); FieldType fieldType2 = FieldType.createFieldType(connectionSource, DefaultTypes.class.getSimpleName(), field1, DefaultTypes.class); Field field2 = DefaultTypes.class.getDeclaredField("byteField"); FieldType fieldType3 = FieldType.createFieldType(connectionSource, DefaultTypes.class.getSimpleName(), field2, DefaultTypes.class); FieldType fieldType4 = FieldType.createFieldType(connectionSource, DefaultTypes.class.getSimpleName(), field2, DefaultTypes.class); assertTrue(fieldType1.equals(fieldType1)); assertTrue(fieldType2.equals(fieldType2)); assertTrue(fieldType1.equals(fieldType2)); assertTrue(fieldType2.equals(fieldType1)); assertEquals(fieldType1.hashCode(), fieldType2.hashCode()); assertFalse(fieldType1.equals(null)); assertFalse(fieldType1.equals(fieldType3)); assertFalse(fieldType1.equals(fieldType4)); assertFalse(fieldType3.equals(fieldType1)); assertFalse(fieldType4.equals(fieldType1)); assertTrue(fieldType3.equals(fieldType3)); assertTrue(fieldType4.equals(fieldType4)); assertTrue(fieldType3.equals(fieldType4)); assertTrue(fieldType4.equals(fieldType3)); assertEquals(fieldType3.hashCode(), fieldType4.hashCode()); }
|
@Override public boolean equals(Object arg) { if (arg == null || arg.getClass() != this.getClass()) { return false; } FieldType other = (FieldType) arg; return field.equals(other.field) && (parentClass == null ? other.parentClass == null : parentClass.equals(other.parentClass)); }
|
FieldType { @Override public boolean equals(Object arg) { if (arg == null || arg.getClass() != this.getClass()) { return false; } FieldType other = (FieldType) arg; return field.equals(other.field) && (parentClass == null ? other.parentClass == null : parentClass.equals(other.parentClass)); } }
|
FieldType { @Override public boolean equals(Object arg) { if (arg == null || arg.getClass() != this.getClass()) { return false; } FieldType other = (FieldType) arg; return field.equals(other.field) && (parentClass == null ? other.parentClass == null : parentClass.equals(other.parentClass)); } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); }
|
FieldType { @Override public boolean equals(Object arg) { if (arg == null || arg.getClass() != this.getClass()) { return false; } FieldType other = (FieldType) arg; return field.equals(other.field) && (parentClass == null ? other.parentClass == null : parentClass.equals(other.parentClass)); } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); }
|
FieldType { @Override public boolean equals(Object arg) { if (arg == null || arg.getClass() != this.getClass()) { return false; } FieldType other = (FieldType) arg; return field.equals(other.field) && (parentClass == null ? other.parentClass == null : parentClass.equals(other.parentClass)); } FieldType(ConnectionSource connectionSource, String tableName, Field field, DatabaseFieldConfig fieldConfig,
Class<?> parentClass); void configDaoInformation(ConnectionSource connectionSource, Class<?> parentClass); Field getField(); String getTableName(); String getFieldName(); Class<?> getType(); Type getGenericType(); String getColumnName(); DataPersister getDataPersister(); Object getDataTypeConfigObj(); SqlType getSqlType(); Object getDefaultValue(); int getWidth(); boolean isCanBeNull(); boolean isId(); boolean isGeneratedId(); boolean isGeneratedIdSequence(); String getGeneratedIdSequence(); boolean isForeign(); void assignField(Object data, Object val, boolean parentObject, ObjectCache objectCache); Object assignIdValue(Object data, Number val, ObjectCache objectCache); FV extractRawJavaFieldValue(Object object); Object extractJavaFieldValue(Object object); Object extractJavaFieldToSqlArgValue(Object object); Object convertJavaFieldToSqlArgValue(Object fieldVal); Object convertStringToJavaField(String value, int columnPos); Object moveToNextValue(Object val); FieldType getForeignIdField(); FieldType getForeignRefField(); boolean isEscapedValue(); Enum<?> getUnknownEnumVal(); String getFormat(); boolean isUnique(); boolean isUniqueCombo(); String getIndexName(); String getUniqueIndexName(); boolean isEscapedDefaultValue(); boolean isComparable(); boolean isArgumentHolderRequired(); boolean isForeignCollection(); BaseForeignCollection<FT, FID> buildForeignCollection(Object parent, FID id); T resultToJava(DatabaseResults results, Map<String, Integer> columnPositions); boolean isSelfGeneratedId(); boolean isAllowGeneratedIdInsert(); String getColumnDefinition(); boolean isForeignAutoCreate(); boolean isVersion(); Object generateId(); boolean isReadOnly(); FV getFieldValueIfNotDefault(Object object); boolean isObjectsFieldValueDefault(Object object); Object getJavaDefaultValueDefault(); int createWithForeignDao(T foreignData); static FieldType createFieldType(ConnectionSource connectionSource, String tableName, Field field,
Class<?> parentClass); @Override boolean equals(Object arg); @Override int hashCode(); @Override String toString(); static final String FOREIGN_ID_FIELD_SUFFIX; }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.