import org.opendaylight.yangtools.concepts.Immutable;
import org.opendaylight.yangtools.concepts.Mutable;
+@Deprecated(since = "7.0.9", forRemoval = true)
public final class Immutables {
private static final ImmutableSet<Class<?>> KNOWN_IMMUTABLES = ImmutableSet.of(
Integer.class, Short.class, BigDecimal.class, BigInteger.class, Byte.class, Character.class, Double.class,
* <p>Note: This method may return false to immutable objects which
* immutability is not known, was defined not using concepts term.
*
- * @param obj
- * Reference to check
+ * @param obj Reference to check
* @return true if object is known to be immutable false otherwise.
*/
public static boolean isImmutable(final Object obj) {
checkArgument(obj != null,"Object should not be null");
if (obj instanceof Mutable) {
return false;
- } else if (obj instanceof Immutable) {
- return true;
- } else if (obj instanceof String) {
- return true;
- } else if (KNOWN_IMMUTABLES.contains(obj.getClass())) {
+ } else if (obj instanceof Immutable || obj instanceof String || KNOWN_IMMUTABLES.contains(obj.getClass())) {
return true;
}
return false;