com.github.drinkjava2.jsqlbox
Class SqlMapperDefaultGuesser

java.lang.Object
  extended by com.github.drinkjava2.jsqlbox.SqlMapperDefaultGuesser
All Implemented Interfaces:
SqlMapperGuesser

public class SqlMapperDefaultGuesser
extends Object
implements SqlMapperGuesser

Guess and execute the SQL for a annotated ActiveRecord entity's method

Since:
1.0.8
Author:
Yong Zhu

Field Summary
static SqlMapperGuesser instance
           
 
Constructor Summary
SqlMapperDefaultGuesser()
           
 
Method Summary
 PreparedSQL doGuessPreparedSQL(SqlBoxContext ctx, Object ac, Object... params)
           
<T> T
guess(SqlBoxContext ctx, Object entity, Object... params)
          Execute operation to access database, based on current method @Sql annotated String or Text String and parameters, guess a best fit query/update/delete/execute method to run.
 String guessSQL(SqlBoxContext ctx, Object ac)
          Return the guessed SQL of a method which has @Sql annotation or Text in comment(need put Java in resources(class root) folder)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

public static final SqlMapperGuesser instance
Constructor Detail

SqlMapperDefaultGuesser

public SqlMapperDefaultGuesser()
Method Detail

guess

public <T> T guess(SqlBoxContext ctx,
                   Object entity,
                   Object... params)
Description copied from interface: SqlMapperGuesser
Execute operation to access database, based on current method @Sql annotated String or Text String and parameters, guess a best fit query/update/delete/execute method to run. SubClass can override this method to do different guess logic

Specified by:
guess in interface SqlMapperGuesser
entity - The ActiveRecord entity
params - The SQL params
Returns:
U The Result object, a generic type

guessSQL

public String guessSQL(SqlBoxContext ctx,
                       Object ac)
Description copied from interface: SqlMapperGuesser
Return the guessed SQL of a method which has @Sql annotation or Text in comment(need put Java in resources(class root) folder)

Specified by:
guessSQL in interface SqlMapperGuesser
ac - The ActiveRecord entity
Returns:
The SQL String

doGuessPreparedSQL

public PreparedSQL doGuessPreparedSQL(SqlBoxContext ctx,
                                      Object ac,
                                      Object... params)
Specified by:
doGuessPreparedSQL in interface SqlMapperGuesser
ac - The ActiveRecord entity
params - The Sql parameters
Returns:
The PreparedSQL instance


Copyright © 2018. All rights reserved.