Skip to content

Commit

Permalink
Spelling fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rgallardo-netflix committed Oct 20, 2023
1 parent 7f91f14 commit 44d2b98
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@
*/
public class ArchaiusType implements ParameterizedType {

/** Return a ParametrizedType to represent a {@code List<listValuesType>} */
/** Return a parameterizedType to represent a {@code List<listValuesType>} */
public static ParameterizedType forListOf(Class<?> listValuesType) {
Class<?> maybeWrappedType = PRIMITIVE_WRAPPERS.getOrDefault(listValuesType, listValuesType);
return new ArchaiusType(List.class, new Class<?>[] { maybeWrappedType });
}

/** Return a ParametrizedType to represent a {@code Set<setValuesType>} */
/** Return a parameterizedType to represent a {@code Set<setValuesType>} */
public static ParameterizedType forSetOf(Class<?> setValuesType) {
Class<?> maybeWrappedType = PRIMITIVE_WRAPPERS.getOrDefault(setValuesType, setValuesType);
return new ArchaiusType(Set.class, new Class<?>[] { maybeWrappedType });
}

/** Return a ParametrizedType to represent a {@code Map<mapKeysType, mapValuesType>} */
/** Return a parameterizedType to represent a {@code Map<mapKeysType, mapValuesType>} */
public static ParameterizedType forMapOf(Class<?> mapKeysTpe, Class<?> mapValuesType) {
Class<?> maybeWrappedKeyType = PRIMITIVE_WRAPPERS.getOrDefault(mapKeysTpe, mapKeysTpe);
Class<?> maybeWrappedValuesType = PRIMITIVE_WRAPPERS.getOrDefault(mapValuesType, mapValuesType);
Expand Down Expand Up @@ -68,7 +68,7 @@ private ArchaiusType(Class<?> rawType, Class<?>[] typeArguments) {
if (rawType.isArray()
|| rawType.isPrimitive()
|| rawType.getTypeParameters().length != typeArguments.length) {
throw new IllegalArgumentException("The provided rawType and arguments don't look like a supported parametrized type");
throw new IllegalArgumentException("The provided rawType and arguments don't look like a supported parameterized type");
}
}

Expand All @@ -90,6 +90,6 @@ public Type getOwnerType() {
@Override
public String toString() {
String typeArgumentNames = Arrays.stream(typeArguments).map(Class::getSimpleName).collect(Collectors.joining(","));
return String.format("ParametrizedType for %s<%s>", rawType.getSimpleName(), typeArgumentNames);
return String.format("parameterizedType for %s<%s>", rawType.getSimpleName(), typeArgumentNames);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ <T> T newProxy(final Class<T> type, final String initialPrefix, boolean immutabl

if (immutable) {
// Cache the current value of the property and always return that.
// Note that this will fail for parametrized properties!
// Note that this will fail for parameterized properties!
Object value = methodInvokerHolder.invoker.invoke(new Object[]{});
invokers.put(method, (args) -> value);
} else {
Expand Down Expand Up @@ -246,7 +246,7 @@ private <T> MethodInvokerHolder buildInvokerForMethod(Class<T> type, String pref
propertyValueGetter = createInterfaceProperty(propName, newProxy(returnType, propName, immutable));

} else if (m.getParameterCount() > 0) {
// A parametrized property. Note that this requires a @PropertyName annotation to extract the interpolation positions!
// A parameterized property. Note that this requires a @PropertyName annotation to extract the interpolation positions!
if (nameAnnot == null) {
throw new IllegalArgumentException("Missing @PropertyName annotation on " + m.getDeclaringClass().getName() + "#" + m.getName());
}
Expand Down Expand Up @@ -354,7 +354,7 @@ private static <T> Function<Object[], T> createDefaultMethodSupplier(Method meth
return (T) methodHandle.invokeWithArguments(args);
} else {
// This is a handle to a method WITH arguments, being called with none. This happens when toString()
// is trying to build a representation of a proxy that has a parametrized property AND the interface
// is trying to build a representation of a proxy that has a parameterized property AND the interface
// provides a default method for it. There's no good default to return here, so we'll just use null
return null;
}
Expand Down Expand Up @@ -385,7 +385,7 @@ protected <T> PropertyValueGetter<T> createScalarProperty(final Type type, final
}

/**
* A value getter for a parametrized property. Takes the arguments passed to the method call and interpolates them
* A value getter for a parameterized property. Takes the arguments passed to the method call and interpolates them
* into the property name from the method's @PropertyName annotation, then returns the value set in config for the
* computed property name. If not set, it forwards the call with the same parameters to the defaultValueSupplier.
*/
Expand All @@ -394,7 +394,7 @@ protected <T> PropertyValueGetter<T> createParameterizedProperty(final Class<T>

return args -> {
if (args == null) {
// Why would args be null if this is a parametrized property? Because toString() abuses its
// Why would args be null if this is a parameterized property? Because toString() abuses its
// access to this internal representation :-/
// We'll fall back to trying to call the provider for the default value. That works properly if
// it comes from an annotation or the known collections. Our wrapper for default interface methods
Expand Down Expand Up @@ -465,7 +465,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws NoSuchMe

/**
* Create a reasonable string representation of the proxy object: "InterfaceName[propName=currentValue, ...]".
* For the case of parametrized properties, fudges it and just uses "null" as the value.
* For the case of parameterized properties, fudges it and just uses "null" as the value.
*/
private String proxyToString() {
String propertyNamesAndValues = invokers.entrySet().stream()
Expand All @@ -480,7 +480,7 @@ private String toNameAndValue(Map.Entry<Method, PropertyValueGetter<?>> entry) {
String propertyName = propertyNames.get(entry.getKey()).substring(prefix.length());
Object propertyValue;
try {
// This call should fail for parametrized properties, because the PropertyValueGetter has a non-empty
// This call should fail for parameterized properties, because the PropertyValueGetter has a non-empty
// argument list. Fortunately, the implementation there cooperates with us and returns a null instead :-)
propertyValue = entry.getValue().invoke(null);
} catch (Exception e) {
Expand Down

0 comments on commit 44d2b98

Please sign in to comment.