Package org.apache.hivemind.schema

Examples of org.apache.hivemind.schema.Translator


        assertEquals("Fluffy Puppies", result);
    }
   
    public void testNoEditor()
    {
        Translator t = new SmartTranslator();
        Location l = fabricateLocation(22);

        try
        {
            t.translate(null, Registry.class, "fred", l);

            unreachable();
        }
        catch (ApplicationRuntimeException ex)
        {
View Full Code Here


*/
public class TestIdTranslators extends HiveMindTestCase
{
    public void testNullId()
    {
        Translator t = new QualifiedIdTranslator();

        assertNull(t.translate(null, null, null, null));
    }
View Full Code Here

    {
        Module m = getModule();

        replayControls();

        Translator t = new QualifiedIdTranslator();

        assertEquals("foo.bar.Baz", t.translate(m, null, "Baz", null));

        verifyControls();
    }
View Full Code Here

        verifyControls();
    }

    public void testNullList()
    {
        Translator t = new IdListTranslator();

        assertEquals(null, t.translate(null, null, null, null));
    }
View Full Code Here

    {
        Module m = getModule();

        replayControls();

        Translator t = new IdListTranslator();

        assertEquals("foo.bar.Baz,zip.Zap", t.translate(m, null, "Baz,zip.Zap", null));

        verifyControls();
    }
View Full Code Here

        // The cache is preloaded with the hardcoded translators.

        if (!_translatorsLoaded && !_translatorsCache.containsKey(constructor))
            loadTranslators();

        Translator result = (Translator) _translatorsCache.get(constructor);

        if (result == null)
        {
            result = constructTranslator(constructor);
            _translatorsCache.put(constructor, result);
View Full Code Here

                continue;
            }

            locations.put(name, c.getLocation());

            Translator t = c.getTranslator();

            if (t != null)
            {
                _translatorsCache.put(name, t);
                continue;
View Full Code Here

        Object target = processor.peek();

        try
        {
            Translator t =
                _translator == null
                    ? processor.getAttributeTranslator(_attributeName)
                    : processor.getTranslator(_translator);

            Class propertyType = PropertyUtils.getPropertyType(target, _propertyName);

            Object finalValue =
                t.translate(
                    processor.getContributingModule(),
                    propertyType,
                    value,
                    element.getLocation());
View Full Code Here

    {
        String value = RuleUtils.processText(processor, element, element.getContent());

        try
        {
            Translator t = processor.getContentTranslator();

            Object target = processor.peek();

            Class propertyType = PropertyUtils.getPropertyType(target, _propertyName);

            Object finalValue =
                t.translate(
                    processor.getContributingModule(),
                    propertyType,
                    value,
                    element.getLocation());
View Full Code Here

    /**
     * Test a primitive type (int).
     */
    public void testInt()
    {
        Translator t = new SmartTranslator();

        Object result = t.translate(null, int.class, "-37", null);

        assertEquals(new Integer(-37), result);
    }
View Full Code Here

TOP

Related Classes of org.apache.hivemind.schema.Translator

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.