Package org.apache.torque.om

Examples of org.apache.torque.om.NumberKey


            NumberKey[] values = new NumberKey[inputs.length];
            for (int i = 0; i < inputs.length; i++)
            {
                if (StringUtils.isNotEmpty(inputs[i]))
                {
                    values[i] = new NumberKey(
                            canonicalizeDecimalInput(inputs[i]));
                }
                else
                {
                    values[i] = null;
                }
            }
            setTestValue(values);
        }
        else
        {
            String val = parser.getString(getKey());
            if (StringUtils.isNotEmpty(val))
            {
                BigDecimal bd = canonicalizeDecimalInput(val);
                setTestValue(new NumberKey(bd));
            }
            else
            {
                setTestValue(null);
            }
View Full Code Here


        Constraint constraint = (Constraint) paramMap.get(MIN_VALUE_RULE_NAME);
        if (constraint != null)
        {
            String param = constraint.getValue();
            minValue = new NumberKey(param);
            minValueMessage = constraint.getMessage();
        }

        constraint = (Constraint) paramMap.get(MAX_VALUE_RULE_NAME);
        if (constraint != null)
        {
            String param = constraint.getValue();
            maxValue = new NumberKey(param);
            maxValueMessage = constraint.getMessage();
        }
    }
View Full Code Here

     * testValue did not pass the validation tests.
     */
    public void assertValidity(String testValue)
            throws ValidationException
    {
        NumberKey nk = null;
        try
        {
            nk = new NumberKey(testValue);
        }
        catch (RuntimeException e)
        {
            errorMessage = invalidNumberMessage;
            throw new ValidationException(invalidNumberMessage);
        }
        if (minValue != null && nk.compareTo(minValue) < 0)
        {
            errorMessage = minValueMessage;
            throw new ValidationException(minValueMessage);
        }
        if (maxValue != null && nk.compareTo(maxValue) > 0)
        {
            errorMessage = maxValueMessage;
            throw new ValidationException(maxValueMessage);
        }
    }
View Full Code Here

     * @return A NumberKey, or <code>null</code> if unparsable.
     * @deprecated no replacement
     */
    public NumberKey getNumberKey(String name)
    {
        NumberKey result = null;
        try
        {
            String value = getString(name);
            if (StringUtils.isNotEmpty(value))
            {
                result = new NumberKey(value);
            }
        }
        catch (ClassCastException e)
        {
            log.error("Parameter ("
View Full Code Here

    public void testGetForeignKeyForPrimitiveIntNotZero() throws Exception
    {
        NullablePIntegerFk nullablePIntegerFk = new NullablePIntegerFk();
        nullablePIntegerFk.setFk(3);
        ObjectKey foreignKey = nullablePIntegerFk.getForeignKeyForPIntegerPk();
        assertEquals(new NumberKey(3), foreignKey);
    }
View Full Code Here

            throws Exception
    {
        PIntegerFkWithDefault pIntegerFk = new PIntegerFkWithDefault();
        pIntegerFk.setFk(2);
        ObjectKey foreignKey = pIntegerFk.getForeignKeyForPIntegerPk();
        assertEquals(new NumberKey(2), foreignKey);
    }
View Full Code Here

    public void testGetForeignKeyForDefaultedPrimitiveIntNotZero() throws Exception
    {
        PIntegerFkWithDefault pIntegerFk = new PIntegerFkWithDefault();
        pIntegerFk.setFk(3);
        ObjectKey foreignKey = pIntegerFk.getForeignKeyForPIntegerPk();
        assertEquals(new NumberKey(3), foreignKey);
    }
View Full Code Here

    public void testGetForeignKeyForObjectIntZero() throws Exception
    {
        NullableOIntegerFk nullableOIntegerFk = new NullableOIntegerFk();
        nullableOIntegerFk.setFk(0);
        ObjectKey foreignKey = nullableOIntegerFk.getForeignKeyForOIntegerPk();
        assertEquals(new NumberKey(0), foreignKey);
    }
View Full Code Here

    public void testGetForeignKeyForObjectIntNotZero() throws Exception
    {
        NullableOIntegerFk nullableOIntegerFk = new NullableOIntegerFk();
        nullableOIntegerFk.setFk(3);
        ObjectKey foreignKey = nullableOIntegerFk.getForeignKeyForOIntegerPk();
        assertEquals(new NumberKey(3), foreignKey);
    }
View Full Code Here

    public void testGetForeignKeyForDefaultedObjectIntZero() throws Exception
    {
        OIntegerFkWithDefault oIntegerFk = new OIntegerFkWithDefault();
        oIntegerFk.setFk(0);
        ObjectKey foreignKey = oIntegerFk.getForeignKeyForOIntegerPk();
        assertEquals(new NumberKey(0), foreignKey);
    }
View Full Code Here

TOP

Related Classes of org.apache.torque.om.NumberKey

Copyright © 2018 www.massapicom. 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.