OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 174 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 174 Rev 180
Line 193... Line 193...
193
    public synchronized final SQLElement getElement(String tableName) {
193
    public synchronized final SQLElement getElement(String tableName) {
194
        return this.getElement(getSoleTable(this.tableNames, tableName));
194
        return this.getElement(getSoleTable(this.tableNames, tableName));
195
    }
195
    }
196
 
196
 
197
    /**
197
    /**
198
     * Search for an SQLElement whose class is <code>clazz</code>.
198
     * Search for an SQLElement which is an {@link Class#isInstance(Object) instance of}
-
 
199
     * <code>clazz</code>.
199
     * 
200
     * 
200
     * @param <S> type of SQLElement
201
     * @param <S> type of SQLElement
201
     * @param clazz the class.
202
     * @param clazz the class.
202
     * @return the corresponding SQLElement, or <code>null</code> if none can be found.
203
     * @return the corresponding SQLElement, or <code>null</code> if none can be found.
203
     * @throws IllegalArgumentException if there's more than one match.
204
     * @throws IllegalArgumentException if there's more than one match.
-
 
205
     * @see #getElementsOfClass(Class, boolean)
204
     */
206
     */
205
    public final <S extends SQLElement> S getElement(Class<S> clazz) {
207
    public final <S extends SQLElement> S getElement(Class<S> clazz) {
206
        return this.getElementOfClass(clazz, false);
208
        return this.getElementOfClass(clazz, true);
207
    }
209
    }
208
 
210
 
209
    public final <S extends SQLElement> S getElementOfClass(Class<S> clazz, final boolean allowSubclass) {
211
    public final <S extends SQLElement> S getElementOfClass(Class<S> clazz, final boolean allowSubclass) {
210
        final List<S> res = getElementsOfClass(clazz, allowSubclass);
212
        final List<S> res = getElementsOfClass(clazz, allowSubclass);
211
        if (res.size() > 1)
213
        if (res.size() > 1)