Package org.apache.tapestry5

Examples of org.apache.tapestry5.PrimaryKeyEncoder.toValue()


        expect(pke.getKeyType()).andReturn(Long.class);

        expect(pke.toKey(value)).andReturn(primaryKey);

        expect(pke.toValue(primaryKey)).andReturn(value);

        replay();

        ValueEncoder ve = coercion.coerce(pke);
View Full Code Here


                    Class parameterType = classCache.forName(parameterTypeName);

                    ValueEncoder valueEncoder = valueEncoderSource.getValueEncoder(parameterType);

                    Object value = valueEncoder.toValue(parameterValue);

                    if (parameterType.isPrimitive() && value == null)
                        throw new RuntimeException(
                                String.format(
                                        "Query parameter '%s' evaluates to null, but the event method parameter is type %s, a primitive.",
View Full Code Here

                    throw new RuntimeException(String.format(
                            "The value for query parameter '%s' was blank, but a non-blank value is needed.",
                            parameterName));
                }

                Object value = valueEncoder.toValue(parameterValue);

                if (parameterType.isPrimitive() && value == null)
                    throw new RuntimeException(
                            String.format(
                                    "Query parameter '%s' evaluates to null, but the event method parameter is type %s, a primitive.",
View Full Code Here

                    Class parameterType = classCache.forName(parameterTypeName);

                    ValueEncoder valueEncoder = valueEncoderSource.getValueEncoder(parameterType);

                    Object value = valueEncoder.toValue(parameterValue);

                    if (parameterType.isPrimitive() && value == null)
                        throw new RuntimeException(
                                String.format(
                                        "Query parameter '%s' evaluates to null, but the event method parameter is type %s, a primitive.",
View Full Code Here

                    Class parameterType = classCache.forName(parameterTypeName);

                    ValueEncoder valueEncoder = valueEncoderSource.getValueEncoder(parameterType);

                    Object value = valueEncoder.toValue(parameterValue);

                    if (parameterType.isPrimitive() && value == null)
                        throw new RuntimeException(
                                String.format(
                                        "Query parameter '%s' evaluates to null, but the event method parameter is type %s, a primitive.",
View Full Code Here

        replay();

        ValueEncoder ve = coercion.coerce(pke);

        assertEquals(ve.toClient(value), "99");
        assertEquals(ve.toValue("99"), value);

        verify();
    }

    @Test
View Full Code Here

            }

            private Object coerce(final String parameterName, Class parameterType,
                    String parameterValue, ValueEncoder valueEncoder)
            {
                Object value = valueEncoder.toValue(parameterValue);

                if (parameterType.isPrimitive() && value == null)
                    throw new RuntimeException(
                            String.format(
                                    "Query parameter '%s' evaluates to null, but the event method parameter is type %s, a primitive.",
View Full Code Here

        replay();

        ContextValueEncoder cve = new ContextValueEncoderImpl(source);

        assertSame(cve.toValue(Long.class, clientValue), value);

        verify();
    }

}
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.