Package com.opensymphony.xwork2.util

Examples of com.opensymphony.xwork2.util.ValueStack.push()


            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;
View Full Code Here


        }
    }

    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));
View Full Code Here

import java.util.Map;

public class XWorkMapPropertyAccessorTest extends XWorkTestCase {
    public void testCreateNullObjectsIsFalseByDefault() {
        ValueStack vs = ActionContext.getContext().getValueStack();
        vs.push(new MapHolder(Collections.emptyMap()));
        assertNull(vs.findValue("map[key]"));
    }

    public void testMapContentsAreReturned() {
        ValueStack vs = ActionContext.getContext().getValueStack();
View Full Code Here

        assertNull(vs.findValue("map[key]"));
    }

    public void testMapContentsAreReturned() {
        ValueStack vs = ActionContext.getContext().getValueStack();
        vs.push(new MapHolder(Collections.singletonMap("key", "value")));
        assertEquals("value", vs.findValue("map['key']"));
    }

    public void testNullIsNotReturnedWhenCreateNullObjectsIsSpecified() {
        ValueStack vs = ActionContext.getContext().getValueStack();
View Full Code Here

        assertEquals("value", vs.findValue("map['key']"));
    }

    public void testNullIsNotReturnedWhenCreateNullObjectsIsSpecified() {
        ValueStack vs = ActionContext.getContext().getValueStack();
        vs.push(new MapHolder(Collections.emptyMap()));
        ReflectionContextState.setCreatingNullObjects(vs.getContext(), true);

        Object value = vs.findValue("map['key']");
        assertNotNull(value);
        assertSame(Object.class, value.getClass());
View Full Code Here

        assertSame(Object.class, value.getClass());
    }

    public void testNullIsReturnedWhenCreateNullObjectsIsSpecifiedAsFalse() {
        ValueStack vs = ActionContext.getContext().getValueStack();
        vs.push(new MapHolder(Collections.emptyMap()));
        ReflectionContextState.setCreatingNullObjects(vs.getContext(), false);
        assertNull(vs.findValue("map['key']"));
    }

    private static class MapHolder {
View Full Code Here

            vs.getContext().putAll(Dispatcher.getInstance().createContextMap(request, response, null, servletContext));
            ctx = new ActionContext(vs.getContext());
            if (ctx.getActionInvocation() == null) {
                // put in a dummy ActionSupport so basic functionality still works
                ActionSupport action = new ActionSupport();
                vs.push(action);
                ctx.setActionInvocation(new DummyActionInvocation(action));
            }
        }

        // delegate to the actual page decorator
View Full Code Here

        ValueStack stack = this.context.getStack();
        if (listObj != null) {
            Iterator itt = MakeIterator.convert(listObj);
            while (itt.hasNext()) {
                Object item = itt.next();
                stack.push(item);

                //key
                Object itemKey = findValue(listKey != null ? listKey : "top");
                String itemKeyStr = StringUtils.defaultString(itemKey == null ? null : itemKey.toString());
                //value
View Full Code Here

            Iterator itt = MakeIterator.convert(listObj);
            String listKey = (String) params.get("listKey");
            String listValue = (String) params.get("listValue");
            while (itt.hasNext()) {
                Object optGroupBean = itt.next();
                stack.push(optGroupBean);

                Object tmpKey = stack.findValue(listKey != null ? listKey : "top");
                String tmpKeyStr = StringUtils.defaultString(tmpKey.toString());
                Object tmpValue = stack.findValue(listValue != null ? listValue : "top");
                String tmpValueStr = StringUtils.defaultString(tmpValue.toString());
View Full Code Here

            if ((iterator != null) && iterator.hasNext())
            {
                Object currentValue = iterator.next();
                if (currentValue!=null)
                {
                    stack.push(currentValue);
            /*
             * UPGRADE-struts 2.1.6
             * CHANGE: changed "getId()" to "getVar()"
             * Reason: The Funktion no longer exists.
             */
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.