Ignore:
Timestamp:
2017-09-04T23:45:49+02:00 (7 years ago)
Author:
Don-vip
Message:

see #13036 - deprecate Command() default constructor, fix unit tests and java warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/command/ChangePropertyCommand.java

    r12663 r12726  
    1313import java.util.List;
    1414import java.util.Map;
     15import java.util.NoSuchElementException;
    1516import java.util.Objects;
    1617import java.util.stream.Collectors;
     
    7273     * Creates a command to change multiple tags of multiple objects
    7374     *
    74      * @param objects the objects to modify
     75     * @param ds The target data set. Must not be {@code null}
     76     * @param objects the objects to modify. Must not be empty
    7577     * @param tags the tags to set
    76      */
    77     public ChangePropertyCommand(Collection<? extends OsmPrimitive> objects, Map<String, String> tags) {
     78     * @since 12726
     79     */
     80    public ChangePropertyCommand(DataSet ds, Collection<? extends OsmPrimitive> objects, Map<String, String> tags) {
     81        super(ds);
    7882        this.tags = tags;
    7983        init(objects);
     
    8185
    8286    /**
     87     * Creates a command to change multiple tags of multiple objects
     88     *
     89     * @param objects the objects to modify. Must not be empty, and objects must belong to a data set
     90     * @param tags the tags to set
     91     * @throws NullPointerException if objects is null or contain null item
     92     * @throws NoSuchElementException if objects is empty
     93     */
     94    public ChangePropertyCommand(Collection<? extends OsmPrimitive> objects, Map<String, String> tags) {
     95        this(objects.iterator().next().getDataSet(), objects, tags);
     96    }
     97
     98    /**
    8399     * Creates a command to change one tag of multiple objects
    84100     *
    85      * @param objects the objects to modify
     101     * @param objects the objects to modify. Must not be empty, and objects must belong to a data set
    86102     * @param key the key of the tag to set
    87103     * @param value the value of the key to set
     104     * @throws NullPointerException if objects is null or contain null item
     105     * @throws NoSuchElementException if objects is empty
    88106     */
    89107    public ChangePropertyCommand(Collection<? extends OsmPrimitive> objects, String key, String value) {
     108        super(objects.iterator().next().getDataSet());
    90109        this.tags = new HashMap<>(1);
    91110        this.tags.put(key, value);
     
    96115     * Creates a command to change one tag of one object
    97116     *
    98      * @param object the object to modify
     117     * @param object the object to modify. Must belong to a data set
    99118     * @param key the key of the tag to set
    100119     * @param value the value of the key to set
     120     * @throws NullPointerException if object is null
    101121     */
    102122    public ChangePropertyCommand(OsmPrimitive object, String key, String value) {
     
    134154    @Override
    135155    public boolean executeCommand() {
    136         if (objects.isEmpty())
    137             return true;
    138156        final DataSet dataSet = objects.get(0).getDataSet();
    139157        if (dataSet != null) {
Note: See TracChangeset for help on using the changeset viewer.