Ignore:
Timestamp:
2017-11-28T00:56:29+01:00 (6 years ago)
Author:
Don-vip
Message:

see #15310 - remove most of deprecated APIs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/CheckParameterUtil.java

    r12822 r13173  
    55import java.util.function.Predicate;
    66import java.util.function.Supplier;
    7 
    8 import org.openstreetmap.josm.data.coor.EastNorth;
    9 import org.openstreetmap.josm.data.coor.LatLon;
    10 import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
    11 import org.openstreetmap.josm.data.osm.PrimitiveId;
    127
    138/**
     
    6560
    6661    /**
    67      * Ensures an OSM primitive ID is valid
    68      * @param id The id to check
    69      * @param parameterName The parameter name
    70      * @throws IllegalArgumentException if the primitive ID is not valid (negative or zero)
    71      * @deprecated use {@link #ensure(Object, String, String, Predicate)}
    72      */
    73     @Deprecated
    74     public static void ensureValidPrimitiveId(PrimitiveId id, String parameterName) {
    75         ensureParameterNotNull(id, parameterName);
    76         if (id.getUniqueId() <= 0)
    77             throw new IllegalArgumentException(
    78                     MessageFormat.format("Expected unique id > 0 for primitive ''{1}'', got {0}", id.getUniqueId(), parameterName));
    79     }
    80 
    81     /**
    82      * Ensures lat/lon coordinates are valid
    83      * @param latlon The lat/lon to check
    84      * @param parameterName The parameter name
    85      * @throws IllegalArgumentException if the lat/lon are {@code null} or not valid
    86      * @since 5980
    87      * @deprecated use {@link #ensure(Object, String, Predicate)}
    88      */
    89     @Deprecated
    90     public static void ensureValidCoordinates(LatLon latlon, String parameterName) {
    91         ensureParameterNotNull(latlon, parameterName);
    92         if (!latlon.isValid())
    93             throw new IllegalArgumentException(
    94                     MessageFormat.format("Expected valid lat/lon for parameter ''{0}'', got {1}", parameterName, latlon));
    95     }
    96 
    97     /**
    98      * Ensures east/north coordinates are valid
    99      * @param eastnorth The east/north to check
    100      * @param parameterName The parameter name
    101      * @throws IllegalArgumentException if the east/north are {@code null} or not valid
    102      * @since 5980
    103      * @deprecated use {@link #ensure(Object, String, Predicate)}
    104      */
    105     @Deprecated
    106     public static void ensureValidCoordinates(EastNorth eastnorth, String parameterName) {
    107         ensureParameterNotNull(eastnorth, parameterName);
    108         if (!eastnorth.isValid())
    109             throw new IllegalArgumentException(
    110                     MessageFormat.format("Expected valid east/north for parameter ''{0}'', got {1}", parameterName, eastnorth));
    111     }
    112 
    113     /**
    114      * Ensures a version number is valid
    115      * @param version The version to check
    116      * @param parameterName The parameter name
    117      * @throws IllegalArgumentException if the version is not valid (negative)
    118      * @deprecated use {@link #ensure(Object, String, String, Predicate)}
    119      */
    120     @Deprecated
    121     public static void ensureValidVersion(long version, String parameterName) {
    122         if (version < 0)
    123             throw new IllegalArgumentException(
    124                     MessageFormat.format("Expected value of type long > 0 for parameter ''{0}'', got {1}", parameterName, version));
    125     }
    126 
    127     /**
    12862     * Ensures a parameter is not {@code null}
    12963     * @param value The parameter to check
     
    174108            throw new IllegalArgumentException(messageSupplier.get());
    175109    }
    176 
    177     /**
    178      * Ensures that <code>id</code> is non-null primitive id of type {@link OsmPrimitiveType#NODE}
    179      *
    180      * @param id the primitive  id
    181      * @param parameterName the name of the parameter to be checked
    182      * @throws IllegalArgumentException if id is null
    183      * @throws IllegalArgumentException if id.getType() != NODE
    184      * @deprecated use {@link #ensure(Object, String, String, Predicate)}
    185      */
    186     @Deprecated
    187     public static void ensureValidNodeId(PrimitiveId id, String parameterName) {
    188         ensureParameterNotNull(id, parameterName);
    189         if (!id.getType().equals(OsmPrimitiveType.NODE))
    190             throw new IllegalArgumentException(
    191                     MessageFormat.format("Parameter ''{0}'' of type node expected, got ''{1}''", parameterName, id.getType().getAPIName()));
    192     }
    193110}
Note: See TracChangeset for help on using the changeset viewer.