mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
[wpilib] Preferences: Deprecate Put* in favor of Set* (#3337)
This naming is more consistent with other APIs. Co-authored-by: Tyler Veness <calcmogul@gmail.com>
This commit is contained in:
@@ -75,14 +75,27 @@ public final class Preferences {
|
||||
* @param value the value
|
||||
* @throws NullPointerException if value is null
|
||||
*/
|
||||
public void putString(String key, String value) {
|
||||
requireNonNullParam(value, "value", "putString");
|
||||
public void setString(String key, String value) {
|
||||
requireNonNullParam(value, "value", "setString");
|
||||
|
||||
NetworkTableEntry entry = m_table.getEntry(key);
|
||||
entry.setString(value);
|
||||
entry.setPersistent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts the given string into the preferences table.
|
||||
*
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
* @throws NullPointerException if value is null
|
||||
* @deprecated Use {@link #setString(String, String)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void putString(String key, String value) {
|
||||
setString(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts the given string into the preferences table if it doesn't already exist.
|
||||
*
|
||||
@@ -100,12 +113,24 @@ public final class Preferences {
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
*/
|
||||
public void putInt(String key, int value) {
|
||||
public void setInt(String key, int value) {
|
||||
NetworkTableEntry entry = m_table.getEntry(key);
|
||||
entry.setDouble(value);
|
||||
entry.setPersistent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts the given int into the preferences table.
|
||||
*
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
* @deprecated Use {@link #setInt(String, int)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void putInt(String key, int value) {
|
||||
setInt(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts the given int into the preferences table if it doesn't already exist.
|
||||
*
|
||||
@@ -123,12 +148,23 @@ public final class Preferences {
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
*/
|
||||
public void putDouble(String key, double value) {
|
||||
public void setDouble(String key, double value) {
|
||||
NetworkTableEntry entry = m_table.getEntry(key);
|
||||
entry.setDouble(value);
|
||||
entry.setPersistent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts the given double into the preferences table.
|
||||
*
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
* @deprecated Use {@link #setDouble(String, double)}
|
||||
*/
|
||||
public void putDouble(String key, double value) {
|
||||
setDouble(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts the given double into the preferences table if it doesn't already exist.
|
||||
*
|
||||
@@ -146,12 +182,24 @@ public final class Preferences {
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
*/
|
||||
public void putFloat(String key, float value) {
|
||||
public void setFloat(String key, float value) {
|
||||
NetworkTableEntry entry = m_table.getEntry(key);
|
||||
entry.setDouble(value);
|
||||
entry.setPersistent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts the given float into the preferences table.
|
||||
*
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
* @deprecated Use {@link #setFloat(String, float)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void putFloat(String key, float value) {
|
||||
setFloat(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts the given float into the preferences table if it doesn't already exist.
|
||||
*
|
||||
@@ -169,12 +217,24 @@ public final class Preferences {
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
*/
|
||||
public void putBoolean(String key, boolean value) {
|
||||
public void setBoolean(String key, boolean value) {
|
||||
NetworkTableEntry entry = m_table.getEntry(key);
|
||||
entry.setBoolean(value);
|
||||
entry.setPersistent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts the given boolean into the preferences table.
|
||||
*
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
* @deprecated Use {@link #setBoolean(String, boolean)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void putBoolean(String key, boolean value) {
|
||||
setBoolean(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts the given boolean into the preferences table if it doesn't already exist.
|
||||
*
|
||||
@@ -192,12 +252,24 @@ public final class Preferences {
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
*/
|
||||
public void putLong(String key, long value) {
|
||||
public void setLong(String key, long value) {
|
||||
NetworkTableEntry entry = m_table.getEntry(key);
|
||||
entry.setDouble(value);
|
||||
entry.setPersistent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts the given long into the preferences table.
|
||||
*
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
* @deprecated Use {@link #setLong(String, long)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void putLong(String key, long value) {
|
||||
setLong(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts the given long into the preferences table if it doesn't already exist.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user