Java Collection Create createParameterizedWhereClause(Collection columns)

Here you can find the source of createParameterizedWhereClause(Collection columns)

Description

create Parameterized Where Clause

License

Open Source License

Declaration

static String createParameterizedWhereClause(Collection<?> columns) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.Collection;
import java.util.Iterator;

public class Main {
    static String createParameterizedWhereClause(Collection<?> columns) {
        StringBuilder builder = new StringBuilder();
        builder.append(" WHERE ");

        Iterator<?> iter = columns.iterator();
        while (iter.hasNext()) {
            Object column = iter.next();

            builder.append(column + " = ?");

            if (iter.hasNext()) {
                builder.append(" AND ");
            }/*from ww w  . j av a2s.com*/
        }

        return builder.toString();
    }
}

Related

  1. createIntArray(Collection collection)
  2. createIntegerInClause(Collection p_integers)
  3. createNamedInsert(String tableName, Collection columnNames)
  4. createNewValue(String value, Collection values)
  5. createNominalDescription(Collection values)
  6. createStringCollection(Class clazz, String... elements)
  7. createStringFromCollection(Collection svcInterfaces)
  8. createTextFromList(Collection list)
  9. createUniqueName(String baseName, Collection names)