static public List convertToList(Object obj) { if ( obj instanceof List ) { return (List) obj; } return new SingletonList(obj); } }
public Object evaluate(Context context) throws JaxenException { ContextSupport support = context.getContextSupport(); Navigator nav = support.getNavigator(); Context absContext = new Context( support ); List contextNodes = context.getNodeSet(); if ( contextNodes.isEmpty() ) { return Collections.EMPTY_LIST; } Object firstNode = contextNodes.get( 0 ); Object docNode = nav.getDocumentNode( firstNode ); if ( docNode == null ) { return Collections.EMPTY_LIST; } List list = new SingletonList(docNode); absContext.setNodeSet( list ); return super.evaluate( absContext ); }
/** Create a {@link Context} wrapper for the provided * implementation-specific object. * * @param node the implementation-specific object * to be used as the context * * @return a <code>Context</code> wrapper around the object */ protected Context getContext(Object node) { if ( node instanceof Context ) { return (Context) node; } Context fullContext = new Context( getContextSupport() ); if ( node instanceof List ) { fullContext.setNodeSet( (List) node ); } else { List list = new SingletonList(node); fullContext.setNodeSet( list ); } return fullContext; }
List list = new SingletonList(node);
baseContextSupport.getNavigator()); Context context = new Context(contextSupport); context.setNodeSet(new SingletonList(synCtx.getEnvelope())); return context; } else if (obj instanceof SOAPEnvelope) { baseContextSupport.getNavigator()); Context context = new Context(contextSupport); context.setNodeSet(new SingletonList(env)); return context; } else if (obj instanceof ContextWrapper) { baseContextSupport.getNavigator()); Context context = new Context(contextSupport); context.setNodeSet(new SingletonList(wrapper.getEnvelope())); return context; } else {
baseContextSupport.getNavigator()); Context context = new Context(contextSupport); context.setNodeSet(new SingletonList(synCtx.getEnvelope())); return context; } else if (obj instanceof SOAPEnvelope) { baseContextSupport.getNavigator()); Context context = new Context(contextSupport); context.setNodeSet(new SingletonList(env)); return context; } else if (obj instanceof ContextWrapper) { baseContextSupport.getNavigator()); Context context = new Context(contextSupport); context.setNodeSet(new SingletonList(wrapper.getEnvelope())); return context; } else {