Add some toString() implementations
This commit is contained in:
@@ -78,4 +78,9 @@ public class CompletionProposal {
|
||||
public void category(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,4 +74,9 @@ public class MethodTarget {
|
||||
result = 31 * result + help.hashCode();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return method.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
package org.springframework.shell2.standard;
|
||||
|
||||
import static org.springframework.util.StringUtils.collectionToCommaDelimitedString;
|
||||
import static org.springframework.util.StringUtils.collectionToDelimitedString;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -24,7 +27,9 @@ import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.shell2.MethodTarget;
|
||||
import org.springframework.shell2.MethodTargetResolver;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* The standard implementation of {@link MethodTargetResolver} for new shell applications,
|
||||
@@ -59,4 +64,10 @@ public class StandardMethodTargetResolver implements MethodTargetResolver {
|
||||
}
|
||||
return methodTargets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName() + " contributing "
|
||||
+ collectionToDelimitedString(resolve().keySet(), ", ", "[", "]");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -429,6 +429,11 @@ public class StandardParameterResolver implements ParameterResolver {
|
||||
public int hashCode() {
|
||||
return Objects.hash(method, words);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return method.getName() + " " + words;
|
||||
}
|
||||
}
|
||||
|
||||
private static class ParameterRawValue {
|
||||
@@ -473,6 +478,15 @@ public class StandardParameterResolver implements ParameterResolver {
|
||||
public boolean positional() {
|
||||
return key == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ParameterRawValue{" +
|
||||
"value='" + value + '\'' +
|
||||
", explicit=" + explicit +
|
||||
", key='" + key + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,10 @@ import org.springframework.core.MethodParameter;
|
||||
import org.springframework.shell2.CompletionContext;
|
||||
|
||||
/**
|
||||
* Base class for {@link ValueProvider} that match by type. Subclasses {@literal C} will be selected for parameters
|
||||
* whose {@literal @}{@link ShellOption#valueProvider()} return the concrete class {@literal C}.
|
||||
*
|
||||
* @author Eric Bottard
|
||||
*/
|
||||
public abstract class ValueProviderSupport implements ValueProvider {
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.shell2.legacy;
|
||||
|
||||
import static org.springframework.util.StringUtils.collectionToDelimitedString;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -57,4 +59,11 @@ public class LegacyMethodTargetResolver implements MethodTargetResolver {
|
||||
}
|
||||
return methodTargets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName() + " contributing "
|
||||
+ collectionToDelimitedString(resolve().keySet(), ", ", "[", "]");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user