OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Compare Revisions

Regard whitespace Rev 155 → Rev 156

/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/MessageArgs.java
13,15 → 13,15
package org.openconcerto.utils.i18n;
 
import java.util.HashMap;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.TreeSet;
 
import com.ibm.icu.text.MessageFormat;
 
import net.jcip.annotations.ThreadSafe;
 
import com.ibm.icu.text.MessageFormat;
 
/**
* {@link MessageFormat} can take numbered or named arguments, this class unifies both. This class
* is thread safe if the array or map isn't modified.
33,6 → 33,16
return m instanceof LinkedHashMap;
}
 
static private final MessageArgs EMPTY = new MessageArgs(new Object[0]);
 
public final static MessageArgs getEmpty() {
return EMPTY;
}
 
public final static MessageArgs create(final String key, final Object value) {
return new MessageArgs(Collections.singletonMap(key, value));
}
 
private final boolean mapPrimary;
private Object[] array;
private Map<String, ?> map;
82,12 → 92,16
protected synchronized Map<String, ?> getMap() {
if (this.map == null) {
final int stop = this.array.length;
final Map<String, Object> res = new HashMap<String, Object>(stop);
if (stop == 0) {
this.map = Collections.emptyMap();
} else {
final Map<String, Object> res = new LinkedHashMap<>(stop);
for (int i = 0; i < stop; i++) {
res.put(String.valueOf(i), this.array[i]);
}
this.map = res;
this.map = Collections.unmodifiableMap(res);
}
}
return this.map;
}