Skip to content

Commit

Permalink
fix minor comments for the code clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
Mmuzaf committed May 26, 2023
1 parent 9c8a175 commit 1776611
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/java/org/apache/cassandra/config/ValidatedPropertyLoader.java
Expand Up @@ -74,14 +74,11 @@ private static Property listenablePropertyFactory(Field field)
private static <S, T> ListenableProperty.BeforeChangeListener<S, T> createValidationListener(Field field, ValidatedBy annotation)
{
Class<?> clazz = FBUtilities.classForName(annotation.useClass(), "validate method");
List<Method> matches = new ArrayList<>();
for (Method method : clazz.getDeclaredMethods())
{
if (method.getName().equals(annotation.useClassMethod()) &&
Modifier.isStatic(method.getModifiers()) &&
Modifier.isPublic(method.getModifiers()))
matches.add(method);
}
List<Method> matches = Arrays.stream(clazz.getDeclaredMethods())
.filter(m -> m.getName().equals(annotation.useClassMethod()) &&
Modifier.isStatic(m.getModifiers()) &&
Modifier.isPublic(m.getModifiers()))
.collect(Collectors.toList());

if (matches.isEmpty())
throw new ConfigurationException(String.format("Required public static method '%s' not found in class '%s'",
Expand Down Expand Up @@ -120,9 +117,10 @@ private static <S, T> ListenableProperty.BeforeChangeListener<S, T> createValida
(s, n, o, v) -> sneakyThrow(() -> method.invoke(null, s, n, v)));
default:
throw new ConfigurationException(String.format("Required method '%s' in class '%s' must have one, two, " +
"or three input parameters",
"or three input parameters, but it has '%s' instead.",
annotation.useClassMethod(),
clazz.getCanonicalName()), false);
clazz.getCanonicalName(),
method.getParameterCount()), false);
}
}

Expand Down
Expand Up @@ -24,6 +24,7 @@
public class WithReplacementLoader implements Loader
{
private final Loader delegate;

public WithReplacementLoader(Loader delegate)
{
this.delegate = delegate;
Expand Down

0 comments on commit 1776611

Please sign in to comment.