private void typeConvertBegin(final Type from, final Type to,
                                      boolean castPreferred) {
            Class<?> fromNat = from.getNaturalClass();
            Class<?> toNat = to.getNaturalClass();

            if (fromNat.isArray() && toNat.isArray()) {
                // Nothing to do at beginning of conversion.
                return;
            }

            if (from.isPrimitive()) {
                if (to.isPrimitive()) {
                    // Nothing to do at beginning of conversion.
                    return;
                }
                else {
                    // Assume using object peer for primitive type.
                    Class<?> fromObj = from.getObjectClass();
                    Class<?> toObj = to.getObjectClass();

                    if (fromObj == toObj) {
                        if (fromObj != Boolean.class &&
                            fromObj != Integer.class)
                        {
                            mBuilder.newObject(makeDesc(from, false));
                            mBuilder.dup();
                        }
                        return;
                    }
                }
            }
            else {
                if (to.isPrimitive()) {
                    // Assume using primitive peer for object.
                    if (from.hasPrimitivePeer() ||
                        (Number.class.isAssignableFrom(to.getObjectClass()) &&
                         Number.class.isAssignableFrom(from.getObjectClass())))
                    {
                        // Nothing to do at beginning.
                        return;
                    }
                }
                else {
                    if (Number.class.isAssignableFrom(fromNat) &&
                        Number.class.isAssignableFrom(toNat)) {

                        // Nothing to do at beginning.
                        return;
                    }
                }
            }

            boolean convertStringToNonNull =
                from.isNullable() && to.isNonNull() &&
                String.class.isAssignableFrom(fromNat) &&
                String.class.isAssignableFrom(toNat);

            if (!convertStringToNonNull && toNat.isAssignableFrom(fromNat)) {
                // Do nothing at all for upcast.
                return;
            }

            boolean canCast = fromNat.isAssignableFrom(toNat);
            boolean canConvertToString = toNat.isAssignableFrom(String.class);

            if (canConvertToString && (!canCast || !castPreferred)) {
                // String conversion.
                if (String.class.isAssignableFrom(fromNat)) {
                    // Converting from a String to a non-null String.
                    // Do nothing at the beginning.
                }
                else if (to.isNullable() &&
                         (from.isNullable() ||
                          fromNat.isAssignableFrom(String.class))) {
                    // Converting to a nullable String from a nullable object
                    // or an object that might already be a string, so perform
                    // special logic. Do nothing at the beginning.
                }
                else {
                    Method converter = stringConversionMethod(from);
                    if (!Modifier.isStatic(converter.getModifiers())) {
                        // Push instance of Context onto stack.
                        generateContext();
                    }
                }
                return;
            }
            else if (canCast) {
                // Nothing to do at beginning for downcast.
                return;
            }

            typeError(from, to);
        }