OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 144 Rev 149
Line 143... Line 143...
143
     * @throws IllegalStateException if not {@link #hasValue()}.
143
     * @throws IllegalStateException if not {@link #hasValue()}.
144
     */
144
     */
145
    public abstract V getValue() throws IllegalStateException;
145
    public abstract V getValue() throws IllegalStateException;
146
 
146
 
147
    /**
147
    /**
-
 
148
     * Return the value if {@link #hasValue()}, otherwise the passed one, never throws an exception.
-
 
149
     * 
-
 
150
     * @param def the default value.
-
 
151
     * @return either {@link #getValue()} or <code>def</code>.
-
 
152
     */
-
 
153
    public final V getValue(final V def) {
-
 
154
        if (this.hasValue())
-
 
155
            return this.getValue();
-
 
156
        else
-
 
157
            return def;
-
 
158
    }
-
 
159
 
-
 
160
    /**
148
     * Return <code>null</code> if and only if this has no value.
161
     * Return <code>null</code> if and only if this has no value.
149
     * 
162
     * 
150
     * @return non <code>null</code> {@link #getValue()} if {@link #hasValue()}, otherwise
163
     * @return non <code>null</code> {@link #getValue()} if {@link #hasValue()}, otherwise
151
     *         <code>null</code>.
164
     *         <code>null</code>.
152
     * @throws IllegalStateException if {@link #getValue()} is <code>null</code>.
165
     * @throws IllegalStateException if {@link #getValue()} is <code>null</code>.