/** * Called for an object that isn't considered to be of a "basic" Java type, like for an application specific type, * or for a W3C DOM node. In its default implementation, W3C {@link Node}-s will be wrapped as {@link NodeModel}-s * (allows DOM tree traversal), Jython objects will be delegated to the {@code JythonWrapper}, others will be * wrapped using {@link BeansWrapper#wrap(Object)}. * * <p> * When you override this method, you should first decide if you want to wrap the object in a custom way (and if so * then do it and return with the result), and if not, then you should call the super method (assuming the default * behavior is fine with you). */ protected TemplateModel handleUnknownType(Object obj) throws TemplateModelException { if (obj instanceof Node) { return wrapDomNode(obj); } if (JYTHON_WRAPPER != null && JYTHON_OBJ_CLASS.isInstance(obj)) { return JYTHON_WRAPPER.wrap(obj); } return super.wrap(obj); }
/** * Called if an unknown type is passed in. * Since 2.3, this falls back on XML wrapper and BeansWrapper functionality. */ protected TemplateModel handleUnknownType(Object obj) throws TemplateModelException { if ((W3C_DOM_NODE_CLASS != null && W3C_DOM_NODE_CLASS.isInstance(obj))) { return wrapDomNode(obj); } if (JYTHON_WRAPPER != null && JYTHON_OBJ_CLASS.isInstance(obj)) { return JYTHON_WRAPPER.wrap(obj); } return super.wrap(obj); }
/** * Called for an object that isn't considered to be of a "basic" Java type, like for an application specific type, * or for a W3C DOM node. In its default implementation, W3C {@link Node}-s will be wrapped as {@link NodeModel}-s * (allows DOM tree traversal), Jython objects will be delegated to the {@code JythonWrapper}, others will be * wrapped using {@link BeansWrapper#wrap(Object)}. * * <p> * When you override this method, you should first decide if you want to wrap the object in a custom way (and if so * then do it and return with the result), and if not, then you should call the super method (assuming the default * behavior is fine with you). */ protected TemplateModel handleUnknownType(Object obj) throws TemplateModelException { if (obj instanceof Node) { return wrapDomNode(obj); } if (JYTHON_WRAPPER != null && JYTHON_OBJ_CLASS.isInstance(obj)) { return JYTHON_WRAPPER.wrap(obj); } return super.wrap(obj); }
/** * Called for an object that isn't considered to be of a "basic" Java type, like for an application specific type, * or for a W3C DOM node. In its default implementation, W3C {@link Node}-s will be wrapped as {@link NodeModel}-s * (allows DOM tree traversal), Jython objects will be delegated to the {@code JythonWrapper}, others will be * wrapped using {@link BeansWrapper#wrap(Object)}. * * <p> * When you override this method, you should first decide if you want to wrap the object in a custom way (and if so * then do it and return with the result), and if not, then you should call the super method (assuming the default * behavior is fine with you). */ protected TemplateModel handleUnknownType(Object obj) throws TemplateModelException { if (obj instanceof Node) { return wrapDomNode(obj); } if (JYTHON_WRAPPER != null && JYTHON_OBJ_CLASS.isInstance(obj)) { return JYTHON_WRAPPER.wrap(obj); } return super.wrap(obj); }