View Javadoc

    1   package sharin.sql;
    2
    3   import java.util.Arrays;
    4
    5   public class Sql {
    6
    7       private String text;
    8
    9       private Object[] params;
    10
    11      public Sql(String text, Object... params) {
    12          this.text = text;
    13          this.params = params;
    14      }
    15
    16      @Override
    17      public String toString() {
    18          StringBuilder builder = new StringBuilder();
    19          builder.append(text);
    20
    21          if (params != null && params.length > 0) {
    22              builder.append(' ');
    23              builder.append(Arrays.toString(params));
    24          }
    25
    26          return builder.toString();
    27      }
    28
    29      public String getText() {
    30          return text;
    31      }
    32
    33      public void setText(String text) {
    34          this.text = text;
    35      }
    36
    37      public Object[] getParams() {
    38          return params;
    39      }
    40
    41      public void setParams(Object... params) {
    42          this.params = params;
    43      }
    44  }