/** * Pop the top object off of the stack, and return it. If there are * no objects on the stack, return <code>null</code>. */ public Object pop() { try { return (stack.pop()); } catch (EmptyStackException e) { log.log(Level.WARNING, LogFacade.EMPTY_STACK_EXCEPTION); return (null); } }
/** * Process the body text of this element. * * @param bodyText The body text of this element */ public void body(String bodyText) throws Exception { if (attributeName == null && !fromStack) { // We must wait to set the parameter until end // so that we can make sure that the right set of parameters // is at the top of the stack if (bodyTextStack == null) { bodyTextStack = new ArrayStack(); } bodyTextStack.push(bodyText.trim()); } }
/** * Pushes a new item onto the top of this stack. The pushed item is also * returned. This is equivalent to calling <code>add</code>. * * @param item the item to be added * @return the item just pushed */ public E push(E item) { add(item); return item; } }
/** * Process any body texts now. */ @Override public void end(String namespace, String name) { if (bodyTextStack != null && !bodyTextStack.empty()) { // what we do now is push one parameter onto the top set of parameters Object parameters[] = (Object[]) digester.peekParams(); parameters[paramIndex] = bodyTextStack.pop(); } }
/** * Return <code>true</code> if this stack is currently empty. * <p> * This method exists for compatibility with <code>java.util.Stack</code>. * New users of this class should use <code>isEmpty</code> instead. * * @return true if the stack is currently empty */ public boolean empty() { return isEmpty(); }
/** * Return the top object on the stack without removing it. If there are * no objects on the stack, return <code>null</code>. */ public Object peek() { try { return (stack.peek()); } catch (EmptyStackException e) { log.log(Level.WARNING, LogFacade.EMPTY_STACK_EXCEPTION); return (null); } }
/** * Clear the current contents of the object stack. * <p> * Calling this method <i>might</i> allow another document of the same type * to be correctly parsed. However this method was not intended for this * purpose. In general, a separate Digester object should be created for * each document to be parsed. */ public void clear() { match = ""; bodyTexts.clear(); params.clear(); publicId = null; stack.clear(); log = null; saxLog = null; configured = false; }
/** * <p>Push a new object onto the top of the parameters stack.</p> * * <p>The parameters stack is used to store <code>CallMethodRule</code> parameters. * See {@link #params}.</p> * * @param object The new object */ public void pushParams(Object object) { if (log.isLoggable(Level.FINEST)) { log.log(Level.FINEST, "Pushing params"); } params.push(object); }
/** * Process any body texts now. */ @Override public void end(String namespace, String name) { if (bodyTextStack != null && !bodyTextStack.empty()) { // what we do now is push one parameter onto the top set of parameters Object parameters[] = (Object[]) digester.peekParams(); parameters[paramIndex] = bodyTextStack.pop(); } }
/** * Return <code>true</code> if this stack is currently empty. * <p> * This method exists for compatibility with <code>java.util.Stack</code>. * New users of this class should use <code>isEmpty</code> instead. * * @return true if the stack is currently empty */ public boolean empty() { return isEmpty(); }
/** * <p>Return the top object on the parameters stack without removing it. If there are * no objects on the stack, return <code>null</code>.</p> * * <p>The parameters stack is used to store <code>CallMethodRule</code> parameters. * See {@link #params}.</p> */ public Object peekParams() { try { return (params.peek()); } catch (EmptyStackException e) { log.log(Level.WARNING, LogFacade.EMPTY_STACK_EXCEPTION); return (null); } }
/** * Clear the current contents of the object stack. * <p> * Calling this method <i>might</i> allow another document of the same type * to be correctly parsed. However this method was not intended for this * purpose. In general, a separate Digester object should be created for * each document to be parsed. */ public void clear() { match = ""; bodyTexts.clear(); params.clear(); publicId = null; stack.clear(); log = null; saxLog = null; configured = false; }
/** * <p>Push a new object onto the top of the parameters stack.</p> * * <p>The parameters stack is used to store <code>CallMethodRule</code> parameters. * See {@link #params}.</p> * * @param object The new object */ public void pushParams(Object object) { if (log.isTraceEnabled()) { log.trace("Pushing params"); } params.push(object); }
/** * Process any body texts now. */ @Override public void end(String namespace, String name) { if (bodyTextStack != null && !bodyTextStack.empty()) { // what we do now is push one parameter onto the top set of parameters Object parameters[] = (Object[]) digester.peekParams(); parameters[paramIndex] = bodyTextStack.pop(); } }