protected Object getValue(Object obj, String property) { stack.push(obj); try { Object value = stack.findValue(property); if (value instanceof Number) { return MessageFormat.format(NumberFormat, value); } return value; } finally { stack.pop(); } }
@Override public int doEndTag() throws JspException { this.getStack().pop(); this.setSubsetIteratorFilter(null); return EVAL_PAGE; }
@Override public int doEndTag() throws JspException { this.getStack().pop(); this.setSubsetIteratorFilter(null); return EVAL_PAGE; }
/** * Is there any more data * * @return <code>true</code> if there are more elements to iterate over and * <code>false</code> otherwise * @throws JRException if there is a problem determining whether there * is more data */ public boolean next() throws JRException { if (firstTimeThrough) { firstTimeThrough = false; } else { valueStack.pop(); } if ((iterator != null) && (iterator.hasNext())) { valueStack.push(iterator.next()); if (LOG.isDebugEnabled()) { LOG.debug("Pushed next value: {}", valueStack.findValue(".")); } return true; } else { LOG.debug("No more values"); return false; } } }
@Override public int doEndTag() throws JspException { this.getStack().pop(); this.setSubsetIteratorFilter(null); return EVAL_PAGE; }
@Override public boolean end(Writer writer, String body) { ValueStack stack = getStack(); if (_iterator != null) { Object value = stack.pop(); if (_lastKey == null || !_lastKey.equals(body)) { _currentGroup = new ArrayList<Object>(); _groups.add(_currentGroup); } _currentGroup.add(value); _lastKey = body; } if (_iterator != null && _iterator.hasNext()) { Object currentValue = _iterator.next(); stack.push(currentValue); return true; } else { putInContext(_groups); return super.end(writer, ""); } } }
@Override public boolean end(Writer writer, String body) { ValueStack stack = getStack(); if (_iterator != null) { Object value = stack.pop(); if (_lastKey == null || !_lastKey.equals(body)) { _currentGroup = new ArrayList<Object>(); _groups.add(_currentGroup); } _currentGroup.add(value); _lastKey = body; } if (_iterator != null && _iterator.hasNext()) { Object currentValue = _iterator.next(); stack.push(currentValue); return true; } else { putInContext(_groups); return super.end(writer, ""); } } }
@Override public String getMessage(Object object) { boolean pop = false; if (useSensitiveContext && !stack.getRoot().contains(c)) { stack.push(c); pop = true; } String message = super.getMessage(object); if (pop) { stack.pop(); } return message; }
@Override public String getMessage(Object object) { boolean pop = false; if (useSensitiveContext && !stack.getRoot().contains(c)) { stack.push(c); pop = true; } String message = super.getMessage(object); if (pop) { stack.pop(); } return message; }
writeOption(tmpKeyStr, tmpValueStr, selected); stack.pop();
/** * Return the field value named <code>name</code> from <code>object</code>, * <code>object</code> should have the appropriate getter/setter. * * @param name name of the field * @param object to search field name on * @return Object as field value * @throws ValidationException */ protected Object getFieldValue(String name, Object object) throws ValidationException { boolean pop = false; if (!stack.getRoot().contains(object)) { stack.push(object); pop = true; } Object retVal = stack.findValue(name); if (pop) { stack.pop(); } return retVal; }
super.end("label"); stack.pop(); cnt++;
public void validate(Object object) throws ValidationException { String fieldName = getFieldName(); Object value = this.getFieldValue(fieldName, object); if (value == null) { log.warn("The visited object is null, VisitorValidator will not be able to handle validation properly. Please make sure the visited object is not null for VisitorValidator to function properly"); return; } ValueStack stack = ActionContext.getContext().getValueStack(); stack.push(object); String visitorContext = (context == null) ? ActionContext.getContext().getName() : context; if (value instanceof Collection) { Collection coll = (Collection) value; Object[] array = coll.toArray(); validateArrayElements(array, fieldName, visitorContext); } else if (value instanceof Object[]) { Object[] array = (Object[]) value; validateArrayElements(array, fieldName, visitorContext); } else { validateObject(fieldName, value, visitorContext); } stack.pop(); }
private void validateObject(String fieldName, Object o, String visitorContext) throws ValidationException { ValueStack stack = ActionContext.getContext().getValueStack(); stack.push(o); ValidatorContext validatorContext; if (appendPrefix) { validatorContext = new AppendingValidatorContext(getValidatorContext(), o, fieldName, getMessage(o)); } else { ValidatorContext parent = getValidatorContext(); validatorContext = new DelegatingValidatorContext(parent, DelegatingValidatorContext.makeTextProvider(o, parent), parent); } actionValidatorManager.validate(o, visitorContext, validatorContext); stack.pop(); }
@Override public void validateWhenNotSkip(Object object) throws ValidationException { booleans = initParams(Boolean.class, booleanParams, EXTRA_BOOLEAN_PARAM_ENTRY_PATTERN); shorts = initParams(Short.class, shortParams, EXTRA_SHORT_PARAM_ENTRY_PATTERN); ints = initParams(Integer.class, intParams, EXTRA_INT_PARAM_ENTRY_PATTERN); longs = initParams(Long.class, longParams, EXTRA_LONG_PARAM_ENTRY_PATTERN); doubles = initParams(Double.class, doubleParams, EXTRA_DOUBLE_PARAM_ENTRY_PATTERN); strings = initParams(String.class, stringParams, EXTRA_STRING_PARAM_ENTRY_PATTERN); boolean pop = false; if (!stack.getRoot().contains(this)) { stack.push(this); pop = true; } try { super.validateWhenNotSkip(object); } finally { if (pop) { stack.pop(); } } }
@Override public void validate(Object object) throws ValidationException { booleans = initParams(Boolean.class, booleanParams, EXTRA_BOOLEAN_PARAM_ENTRY_PATTERN); shorts = initParams(Short.class, shortParams, EXTRA_SHORT_PARAM_ENTRY_PATTERN); ints = initParams(Integer.class, intParams, EXTRA_INT_PARAM_ENTRY_PATTERN); longs = initParams(Long.class, longParams, EXTRA_LONG_PARAM_ENTRY_PATTERN); doubles = initParams(Double.class, doubleParams, EXTRA_DOUBLE_PARAM_ENTRY_PATTERN); strings = initParams(String.class, stringParams, EXTRA_STRING_PARAM_ENTRY_PATTERN); boolean pop = false; if (!stack.getRoot().contains(this)) { stack.push(this); pop = true; } try { super.validate(object); } finally { if (pop) { stack.pop(); } } }