OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 17 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 17 Rev 182
Line 1... Line 1...
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
3
 * 
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
4
 * Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
5
 * 
5
 * 
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
9
 * language governing permissions and limitations under the License.
Line 25... Line 25...
25
 * 
25
 * 
26
 * @author Sylvain CUAZ
26
 * @author Sylvain CUAZ
27
 */
27
 */
28
public class FormatGroup extends Format {
28
public class FormatGroup extends Format {
29
 
29
 
30
    private final List<? extends Format> formats;
30
    private final List<Format> formats;
31
    private int formatIndex;
31
    private int formatIndex;
32
 
32
 
33
    public FormatGroup(Format... formats) {
33
    public FormatGroup(Format... formats) {
34
        this(Arrays.asList(formats));
34
        this(Arrays.asList(formats));
35
    }
35
    }
Line 42... Line 42...
42
     * @throws IllegalArgumentException if formats is empty.
42
     * @throws IllegalArgumentException if formats is empty.
43
     */
43
     */
44
    public FormatGroup(final List<? extends Format> formats) {
44
    public FormatGroup(final List<? extends Format> formats) {
45
        if (formats.size() == 0)
45
        if (formats.size() == 0)
46
            throw new IllegalArgumentException("formats must not be empty");
46
            throw new IllegalArgumentException("formats must not be empty");
47
        this.formats = formats;
47
        this.formats = CollectionUtils.toImmutableList(formats);
48
        this.formatIndex = 0;
48
        this.formatIndex = 0;
49
    }
49
    }
50
 
50
 
51
    public final List<? extends Format> getFormats() {
51
    public final List<Format> getFormats() {
52
        return this.formats;
52
        return this.formats;
53
    }
53
    }
54
 
54
 
55
    @Override
55
    @Override
56
    public StringBuffer format(Object newVal, StringBuffer toAppendTo, FieldPosition pos) {
56
    public StringBuffer format(Object newVal, StringBuffer toAppendTo, FieldPosition pos) {