From 62acbfcd81d0d5cf095aa07d8b5ba9756b4a4269 Mon Sep 17 00:00:00 2001 From: cketti Date: Tue, 24 Jan 2017 23:11:08 +0100 Subject: [PATCH] Use T as type parameter name --- .../com/fsck/k9/preferences/Settings.java | 36 +++++++++---------- .../fsck/k9/preferences/SettingsExporter.java | 12 +++---- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/k9mail/src/main/java/com/fsck/k9/preferences/Settings.java b/k9mail/src/main/java/com/fsck/k9/preferences/Settings.java index 2d0d1ceff..c2454acff 100644 --- a/k9mail/src/main/java/com/fsck/k9/preferences/Settings.java +++ b/k9mail/src/main/java/com/fsck/k9/preferences/Settings.java @@ -157,9 +157,9 @@ public class Settings { return deletedSettingsMutable; } - private static void upgradeSettingInsertDefault(Map validatedSettingsMutable, - String settingName, SettingsDescription setting) { - A defaultValue = setting.getDefaultValue(); + private static void upgradeSettingInsertDefault(Map validatedSettingsMutable, + String settingName, SettingsDescription setting) { + T defaultValue = setting.getDefaultValue(); validatedSettingsMutable.put(settingName, defaultValue); if (K9.DEBUG) { @@ -279,13 +279,13 @@ public class Settings { * negligible. *

*/ - static abstract class SettingsDescription
{ + static abstract class SettingsDescription { /** * The setting's default value (internal representation). */ - A mDefaultValue; + T mDefaultValue; - SettingsDescription(A defaultValue) { + SettingsDescription(T defaultValue) { mDefaultValue = defaultValue; } @@ -294,7 +294,7 @@ public class Settings { * * @return The internal representation of the default value. */ - public A getDefaultValue() { + public T getDefaultValue() { return mDefaultValue; } @@ -306,7 +306,7 @@ public class Settings { * * @return The string representation of {@code value}. */ - public String toString(A value) { + public String toString(T value) { return value.toString(); } @@ -321,7 +321,7 @@ public class Settings { * @throws InvalidSettingValueException * If {@code value} contains an invalid value. */ - public abstract A fromString(String value) throws InvalidSettingValueException; + public abstract T fromString(String value) throws InvalidSettingValueException; /** * Convert a setting value to the "pretty" string representation. @@ -331,7 +331,7 @@ public class Settings { * * @return A pretty-printed version of the setting's value. */ - public String toPrettyString(A value) { + public String toPrettyString(T value) { return toString(value); } @@ -347,7 +347,7 @@ public class Settings { * @throws InvalidSettingValueException * If {@code value} contains an invalid value. */ - public A fromPrettyString(String value) throws InvalidSettingValueException { + public T fromPrettyString(String value) throws InvalidSettingValueException { return fromString(value); } } @@ -483,24 +483,24 @@ public class Settings { /** * A setting that has multiple valid values but doesn't use an {@link Enum} internally. * - * @param + * @param * The type of the internal representation (e.g. {@code Integer}). */ - abstract static class PseudoEnumSetting extends SettingsDescription { - PseudoEnumSetting(A defaultValue) { + abstract static class PseudoEnumSetting extends SettingsDescription { + PseudoEnumSetting(T defaultValue) { super(defaultValue); } - protected abstract Map getMapping(); + protected abstract Map getMapping(); @Override - public String toPrettyString(A value) { + public String toPrettyString(T value) { return getMapping().get(value); } @Override - public A fromPrettyString(String value) throws InvalidSettingValueException { - for (Entry entry : getMapping().entrySet()) { + public T fromPrettyString(String value) throws InvalidSettingValueException { + for (Entry entry : getMapping().entrySet()) { if (entry.getValue().equals(value)) { return entry.getKey(); } diff --git a/k9mail/src/main/java/com/fsck/k9/preferences/SettingsExporter.java b/k9mail/src/main/java/com/fsck/k9/preferences/SettingsExporter.java index cc6976395..5b6b6d27b 100644 --- a/k9mail/src/main/java/com/fsck/k9/preferences/SettingsExporter.java +++ b/k9mail/src/main/java/com/fsck/k9/preferences/SettingsExporter.java @@ -492,18 +492,18 @@ public class SettingsExporter { } } - private static void writeKeyAndPrettyValueFromSetting(XmlSerializer serializer, String key, - SettingsDescription setting, String valueString) + private static void writeKeyAndPrettyValueFromSetting(XmlSerializer serializer, String key, + SettingsDescription setting, String valueString) throws IllegalArgumentException, IllegalStateException, IOException, InvalidSettingValueException { - A value = setting.fromString(valueString); + T value = setting.fromString(valueString); String outputValue = setting.toPrettyString(value); writeKeyAndPrettyValueFromSetting(serializer, key, outputValue); } - private static void writeKeyAndDefaultValueFromSetting(XmlSerializer serializer, String key, - SettingsDescription setting) throws IllegalArgumentException, IllegalStateException, IOException { - A value = setting.getDefaultValue(); + private static void writeKeyAndDefaultValueFromSetting(XmlSerializer serializer, String key, + SettingsDescription setting) throws IllegalArgumentException, IllegalStateException, IOException { + T value = setting.getDefaultValue(); String outputValue = setting.toPrettyString(value); writeKeyAndPrettyValueFromSetting(serializer, key, outputValue);