Object obj = map.get(name); if (obj instanceof Method) { OverloadedMethods overloadedMethods = new OverloadedMethods(wrapper.is2321Bugfixed()); overloadedMethods.addMethod((Method) obj); overloadedMethods.addMethod(method); map.put(name, overloadedMethods); } else if (obj instanceof OverloadedMethods) { OverloadedMethods overloadedMethods = (OverloadedMethods) obj; overloadedMethods.addMethod(method); } else { if (obj != null) {
void addConstructor(Constructor constr) { final Class[] paramTypes = constr.getParameterTypes(); addCallableMemberDescriptor(new ReflectionCallableMemberDescriptor(constr, paramTypes)); }
private void addConstructorsToClassIntrospectionData(final Map<Object, Object> introspData, Class<?> clazz) { try { Constructor<?>[] ctors = clazz.getConstructors(); if (ctors.length == 1) { Constructor<?> ctor = ctors[0]; introspData.put(CONSTRUCTORS_KEY, new SimpleMethod(ctor, ctor.getParameterTypes())); } else if (ctors.length > 1) { OverloadedMethods overloadedCtors = new OverloadedMethods(bugfixed); for (int i = 0; i < ctors.length; i++) { overloadedCtors.addConstructor(ctors[i]); } introspData.put(CONSTRUCTORS_KEY, overloadedCtors); } } catch (SecurityException e) { LOG.warn("Can't discover constructors for class " + clazz.getName(), e); } }
private Object[] toErrorMessage(EmptyMemberAndArguments res, List/*<TemplateModel>*/ tmArgs) { final Object[] unwrappedArgs = res.getUnwrappedArguments(); return new Object[] { res.getErrorDescription(), tmArgs != null ? new Object[] { "\nThe FTL type of the argument values were: ", getTMActualParameterTypes(tmArgs), "." } : (Object) "", unwrappedArgs != null ? new Object[] { "\nThe Java type of the argument values were: ", getUnwrappedActualParameterTypes(unwrappedArgs) + "." } : (Object) ""}; }
toCompositeErrorMessage( (EmptyMemberAndArguments) fixArgsRes, (EmptyMemberAndArguments) varargsRes, tmArgs), "\nThe matching overload was searched among these members:\n", memberListToString()); if (!bugfixed) { edb.tip("You seem to use BeansWrapper with incompatibleImprovements set below 2.3.21. If you think this " + "error is unfounded, enabling 2.3.21 fixes may helps. See version history for more."); addMarkupBITipAfterNoNoMarchIfApplicable(edb, tmArgs); throw new _TemplateModelException(edb);
/** * Invokes the method, passing it the arguments from the list. The actual * method to call from several overloaded methods will be chosen based * on the classes of the arguments. * @throws TemplateModelException if the method cannot be chosen * unambiguously. */ public Object exec(List arguments) throws TemplateModelException { MemberAndArguments maa = overloadedMethods.getMemberAndArguments(arguments, wrapper); try { return maa.invokeMethod(wrapper, object); } catch (Exception e) { if (e instanceof TemplateModelException) throw (TemplateModelException) e; throw _MethodUtil.newInvocationTemplateModelException( object, maa.getCallableMemberDescriptor(), e); } }
toCompositeErrorMessage( (EmptyMemberAndArguments) fixArgsRes, (EmptyMemberAndArguments) varargsRes, tmArgs), "\nThe matching overload was searched among these members:\n", memberListToString()); if (!bugfixed) { edb.tip("You seem to use BeansWrapper with incompatibleImprovements set below 2.3.21. If you think this " + "error is unfounded, enabling 2.3.21 fixes may helps. See version history for more."); addMarkupBITipAfterNoNoMarchIfApplicable(edb, tmArgs); throw new _TemplateModelException(edb);
private Object[] toErrorMessage(EmptyMemberAndArguments res, List/*<TemplateModel>*/ tmArgs) { final Object[] unwrappedArgs = res.getUnwrappedArguments(); return new Object[] { res.getErrorDescription(), tmArgs != null ? new Object[] { "\nThe FTL type of the argument values were: ", getTMActualParameterTypes(tmArgs), "." } : (Object) "", unwrappedArgs != null ? new Object[] { "\nThe Java type of the argument values were: ", getUnwrappedActualParameterTypes(unwrappedArgs) + "." } : (Object) ""}; }
final MemberAndArguments mma = ((OverloadedMethods) ctors).getMemberAndArguments(arguments, this); try { return mma.invokeConstructor(this);
toCompositeErrorMessage( (EmptyMemberAndArguments) fixArgsRes, (EmptyMemberAndArguments) varargsRes, tmArgs), "\nThe matching overload was searched among these members:\n", memberListToString()); if (!bugfixed) { edb.tip("You seem to use BeansWrapper with incompatibleImprovements set below 2.3.21. If you think this " + "error is unfounded, enabling 2.3.21 fixes may helps. See version history for more."); addMarkupBITipAfterNoNoMarchIfApplicable(edb, tmArgs); throw new _TemplateModelException(edb);
if (previous instanceof Method) { OverloadedMethods overloadedMethods = new OverloadedMethods(bugfixed); overloadedMethods.addMethod((Method) previous); overloadedMethods.addMethod(method); introspData.put(methodKey, overloadedMethods); ((OverloadedMethods) previous).addMethod(method); } else if (decision.getMethodShadowsProperty() || !(previous instanceof FastPropertyDescriptor)) {
private Object[] toErrorMessage(EmptyMemberAndArguments res, List/*<TemplateModel>*/ tmArgs) { final Object[] unwrappedArgs = res.getUnwrappedArguments(); return new Object[] { res.getErrorDescription(), tmArgs != null ? new Object[] { "\nThe FTL type of the argument values were: ", getTMActualParameterTypes(tmArgs), "." } : (Object) "", unwrappedArgs != null ? new Object[] { "\nThe Java type of the argument values were: ", getUnwrappedActualParameterTypes(unwrappedArgs) + "." } : (Object) ""}; }
private void addConstructorsToClassIntrospectionData(final Map<Object, Object> introspData, Class<?> clazz) { try { Constructor<?>[] ctors = clazz.getConstructors(); if (ctors.length == 1) { Constructor<?> ctor = ctors[0]; introspData.put(CONSTRUCTORS_KEY, new SimpleMethod(ctor, ctor.getParameterTypes())); } else if (ctors.length > 1) { OverloadedMethods overloadedCtors = new OverloadedMethods(bugfixed); for (int i = 0; i < ctors.length; i++) { overloadedCtors.addConstructor(ctors[i]); } introspData.put(CONSTRUCTORS_KEY, overloadedCtors); } } catch (SecurityException e) { LOG.warn("Can't discover constructors for class " + clazz.getName(), e); } }
void addMethod(Method method) { final Class[] paramTypes = method.getParameterTypes(); addCallableMemberDescriptor(new ReflectionCallableMemberDescriptor(method, paramTypes)); }
/** * Invokes the method, passing it the arguments from the list. The actual * method to call from several overloaded methods will be chosen based * on the classes of the arguments. * @throws TemplateModelException if the method cannot be chosen * unambiguously. */ public Object exec(List arguments) throws TemplateModelException { MemberAndArguments maa = overloadedMethods.getMemberAndArguments(arguments, wrapper); try { return maa.invokeMethod(wrapper, object); } catch (Exception e) { if (e instanceof TemplateModelException) throw (TemplateModelException) e; throw _MethodUtil.newInvocationTemplateModelException( object, maa.getCallableMemberDescriptor(), e); } }
Object obj = map.get(name); if (obj instanceof Method) { OverloadedMethods overloadedMethods = new OverloadedMethods(wrapper.is2321Bugfixed()); overloadedMethods.addMethod((Method) obj); overloadedMethods.addMethod(method); map.put(name, overloadedMethods); } else if (obj instanceof OverloadedMethods) { OverloadedMethods overloadedMethods = (OverloadedMethods) obj; overloadedMethods.addMethod(method); } else { if (obj != null) {
private void addConstructorsToClassIntrospectionData(final Map<Object, Object> introspData, Class<?> clazz) { try { Constructor<?>[] ctors = clazz.getConstructors(); if (ctors.length == 1) { Constructor<?> ctor = ctors[0]; introspData.put(CONSTRUCTORS_KEY, new SimpleMethod(ctor, ctor.getParameterTypes())); } else if (ctors.length > 1) { OverloadedMethods overloadedCtors = new OverloadedMethods(bugfixed); for (int i = 0; i < ctors.length; i++) { overloadedCtors.addConstructor(ctors[i]); } introspData.put(CONSTRUCTORS_KEY, overloadedCtors); } } catch (SecurityException e) { LOG.warn("Can't discover constructors for class " + clazz.getName(), e); } }
void addMethod(Method method) { final Class[] paramTypes = method.getParameterTypes(); addCallableMemberDescriptor(new ReflectionCallableMemberDescriptor(method, paramTypes)); }
/** * Invokes the method, passing it the arguments from the list. The actual * method to call from several overloaded methods will be chosen based * on the classes of the arguments. * @throws TemplateModelException if the method cannot be chosen * unambiguously. */ public Object exec(List arguments) throws TemplateModelException { MemberAndArguments maa = overloadedMethods.getMemberAndArguments(arguments, wrapper); try { return maa.invokeMethod(wrapper, object); } catch (Exception e) { if (e instanceof TemplateModelException) throw (TemplateModelException) e; throw _MethodUtil.newInvocationTemplateModelException( object, maa.getCallableMemberDescriptor(), e); } }
Object obj = map.get(name); if (obj instanceof Method) { OverloadedMethods overloadedMethods = new OverloadedMethods(wrapper.is2321Bugfixed()); overloadedMethods.addMethod((Method) obj); overloadedMethods.addMethod(method); map.put(name, overloadedMethods); } else if (obj instanceof OverloadedMethods) { OverloadedMethods overloadedMethods = (OverloadedMethods) obj; overloadedMethods.addMethod(method); } else { if (obj != null) {