@Override public String toString() { return InternalUtils.asString(contributorMethod, proxyFactory); }
@Override public String toString() { return InternalUtils.asString(contributorMethod, proxyFactory); }
private String toString(Method method) { return InternalUtils.asString(method, proxyFactory); }
@Override public String toString() { return InternalUtils.asString(method, proxyFactory); }
@Override public String toString() { return InternalUtils.asString(method, proxyFactory); }
private String toString(Method method) { return InternalUtils.asString(method, proxyFactory); }
static String noContributionParameter(Method method) { return MESSAGES.format("no-contribution-parameter", asString(method)); }
static String decoratorReturnedWrongType(Method method, String serviceId, Object returned, Class serviceInterface) { return MESSAGES.format("decorator-returned-wrong-type", asString(method), serviceId, returned, serviceInterface.getName()); }
static String tooManyContributionParameters(Method method) { return MESSAGES.format("too-many-contribution-parameters", asString(method)); }
static String decoratorReturnedWrongType(Method method, String serviceId, Object returned, Class serviceInterface) { return MESSAGES.format("decorator-returned-wrong-type", asString(method), serviceId, returned, serviceInterface.getName()); }
static String contributionMethodError(Method method, Throwable cause) { return MESSAGES.format("contribution-method-error", asString(method), cause); }
static String tooManyContributionParameters(Method method) { return MESSAGES.format("too-many-contribution-parameters", asString(method)); }
static String noContributionParameter(Method method) { return MESSAGES.format("no-contribution-parameter", asString(method)); }
static String contributionMethodError(Method method, Throwable cause) { return MESSAGES.format("contribution-method-error", asString(method), cause); }
/** * Converts a method to a user presentable string using a {@link PlasticProxyFactory} to obtain a {@link Location} * (where possible). {@link #asString(Method)} is used under the covers, to present a detailed, but not excessive, * description of the class, method and parameters. * * @param method * method to convert to a string * @param proxyFactory * used to obtain the {@link Location} * @return the method formatted for presentation to the user */ public static String asString(Method method, PlasticProxyFactory proxyFactory) { Location location = proxyFactory.getMethodLocation(method); return location != null ? location.toString() : asString(method); }
/** * Converts a method to a user presentable string using a {@link PlasticProxyFactory} to obtain a {@link Location} * (where possible). {@link #asString(Method)} is used under the covers, to present a detailed, but not excessive, * description of the class, method and parameters. * * @param method * method to convert to a string * @param proxyFactory * used to obtain the {@link Location} * @return the method formatted for presentation to the user */ public static String asString(Method method, PlasticProxyFactory proxyFactory) { Location location = proxyFactory.getMethodLocation(method); return location != null ? location.toString() : asString(method); }
static String contributionWrongReturnType(Method method) { return MESSAGES.format("contribution-wrong-return-type", asString(method), PlasticUtils.toTypeName(method.getReturnType())); }
static String contributionWrongReturnType(Method method) { return MESSAGES.format("contribution-wrong-return-type", asString(method), PlasticUtils.toTypeName(method.getReturnType())); }
private void addDecoratorDef(Method method) { Decorate annotation = method.getAnnotation(Decorate.class); Class serviceInterface = annotation == null ? null : annotation.serviceInterface(); // TODO: methods just named "decorate" String decoratorId = annotation == null ? stripMethodPrefix(method, DECORATE_METHOD_NAME_PREFIX) : extractId( serviceInterface, annotation.id()); // TODO: Check for duplicates Class returnType = method.getReturnType(); if (returnType.isPrimitive() || returnType.isArray()) { throw new RuntimeException(String.format( "Method %s is named like a service decorator method, but the return type (%s) is not acceptable (try Object).", InternalUtils.asString(method), method.getReturnType().getCanonicalName())); } Set<Class> markers = extractMarkers(method, Decorate.class); DecoratorDef def = new DecoratorDefImpl(method, extractPatterns(decoratorId, method), extractConstraints(method), proxyFactory, decoratorId, serviceInterface, markers); decoratorDefs.put(decoratorId, def); }
private void addDecoratorDef(Method method) { Decorate annotation = method.getAnnotation(Decorate.class); Class serviceInterface = annotation == null ? null : annotation.serviceInterface(); // TODO: methods just named "decorate" String decoratorId = annotation == null ? stripMethodPrefix(method, DECORATE_METHOD_NAME_PREFIX) : extractId( serviceInterface, annotation.id()); // TODO: Check for duplicates Class returnType = method.getReturnType(); if (returnType.isPrimitive() || returnType.isArray()) { throw new RuntimeException(String.format( "Method %s is named like a service decorator method, but the return type (%s) is not acceptable (try Object).", InternalUtils.asString(method), method.getReturnType().getCanonicalName())); } Set<Class> markers = extractMarkers(method, Decorate.class); DecoratorDef def = new DecoratorDefImpl(method, extractPatterns(decoratorId, method), extractConstraints(method), proxyFactory, decoratorId, serviceInterface, markers); decoratorDefs.put(decoratorId, def); }