semi-auto cleanup

This commit is contained in:
gnembon committed 2023-02-04 13:26:21 +01:00
1 parent cad80f82c6
commit 8f61271606
99 files changed
+11463 -8007

No files matched your search

@@ -50,8 +50,9 @@ public final class ValueCaster<R> implements ValueConverter<R> // R always exten
private final Class<R> outputType;
private final String typeName;
private ValueCaster(Class<R> outputType, String typeName)
private ValueCaster(final Class<R> outputType, final String typeName)
{
super();
this.outputType = outputType;
this.typeName = typeName;
}
@@ -71,17 +72,19 @@ public final class ValueCaster<R> implements ValueConverter<R> // R always exten
*/
@SuppressWarnings("unchecked") // Casters are stored with their exact class, for sure since the map is private (&& class has same generic as
// caster)
public static <R> ValueCaster<R> get(Class<R> outputType)
public static <R> ValueCaster<R> get(final Class<R> outputType)
{
return (ValueCaster<R>) byResult.get(outputType);
}
@Override
@SuppressWarnings("unchecked") // more than checked, see SimpleTypeConverter#converter for reasoning
public R convert(Value value)
public R convert(final Value value)
{
if (!outputType.isInstance(value))
{
return null;
}
return (R)value;
}
@@ -94,9 +97,9 @@ public final class ValueCaster<R> implements ValueConverter<R> // R always exten
* required<!--, with the form //Outdated concept <code>(function name) requires a (typeName) to be passed as (argName, if
* available)</code>-->
*/
public static <R extends Value> void register(Class<R> valueClass, String typeName)
public static <R extends Value> void register(final Class<R> valueClass, final String typeName)
{
ValueCaster<R> caster = new ValueCaster<R>(valueClass, typeName);
final ValueCaster<R> caster = new ValueCaster<>(valueClass, typeName);
byResult.putIfAbsent(valueClass, caster);
}
}