Package com.reflectiondao.annotation

Examples of com.reflectiondao.annotation.DatabaseField


    try {

      List<Object> params = new ArrayList<Object>();

      for (Field f : this.type.getDeclaredFields()) {
        DatabaseField db = f.getAnnotation(DatabaseField.class);

        params.add(db.type().getValue(f, rs));

      }

      @SuppressWarnings("unchecked")
      Constructor<S> ctor = (Constructor<S>) this.type.getConstructors()[0];
View Full Code Here


    List<String> fields = new ArrayList<String>();

    DatabaseFieldStrategy<T> strat = new DatabaseFieldStrategy<>();

    for (Field f : this.name.getDeclaredFields()) {
      DatabaseField db = f.getAnnotation(DatabaseField.class);
      if (strat.isNotKey(db)) {
        String fieldName = db.name();
        fields.add(fieldName);
      }

    }

    String fieldsWithCommas = StringUtils.join(fields.toArray(), ",");

    String questionMarks = "";

    int i = 0;
    for (Field f : this.name.getDeclaredFields()) {

      if (i != 0) {
        questionMarks += ",";
      }

      DatabaseField db = f.getAnnotation(DatabaseField.class);
      if (strat.isNotKey(db)) {

        if (strat.hasDefault(db)) {
          questionMarks += db.defaultValue();
        } else {
          questionMarks += "?";
        }

        i++;
View Full Code Here

    String primaryKeyName = "";

    DatabaseFieldStrategy<T> strat = new DatabaseFieldStrategy<>();

    for (Field f : this.name.getDeclaredFields()) {
      DatabaseField db = f.getAnnotation(DatabaseField.class);
      if (strat.isKey(db)) {
        primaryKeyName = db.name();
      }

    }

    return "select * from " + name + " where " + primaryKeyName + "=?";
View Full Code Here

    Object a = null;

    DatabaseFieldStrategy<T> strat = new DatabaseFieldStrategy<>();

    for (Field f : t.getClass().getDeclaredFields()) {
      DatabaseField db = f.getAnnotation(DatabaseField.class);
      if (strat.isKey(db)) {
        f.setAccessible(true);

        try {
          a = f.get(t);
View Full Code Here

    String primaryKeyName = "";

    DatabaseFieldStrategy<T> strat = new DatabaseFieldStrategy<>();

    for (Field f : this.name.getDeclaredFields()) {
      DatabaseField db = f.getAnnotation(DatabaseField.class);
      if (strat.isKey(db)) {
        primaryKeyName = db.name();
      }

    }

    return "delete from " + name + " where " + primaryKeyName + " = ?";
View Full Code Here

    List<String> fields = new ArrayList<String>();

    DatabaseFieldStrategy<T> strat = new DatabaseFieldStrategy<>();

    for (Field f : this.name.getDeclaredFields()) {
      DatabaseField db = f.getAnnotation(DatabaseField.class);

      if (strat.isNotKey(db)) {
        String fieldName = db.name();
        fields.add(fieldName + "=?");
      }

    }
View Full Code Here

    int i = 1;

    DatabaseFieldStrategy<T> strat = new DatabaseFieldStrategy<>();

    for (Field f : t.getClass().getDeclaredFields()) {
      DatabaseField db = f.getAnnotation(DatabaseField.class);
      if (strat.isNotKey(db) && !strat.hasDefault(db)) {
        DatabaseType type = db.type();

        f.setAccessible(true);

        strat.processFieldForStatement(type, f, t, ps, i);
        i++;
View Full Code Here

    List<Object> objs = new ArrayList<Object>();

    DatabaseFieldStrategy<T> strat = new DatabaseFieldStrategy<>();

    for (Field f : this.name.getClass().getDeclaredFields()) {
      DatabaseField db = f.getAnnotation(DatabaseField.class);
      if (strat.isNotKey(db)) {

        f.setAccessible(true);

        try {
View Full Code Here

TOP

Related Classes of com.reflectiondao.annotation.DatabaseField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.