mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Remove deprecated throwing get functions. (#213)
This commit is contained in:
@@ -562,17 +562,6 @@ public class NetworkTable implements ITable, IRemote {
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated This exception-raising method has been replaced by the
|
||||
* default-taking method {@link #getNumber(String, double)}.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public double getNumber(String key) throws TableKeyNotDefinedException {
|
||||
return NetworkTablesJNI.getDouble(pathWithSep + key);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -597,17 +586,6 @@ public class NetworkTable implements ITable, IRemote {
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated This exception-raising method has been replaced by the
|
||||
* default-taking method {@link #getString(String, String)}.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public String getString(String key) throws TableKeyNotDefinedException {
|
||||
return NetworkTablesJNI.getString(pathWithSep + key);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -632,17 +610,6 @@ public class NetworkTable implements ITable, IRemote {
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated This exception-raising method has been replaced by the
|
||||
* default-taking method {@link #getBoolean(String, boolean)}.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean getBoolean(String key) throws TableKeyNotDefinedException {
|
||||
return NetworkTablesJNI.getBoolean(pathWithSep + key);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -683,17 +650,6 @@ public class NetworkTable implements ITable, IRemote {
|
||||
toNative(defaultValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated This exception-raising method has been replaced by the
|
||||
* default-taking method {@link #getBooleanArray(String, boolean[])}.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean[] getBooleanArray(String key) throws TableKeyNotDefinedException {
|
||||
return NetworkTablesJNI.getBooleanArray(pathWithSep + key);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -707,11 +663,7 @@ public class NetworkTable implements ITable, IRemote {
|
||||
*/
|
||||
@Override
|
||||
public Boolean[] getBooleanArray(String key, Boolean[] defaultValue) {
|
||||
try {
|
||||
return fromNative(getBooleanArray(key));
|
||||
} catch (TableKeyNotDefinedException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
return fromNative(getBooleanArray(key, toNative(defaultValue)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -746,17 +698,6 @@ public class NetworkTable implements ITable, IRemote {
|
||||
toNative(defaultValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated This exception-raising method has been replaced by the
|
||||
* default-taking method {@link #getNumberArray(String, double[])}.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public double[] getNumberArray(String key) throws TableKeyNotDefinedException {
|
||||
return NetworkTablesJNI.getDoubleArray(pathWithSep + key);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -770,11 +711,7 @@ public class NetworkTable implements ITable, IRemote {
|
||||
*/
|
||||
@Override
|
||||
public Double[] getNumberArray(String key, Double[] defaultValue) {
|
||||
try {
|
||||
return fromNative(getNumberArray(key));
|
||||
} catch (TableKeyNotDefinedException e) {
|
||||
return defaultValue;
|
||||
}
|
||||
return fromNative(getNumberArray(key, toNative(defaultValue)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -793,17 +730,6 @@ public class NetworkTable implements ITable, IRemote {
|
||||
defaultValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated This exception-raising method has been replaced by the
|
||||
* default-taking method {@link #getStringArray(String, String[])}.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public String[] getStringArray(String key) throws TableKeyNotDefinedException {
|
||||
return NetworkTablesJNI.getStringArray(pathWithSep + key);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -840,17 +766,6 @@ public class NetworkTable implements ITable, IRemote {
|
||||
return NetworkTablesJNI.putRaw(pathWithSep + key, value, len);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated This exception-raising method has been replaced by the
|
||||
* default-taking method {@link #getRaw(String, byte[])}.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public byte[] getRaw(String key) throws TableKeyNotDefinedException {
|
||||
return NetworkTablesJNI.getRaw(pathWithSep + key);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -892,35 +807,6 @@ public class NetworkTable implements ITable, IRemote {
|
||||
throw new IllegalArgumentException("Value of type " + value.getClass().getName() + " cannot be put into a table");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated Use get*Array functions instead.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public void retrieveValue(String key, Object externalData) throws TableKeyNotDefinedException {
|
||||
Object value = getValue(key);
|
||||
if (value instanceof boolean[] && externalData instanceof BooleanArray)
|
||||
((ArrayData)externalData).setDataArray(fromNative((boolean[])value));
|
||||
else if (value instanceof double[] && externalData instanceof NumberArray)
|
||||
((ArrayData)externalData).setDataArray(fromNative((double[])value));
|
||||
else if (value instanceof String[] && externalData instanceof StringArray)
|
||||
((ArrayData)externalData).setDataArray((String[])value);
|
||||
else
|
||||
throw new TableKeyNotDefinedException(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated This exception-raising method has been replaced by the
|
||||
* default-taking method {@link #getValue(String, Object)}.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public Object getValue(String key) throws TableKeyNotDefinedException {
|
||||
return NetworkTablesJNI.getValue(pathWithSep + key);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -1039,40 +925,6 @@ public class NetworkTable implements ITable, IRemote {
|
||||
* Deprecated Methods
|
||||
*/
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated Use {@link #putNumber(String, double)} instead.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean putInt(String key, int value) {
|
||||
return putNumber(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated Use {@link #getNumber(String, double)} instead.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public int getInt(String key) throws TableKeyNotDefinedException {
|
||||
return (int)getNumber(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated Use {@link #getNumber(String, double)} instead.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public int getInt(String key, int defaultValue) throws TableKeyNotDefinedException {
|
||||
try {
|
||||
return (int)getNumber(key);
|
||||
} catch (NoSuchElementException ex) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated Use {@link #putNumber(String, double)} instead.
|
||||
@@ -1083,16 +935,6 @@ public class NetworkTable implements ITable, IRemote {
|
||||
return putNumber(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated Use {@link #getNumber(String, double)} instead.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public double getDouble(String key) throws TableKeyNotDefinedException {
|
||||
return getNumber(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @deprecated Use {@link #getNumber(String, double)} instead.
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
package edu.wpi.first.wpilibj.networktables;
|
||||
|
||||
import edu.wpi.first.wpilibj.tables.TableKeyNotDefinedException;
|
||||
|
||||
/**
|
||||
* An exception throw when the lookup a a key-value fails in a {@link NetworkTable}
|
||||
*
|
||||
* @deprecated to provide backwards compatability for new api
|
||||
*
|
||||
* @author Mitchell
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public class NetworkTableKeyNotDefined extends TableKeyNotDefinedException {
|
||||
|
||||
/**
|
||||
* @param key the key that was not defined in the table
|
||||
*/
|
||||
public NetworkTableKeyNotDefined(String key) {
|
||||
super(key);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package edu.wpi.first.wpilibj.networktables;
|
||||
|
||||
import edu.wpi.first.wpilibj.tables.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
@@ -83,15 +81,6 @@ public class NetworkTablesJNI {
|
||||
public static native void forcePutDoubleArray(String key, double[] value);
|
||||
public static native void forcePutStringArray(String key, String[] value);
|
||||
|
||||
public static native Object getValue(String key) throws TableKeyNotDefinedException;
|
||||
public static native boolean getBoolean(String key) throws TableKeyNotDefinedException;
|
||||
public static native double getDouble(String key) throws TableKeyNotDefinedException;
|
||||
public static native String getString(String key) throws TableKeyNotDefinedException;
|
||||
public static native byte[] getRaw(String key) throws TableKeyNotDefinedException;
|
||||
public static native boolean[] getBooleanArray(String key) throws TableKeyNotDefinedException;
|
||||
public static native double[] getDoubleArray(String key) throws TableKeyNotDefinedException;
|
||||
public static native String[] getStringArray(String key) throws TableKeyNotDefinedException;
|
||||
|
||||
public static native Object getValue(String key, Object defaultValue);
|
||||
public static native boolean getBoolean(String key, boolean defaultValue);
|
||||
public static native double getDouble(String key, double defaultValue);
|
||||
@@ -135,7 +124,6 @@ public class NetworkTablesJNI {
|
||||
|
||||
// public static native void createRpc(String key, byte[] def, IRpc rpc);
|
||||
// public static native void createRpc(String key, ByteBuffer def, int def_len, IRpc rpc);
|
||||
public static native byte[] getRpc(String key) throws TableKeyNotDefinedException;
|
||||
public static native byte[] getRpc(String key, byte[] defaultValue);
|
||||
public static native int callRpc(String key, byte[] params);
|
||||
public static native int callRpc(String key, ByteBuffer params, int params_len);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package edu.wpi.first.wpilibj.tables;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
@@ -109,22 +108,6 @@ public interface ITable {
|
||||
*/
|
||||
public void delete(String key);
|
||||
|
||||
/**
|
||||
* Gets the value associated with a key as an object. If the key does not
|
||||
* exist, it will return the default value
|
||||
* NOTE: If the value is a double, it will return a Double object,
|
||||
* not a primitive. To get the primitive, use
|
||||
* {@link #getDouble(String, double)}.
|
||||
* @param key the key of the value to look up
|
||||
* @return the value associated with the given key
|
||||
* @throws TableKeyNotDefinedException if there is no value associated with
|
||||
* the given key
|
||||
* @deprecated This exception-raising method has been replaced by the
|
||||
* default-taking method {@link #getValue(String, Object)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public Object getValue(String key) throws TableKeyNotDefinedException;
|
||||
|
||||
/**
|
||||
* Gets the value associated with a key as an object.
|
||||
* NOTE: If the value is a double, it will return a Double object,
|
||||
@@ -147,17 +130,6 @@ public interface ITable {
|
||||
public boolean putValue(String key, Object value)
|
||||
throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Retrieve an array data type from the table.
|
||||
* @param key the key to be assigned to
|
||||
* @param externalValue the array data type to retreive into
|
||||
* @throws TableKeyNotDefinedException if there is no value associated with
|
||||
* the given key
|
||||
* @deprecated Use get*Array functions instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public void retrieveValue(String key, Object externalValue) throws TableKeyNotDefinedException;
|
||||
|
||||
/**
|
||||
* Put a number in the table
|
||||
* @param key the key to be assigned to
|
||||
@@ -174,17 +146,6 @@ public interface ITable {
|
||||
*/
|
||||
public boolean setDefaultNumber(String key, double defaultValue);
|
||||
|
||||
/**
|
||||
* Returns the number the key maps to.
|
||||
* @param key the key to look up
|
||||
* @return the value associated with the given key
|
||||
* @throws TableKeyNotDefinedException if there is no value associated with
|
||||
* the given key
|
||||
* @deprecated This exception-raising method has been replaced by the
|
||||
* default-taking method {@link #getNumber(String, double)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public double getNumber(String key) throws TableKeyNotDefinedException;
|
||||
/**
|
||||
* Returns the number the key maps to. If the key does not exist or is of
|
||||
* different type, it will return the default value.
|
||||
@@ -211,17 +172,6 @@ public interface ITable {
|
||||
*/
|
||||
public boolean setDefaultString(String key, String defaultValue);
|
||||
|
||||
/**
|
||||
* Returns the string the key maps to.
|
||||
* @param key the key to look up
|
||||
* @return the value associated with the given key
|
||||
* @throws TableKeyNotDefinedException if there is no value associated with
|
||||
* the given key
|
||||
* @deprecated This exception-raising method has been replaced by the
|
||||
* default-taking method {@link #getString(String, String)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public String getString(String key) throws TableKeyNotDefinedException;
|
||||
/**
|
||||
* Returns the string the key maps to. If the key does not exist or is of
|
||||
* different type, it will return the default value.
|
||||
@@ -248,17 +198,6 @@ public interface ITable {
|
||||
*/
|
||||
public boolean setDefaultBoolean(String key, boolean defaultValue);
|
||||
|
||||
/**
|
||||
* Returns the boolean the key maps to.
|
||||
* @param key the key to look up
|
||||
* @return the value associated with the given key
|
||||
* @throws TableKeyNotDefinedException if there is no value associated with
|
||||
* the given key
|
||||
* @deprecated This exception-raising method has been replaced by the
|
||||
* default-taking method {@link #getBoolean(String, boolean)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean getBoolean(String key) throws TableKeyNotDefinedException;
|
||||
/**
|
||||
* Returns the boolean the key maps to. If the key does not exist or is of
|
||||
* different type, it will return the default value.
|
||||
@@ -301,17 +240,6 @@ public interface ITable {
|
||||
*/
|
||||
public boolean setDefaultBooleanArray(String key, Boolean[] defaultValue);
|
||||
|
||||
/**
|
||||
* Returns the boolean array the key maps to.
|
||||
* @param key the key to look up
|
||||
* @return the value associated with the given key
|
||||
* @throws TableKeyNotDefinedException if there is no value associated with
|
||||
* the given key
|
||||
* @deprecated This exception-raising method has been replaced by the
|
||||
* default-taking method {@link #getBooleanArray(String, boolean[])}.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean[] getBooleanArray(String key) throws TableKeyNotDefinedException;
|
||||
/**
|
||||
* Returns the boolean array the key maps to. If the key does not exist or is
|
||||
* of different type, it will return the default value.
|
||||
@@ -363,17 +291,6 @@ public interface ITable {
|
||||
*/
|
||||
public boolean setDefaultNumberArray(String key, Double[] defaultValue);
|
||||
|
||||
/**
|
||||
* Returns the number array the key maps to.
|
||||
* @param key the key to look up
|
||||
* @return the value associated with the given key
|
||||
* @throws TableKeyNotDefinedException if there is no value associated with
|
||||
* the given key
|
||||
* @deprecated This exception-raising method has been replaced by the
|
||||
* default-taking method {@link #getNumberArray(String, double[])}.
|
||||
*/
|
||||
@Deprecated
|
||||
public double[] getNumberArray(String key) throws TableKeyNotDefinedException;
|
||||
/**
|
||||
* Returns the number array the key maps to. If the key does not exist or is
|
||||
* of different type, it will return the default value.
|
||||
@@ -409,17 +326,6 @@ public interface ITable {
|
||||
*/
|
||||
public boolean setDefaultStringArray(String key, String[] defaultValue);
|
||||
|
||||
/**
|
||||
* Returns the string array the key maps to.
|
||||
* @param key the key to look up
|
||||
* @return the value associated with the given key
|
||||
* @throws TableKeyNotDefinedException if there is no value associated with
|
||||
* the given key
|
||||
* @deprecated This exception-raising method has been replaced by the
|
||||
* default-taking method {@link #getStringArray(String, String[])}.
|
||||
*/
|
||||
@Deprecated
|
||||
public String[] getStringArray(String key) throws TableKeyNotDefinedException;
|
||||
/**
|
||||
* Returns the string array the key maps to. If the key does not exist or is
|
||||
* of different type, it will return the default value.
|
||||
@@ -454,17 +360,7 @@ public interface ITable {
|
||||
* @return False if the table key already exists with a different type
|
||||
*/
|
||||
public boolean putRaw(String key, ByteBuffer value, int len);
|
||||
/**
|
||||
* Returns the raw value (byte array) the key maps to.
|
||||
* @param key the key to look up
|
||||
* @return the value associated with the given key
|
||||
* @throws TableKeyNotDefinedException if there is no value associated with
|
||||
* the given key
|
||||
* @deprecated This exception-raising method has been replaced by the
|
||||
* default-taking method {@link #getRaw(String, byte[])}.
|
||||
*/
|
||||
@Deprecated
|
||||
public byte[] getRaw(String key) throws TableKeyNotDefinedException;
|
||||
|
||||
/**
|
||||
* Returns the raw value (byte array) the key maps to. If the key does not
|
||||
* exist or is of different type, it will return the default value.
|
||||
@@ -543,48 +439,6 @@ public interface ITable {
|
||||
* Deprecated Methods
|
||||
*/
|
||||
|
||||
/**
|
||||
* Maps the specified key to the specified value in this table.
|
||||
* The key can not be null.
|
||||
* The value can be retrieved by calling the get method with a key that is
|
||||
* equal to the original key.
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
* @return False if the table key already exists with a different type
|
||||
* @throws IllegalArgumentException if key is null
|
||||
* @deprecated Use {@link #putNumber(String, double)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean putInt(String key, int value);
|
||||
|
||||
/**
|
||||
* Returns the value at the specified key.
|
||||
* @param key the key
|
||||
* @return the value
|
||||
* @throws TableKeyNotDefinedException if there is no value mapped to by the
|
||||
* key
|
||||
* @throws IllegalArgumentException if the value mapped to by the key is not
|
||||
* an int
|
||||
* @throws IllegalArgumentException if the key is null
|
||||
* @deprecated Use {@link #getNumber(String, double)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getInt(String key) throws TableKeyNotDefinedException;
|
||||
|
||||
/**
|
||||
* Returns the value at the specified key.
|
||||
* @param key the key
|
||||
* @param defaultValue the value returned if the key is undefined
|
||||
* @return the value
|
||||
* @throws IllegalArgumentException if the value mapped to by the key is not
|
||||
* an int
|
||||
* @throws IllegalArgumentException if the key is null
|
||||
* @deprecated Use {@link #getNumber(String, double)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public int getInt(String key, int defaultValue)
|
||||
throws TableKeyNotDefinedException;
|
||||
|
||||
/**
|
||||
* Maps the specified key to the specified value in this table.
|
||||
* The key can not be null.
|
||||
@@ -599,20 +453,6 @@ public interface ITable {
|
||||
@Deprecated
|
||||
public boolean putDouble(String key, double value);
|
||||
|
||||
/**
|
||||
* Returns the value at the specified key.
|
||||
* @param key the key
|
||||
* @return the value
|
||||
* @throws TableKeyNotDefinedException if there is no
|
||||
* value mapped to by the key
|
||||
* @throws IllegalArgumentException if the value mapped to by the key is not a
|
||||
* double
|
||||
* @throws IllegalArgumentException if the key is null
|
||||
* @deprecated Use {@link #getNumber(String, double)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public double getDouble(String key) throws TableKeyNotDefinedException;
|
||||
|
||||
/**
|
||||
* Returns the value at the specified key.
|
||||
* @param key the key
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package edu.wpi.first.wpilibj.tables;
|
||||
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
/**
|
||||
* An exception throw when the lookup a a key-value fails in a {@link ITable}
|
||||
*
|
||||
* @author Mitchell
|
||||
*
|
||||
*/
|
||||
public class TableKeyNotDefinedException extends NoSuchElementException {
|
||||
|
||||
/**
|
||||
* @param key the key that was not defined in the table
|
||||
*/
|
||||
public TableKeyNotDefinedException(String key) {
|
||||
super("Unknown Table Key: "+key);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user