Examples of CoercionTuple


Examples of org.apache.tapestry5.ioc.services.CoercionTuple

        // memory leaks by retaining an instance). In any case, there are edge cases where we may create
        // the tuple unnecessarily (such as when an explicit string-to-enum coercion is part of the TypeCoercer
        // configuration), but on the whole, this is cheap at works.
       
        if (sourceType == String.class && Enum.class.isAssignableFrom(targetType))
            tuples = extend(tuples, new CoercionTuple(sourceType, targetType, new StringToEnumCoercion(targetType)));

        return tuples;
    }
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.CoercionTuple

        seedQueue(sourceType, targetType, consideredTuples, queue);

        while (!queue.isEmpty())
        {
            CoercionTuple tuple = queue.removeFirst();

            // If the tuple results in a value type that is assignable to the desired target type,
            // we're done! Later, we may add a concept of "cost" (i.e. number of steps) or
            // "quality" (how close is the tuple target type to the desired target type). Cost
            // is currently implicit, as compound tuples are stored deeper in the queue,
            // so simpler coercions will be located earlier.

            Class tupleTargetType = tuple.getTargetType();

            if (targetType.isAssignableFrom(tupleTargetType))
                return tuple.getCoercion();

            // So .. this tuple doesn't get us directly to the target type.
            // However, it *may* get us part of the way. Each of these
            // represents a coercion from the source type to an intermediate type.
            // Now we're going to look for conversions from the intermediate type
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.CoercionTuple

                // from I1 (i.e., I2 is a superclass/superinterface of I1) and X is a new
                // intermediate type, hopefully closer to our eventual target type.

                Coercion compoundCoercer = new CompoundCoercion(intermediateTuple.getCoercion(), tuple.getCoercion());

                CoercionTuple compoundTuple = new CoercionTuple(sourceType, newIntermediateType, compoundCoercer, false);

                // So, every tuple that is added to the queue can take as input the sourceType.
                // The target type may be another intermediate type, or may be something
                // assignable to the target type, which will bring the search to a successful
                // conclusion.
View Full Code Here

Examples of org.apache.tapestry5.ioc.services.CoercionTuple

        // memory leaks by retaining an instance). In any case, there are edge cases where we may create
        // the tuple unnecessarily (such as when an explicit string-to-enum coercion is part of the TypeCoercer
        // configuration), but on the whole, this is cheap at works.

        if (sourceType == String.class && Enum.class.isAssignableFrom(targetType))
            tuples = extend(tuples, new CoercionTuple(sourceType, targetType, new StringToEnumCoercion(targetType)));

        return tuples;
    }
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.