Package org.conserve.select.discriminators

Examples of org.conserve.select.discriminators.Equal


   * @param pattern
   * @return the number of deleted objects.
   */
  public int deleteObjects(Object pattern) throws SQLException
  {
    return persist.deleteObjects(pattern.getClass(), new Equal(pattern));
  }
View Full Code Here


   */
  public int deleteObjects(ConnectionWrapper cw, Object pattern)
      throws SQLException
  {
    return persist
        .deleteObjects(cw, pattern.getClass(), new Equal(pattern));
  }
View Full Code Here

   * @throws SQLException
   */
  @SuppressWarnings("unchecked")
  public <T> List<T> getObjectsMatching(T pattern) throws SQLException
  {
    return persist.getObjects((Class<T>) pattern.getClass(), new Equal(
        pattern, (Class<T>) pattern.getClass()));
  }
View Full Code Here

   *            return only objects that match the pattern object.
   */
  public <T> List<T> getObjectsMatching(Class<T> clazz, Object pattern)
      throws SQLException
  {
    return persist.getObjects(clazz, new Equal(pattern, clazz));
  }
View Full Code Here

   */
  @SuppressWarnings("unchecked")
  public <T> List<T> getObjectsMatching(ConnectionWrapper cw, T pattern)
      throws SQLException
  {
    return persist.getObjects(cw, (Class<T>) pattern.getClass(), new Equal(
        pattern, (Class<T>) pattern.getClass()));
  }
View Full Code Here

   *            return only objects that match the pattern object.
   */
  public <T> List<T> getObjectsMatching(ConnectionWrapper cw, Class<T> clazz,
      Object pattern) throws SQLException
  {
    return persist.getObjects(cw, clazz, new Equal(pattern, clazz));
  }
View Full Code Here

   * @param pattern
   *            return only objects that match the pattern object.
   */
  public long getCount(Class<?> clazz, Object pattern) throws SQLException
  {
    return persist.getCount(clazz, new Equal(pattern, clazz));
  }
View Full Code Here

   *            the connection wrapper to use for this transaction.
   */
  public long getCount(ConnectionWrapper cw, Class<?> clazz, Object pattern)
      throws SQLException
  {
    return persist.getCount(cw, clazz, new Equal(pattern, clazz));
  }
View Full Code Here

    assertEquals(3, allObjects.size());

    // find all objects that has the first entry equal to 'VALUE'.
    ArrayList<String> searchList = new ArrayList<String>();
    searchList.add("VALUE");
    List<Collection> searchResults = persist.getObjects(Collection.class, new Equal(searchList));
    // ensure that there are two
    assertEquals(2, searchResults.size());

    // find all objects that has the first entry equal to 'ANOTHER VALUE'
    searchList.clear();
    searchList.add("ANOTHER VALUE");
    searchResults = persist.getObjects(Collection.class, new Equal(searchList));
    // ensure that there is one
    assertEquals(1, searchResults.size());

    // find all objects that has an entry equal to 'ANOTHER VALUE'
    HashSet<String> unorderedSearchSet = new HashSet<String>();
    unorderedSearchSet.add("ANOTHER VALUE");
    searchResults = persist.getObjects(Collection.class, new Equal(unorderedSearchSet));
    // ensure that there are two
    assertEquals(2, searchResults.size());

    persist.close();
  }
View Full Code Here

    assertEquals(3, allObjects.size());

    // search by map contents
    Map<String, Double> searchMap = new HashMap<String, Double>();
    searchMap.put("KEY", 3.0);
    List<Map> result = persist.getObjects(Map.class, new Equal(searchMap));
    assertEquals(1, result.size());
    searchMap.clear();

    // search for all hashmaps with a given key
    searchMap.put("KEY", null);
    result = persist.getObjects(Map.class, new Equal(searchMap));
    assertEquals(2, result.size());
    searchMap.clear();

    // search for all hashmaps with a given key-value pair
    searchMap.put("ANOTHERKEY", 4.0);
    result = persist.getObjects(Map.class, new Equal(searchMap));
    assertEquals(2, result.size());

    persist.close();

  }
View Full Code Here

TOP

Related Classes of org.conserve.select.discriminators.Equal

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.