/** * Returns a GroovyRowResult given a ResultSet. * * @param rs a ResultSet * @return the resulting GroovyRowResult * @throws java.sql.SQLException if a database error occurs * @since 1.6.0 */ public static GroovyRowResult toRowResult(ResultSet rs) throws SQLException { ResultSetMetaData metadata = rs.getMetaData(); Map<String, Object> lhm = new LinkedHashMap<String, Object>(metadata.getColumnCount(), 1); for (int i = 1; i <= metadata.getColumnCount(); i++) { lhm.put(metadata.getColumnLabel(i), rs.getObject(i)); } return new GroovyRowResult(lhm); }
/** * Find the property value for the given name (ignoring case). * * @param property the name of the property to get * @return the property value */ public Object get(Object property) { if (property instanceof String) return getProperty((String)property); return null; }
/** * Checks if the result contains (ignoring case) the given key. * * @param key the property name to look for * @return true if the result contains this property name */ public boolean containsKey(Object key) { return lookupKeyIgnoringCase(key) != null; }
/** * Copies all of the mappings from the specified map to this result. * If the map contains different case versions of the same (case-insensitive) key * only the last (according to the natural ordering of the supplied map) will remain * after the {@code putAll} method has returned. * * @param t the mappings to store in this result */ @SuppressWarnings("unchecked") public void putAll(Map t) { // don't delegate to putAll since we want case handling from put for (Entry next : (Set<Entry>) t.entrySet()) { put(next.getKey(), next.getValue()); } }
/** * Associates the specified value with the specified property name in this result. * * @param key the property name for the result * @param value the property value for the result * @return the previous value associated with <tt>key</tt>, or * <tt>null</tt> if there was no mapping for <tt>key</tt>. * (A <tt>null</tt> return can also indicate that the map * previously associated <tt>null</tt> with <tt>key</tt>.) */ @SuppressWarnings("unchecked") public Object put(Object key, Object value) { // avoid different case keys being added by explicit remove Object orig = remove(key); result.put(key, value); return orig; }
/** * Copies all of the mappings from the specified map to this result. * If the map contains different case versions of the same (case-insensitive) key * only the last (according to the natural ordering of the supplied map) will remain * after the {@code putAll} method has returned. * * @param t the mappings to store in this result */ @SuppressWarnings("unchecked") public void putAll(Map t) { // don't delegate to putAll since we want case handling from put for (Entry next : (Set<Entry>) t.entrySet()) { put(next.getKey(), next.getValue()); } }
/** * Associates the specified value with the specified property name in this result. * * @param key the property name for the result * @param value the property value for the result * @return the previous value associated with <tt>key</tt>, or * <tt>null</tt> if there was no mapping for <tt>key</tt>. * (A <tt>null</tt> return can also indicate that the map * previously associated <tt>null</tt> with <tt>key</tt>.) */ @SuppressWarnings("unchecked") public Object put(Object key, Object value) { // avoid different case keys being added by explicit remove Object orig = remove(key); result.put(key, value); return orig; }
public Object get(Object property) { if (property instanceof String) return getProperty((String)property); else return null; }
/** * Returns a GroovyRowResult given a ResultSet. * * @param rs a ResultSet * @return the resulting GroovyRowResult * @throws SQLException if a database error occurs */ public static GroovyRowResult toRowResult(ResultSet rs) throws SQLException { ResultSetMetaData metadata = rs.getMetaData(); LinkedHashMap lhm = new LinkedHashMap(metadata.getColumnCount(), 1); for (int i = 1; i <= metadata.getColumnCount(); i++) { lhm.put(metadata.getColumnName(i), rs.getObject(i)); } return new GroovyRowResult(lhm); }
public Object remove(Object rawKey) { return result.remove(lookupKeyIgnoringCase(rawKey)); }
/** * Find the property value for the given name (ignoring case). * * @param property the name of the property to get * @return the property value */ public Object get(Object property) { if (property instanceof String) return getProperty((String)property); return null; }
/** * Returns a GroovyRowResult given a ResultSet. * * @param rs a ResultSet * @return the resulting GroovyRowResult * @throws SQLException if a database error occurs * @since 1.6.0 */ public static GroovyRowResult toRowResult(ResultSet rs) throws SQLException { ResultSetMetaData metadata = rs.getMetaData(); LinkedHashMap lhm = new LinkedHashMap(metadata.getColumnCount(), 1); for (int i = 1; i <= metadata.getColumnCount(); i++) { lhm.put(metadata.getColumnLabel(i), rs.getObject(i)); } return new GroovyRowResult(lhm); }
/** * Retrieve the value of the property by its (case-insensitive) name. * * @param property is the name of the property to look at * @return the value of the property */ public Object getProperty(String property) { try { Object key = lookupKeyIgnoringCase(property); if (key != null) { return result.get(key); } throw new MissingPropertyException(property, GroovyRowResult.class); } catch (Exception e) { throw new MissingPropertyException(property, GroovyRowResult.class, e); } }
public Object get(Object property) { if (property instanceof String) return getProperty((String)property); else return null; }
/** * Returns a GroovyRowResult given a ResultSet. * * @param rs a ResultSet * @return the resulting GroovyRowResult * @throws java.sql.SQLException if a database error occurs * @since 1.6.0 */ public static GroovyRowResult toRowResult(ResultSet rs) throws SQLException { ResultSetMetaData metadata = rs.getMetaData(); Map<String, Object> lhm = new LinkedHashMap<String, Object>(metadata.getColumnCount(), 1); for (int i = 1; i <= metadata.getColumnCount(); i++) { lhm.put(metadata.getColumnLabel(i), rs.getObject(i)); } return new GroovyRowResult(lhm); }
/** * Checks if the result contains (ignoring case) the given key. * * @param key the property name to look for * @return true if the result contains this property name */ public boolean containsKey(Object key) { return lookupKeyIgnoringCase(key) != null; }
public Object get(Object property) { if (property instanceof String) return getProperty((String)property); return null; }
/** * Returns a GroovyRowResult given a ResultSet. * * @param rs a ResultSet * @return the resulting GroovyRowResult * @throws java.sql.SQLException if a database error occurs * @since 1.6.0 */ public static GroovyRowResult toRowResult(ResultSet rs) throws SQLException { ResultSetMetaData metadata = rs.getMetaData(); Map<String, Object> lhm = new LinkedHashMap<String, Object>(metadata.getColumnCount(), 1); for (int i = 1; i <= metadata.getColumnCount(); i++) { lhm.put(metadata.getColumnLabel(i), rs.getObject(i)); } return new GroovyRowResult(lhm); }
public boolean containsKey(Object key) { return lookupKeyIgnoringCase(key) != null; }
public Object get(Object property) { if (property instanceof String) return getProperty((String)property); else return null; }