Skip to content
This repository has been archived by the owner on Sep 21, 2020. It is now read-only.

Commit

Permalink
Remove deprecated throwing get functions. (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterJohnson authored Aug 4, 2017
1 parent 80c8de7 commit d910b0b
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 747 deletions.
162 changes: 2 additions & 160 deletions src/main/java/edu/wpi/first/wpilibj/networktables/NetworkTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -562,17 +562,6 @@ public boolean setDefaultNumber(String key, double defaultValue) {
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}
*/
Expand All @@ -597,17 +586,6 @@ public boolean setDefaultString(String key, String defaultValue) {
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}
*/
Expand All @@ -632,17 +610,6 @@ public boolean setDefaultBoolean(String key, boolean defaultValue) {
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}
*/
Expand Down Expand Up @@ -683,17 +650,6 @@ public boolean setDefaultBooleanArray(String key, Boolean[] defaultValue) {
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}
*/
Expand All @@ -707,11 +663,7 @@ public boolean[] getBooleanArray(String key, boolean[] defaultValue) {
*/
@Override
public Boolean[] getBooleanArray(String key, Boolean[] defaultValue) {
try {
return fromNative(getBooleanArray(key));
} catch (TableKeyNotDefinedException e) {
return defaultValue;
}
return fromNative(getBooleanArray(key, toNative(defaultValue)));
}

/**
Expand Down Expand Up @@ -746,17 +698,6 @@ public boolean setDefaultNumberArray(String key, Double[] defaultValue) {
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}
*/
Expand All @@ -770,11 +711,7 @@ public double[] getNumberArray(String key, double[] defaultValue) {
*/
@Override
public Double[] getNumberArray(String key, Double[] defaultValue) {
try {
return fromNative(getNumberArray(key));
} catch (TableKeyNotDefinedException e) {
return defaultValue;
}
return fromNative(getNumberArray(key, toNative(defaultValue)));
}

/**
Expand All @@ -793,17 +730,6 @@ public boolean setDefaultStringArray(String key, String[] defaultValue) {
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}
*/
Expand Down Expand Up @@ -840,17 +766,6 @@ public boolean putRaw(String key, ByteBuffer value, int len) {
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}
*/
Expand Down Expand Up @@ -892,35 +807,6 @@ else if (value instanceof StringArray)
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}
*/
Expand Down Expand Up @@ -1039,40 +925,6 @@ public static String[] loadPersistent(String filename) throws PersistentExceptio
* 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.
Expand All @@ -1083,16 +935,6 @@ public boolean putDouble(String key, double value) {
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.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -83,15 +81,6 @@ else if (System.getProperty("os.name").startsWith("Mac"))
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);
Expand Down Expand Up @@ -135,7 +124,6 @@ public interface ConnectionListenerFunction {

// 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);
Expand Down
Loading

0 comments on commit d910b0b

Please sign in to comment.