/** * Wraps a Java method so that it can be called from templates, without wrapping its parent ("this") object. The * result is almost the same as that you would get by wrapping the parent object then getting the method from the * resulting {@link TemplateHashModel} by name. Except, if the wrapped method is overloaded, with this method you * explicitly select an overload, while otherwise you would get a {@link TemplateMethodModelEx} that selects an * overload each time it's called based on the argument values. * * @param object The object whose method will be called, or {@code null} if {@code method} is a static method. * This object will be used "as is", like without unwrapping it if it's a {@link TemplateModelAdapter}. * @param method The method to call, which must be an (inherited) member of the class of {@code object}, as * described by {@link Method#invoke(Object, Object...)} * * @since 2.3.22 */ public TemplateMethodModelEx wrap(Object object, Method method) { return new SimpleMethodModel(object, method, method.getParameterTypes(), this); }
if (value instanceof Method) { Method method = (Method) value; entry.setValue(new SimpleMethodModel(null, method, method.getParameterTypes(), wrapper)); } else if (value instanceof OverloadedMethods) {
new SimpleMethodModel(object, indexedReadMethod, ClassIntrospector.getArgTypes(classInfo, indexedReadMethod), wrapper); resultModel = cachedModel = new SimpleMethodModel( object, method, ClassIntrospector.getArgTypes(classInfo, method), wrapper); } else if (desc instanceof OverloadedMethods) {
/** * Wraps a Java method so that it can be called from templates, without wrapping its parent ("this") object. The * result is almost the same as that you would get by wrapping the parent object then getting the method from the * resulting {@link TemplateHashModel} by name. Except, if the wrapped method is overloaded, with this method you * explicitly select an overload, while otherwise you would get a {@link TemplateMethodModelEx} that selects an * overload each time it's called based on the argument values. * * @param object The object whose method will be called, or {@code null} if {@code method} is a static method. * This object will be used "as is", like without unwrapping it if it's a {@link TemplateModelAdapter}. * @param method The method to call, which must be an (inherited) member of the class of {@code object}, as * described by {@link Method#invoke(Object, Object...)} * * @since 2.3.22 */ public TemplateMethodModelEx wrap(Object object, Method method) { return new SimpleMethodModel(object, method, method.getParameterTypes(), this); }
/** * Wraps a Java method so that it can be called from templates, without wrapping its parent ("this") object. The * result is almost the same as that you would get by wrapping the parent object then getting the method from the * resulting {@link TemplateHashModel} by name. Except, if the wrapped method is overloaded, with this method you * explicitly select an overload, while otherwise you would get a {@link TemplateMethodModelEx} that selects an * overload each time it's called based on the argument values. * * @param object The object whose method will be called, or {@code null} if {@code method} is a static method. * This object will be used "as is", like without unwrapping it if it's a {@link TemplateModelAdapter}. * @param method The method to call, which must be an (inherited) member of the class of {@code object}, as * described by {@link Method#invoke(Object, Object...)} * * @since 2.3.22 */ public TemplateMethodModelEx wrap(Object object, Method method) { return new SimpleMethodModel(object, method, method.getParameterTypes(), this); }
((IndexedPropertyDescriptor)desc).getIndexedReadMethod(); retval = member = new SimpleMethodModel(object, readMethod, BeansWrapper.getArgTypes(classInfo, readMethod), wrapper); retval = member = new SimpleMethodModel(object, method, BeansWrapper.getArgTypes(classInfo, method), wrapper);
if (value instanceof Method) { Method method = (Method) value; entry.setValue(new SimpleMethodModel(null, method, method.getParameterTypes(), wrapper)); } else if (value instanceof OverloadedMethods) {
entry.setValue(new SimpleMethodModel(null, method, method.getParameterTypes(), wrapper));
if (value instanceof Method) { Method method = (Method) value; entry.setValue(new SimpleMethodModel(null, method, method.getParameterTypes(), wrapper)); } else if (value instanceof OverloadedMethods) {
new SimpleMethodModel(object, indexedReadMethod, ClassIntrospector.getArgTypes(classInfo, indexedReadMethod), wrapper); resultModel = cachedModel = new SimpleMethodModel( object, method, ClassIntrospector.getArgTypes(classInfo, method), wrapper); } else if (desc instanceof OverloadedMethods) {
new SimpleMethodModel(object, indexedReadMethod, ClassIntrospector.getArgTypes(classInfo, indexedReadMethod), wrapper); resultModel = cachedModel = new SimpleMethodModel( object, method, ClassIntrospector.getArgTypes(classInfo, method), wrapper); } else if (desc instanceof OverloadedMethods) {