Examples of coerce()


Examples of com.google.gwt.dev.jjs.ast.JPrimitiveType.coerce()

    if ((type instanceof JPrimitiveType) && (exp instanceof JValueLiteral)) {
      // Statically evaluate casting literals.
      JPrimitiveType primitiveType = (JPrimitiveType) type;
      JValueLiteral expLit = (JValueLiteral) exp;
      JValueLiteral casted = primitiveType.coerce(expLit);
      if (casted != null) {
        return casted;
      }
    }
View Full Code Here

Examples of net.sourceforge.javautil.common.coersion.ICoersion.coerce()

    if (external.size() > 0) {
      Iterator<ICoersion> external = this.external.iterator();
      while (external.hasNext()) {
        ICoersion coersion = external.next();
        if (coersion.isCanCoerce(original, targetType)) return (T) coersion.coerce(original, targetType);
      }
    }

    Iterator<ICoersion> internal = this.internal.iterator();
    while (internal.hasNext()) {
View Full Code Here

Examples of net.sourceforge.javautil.common.coersion.ICoersion.coerce()

    }

    Iterator<ICoersion> internal = this.internal.iterator();
    while (internal.hasNext()) {
      ICoersion coersion = internal.next();
      if (coersion.isCanCoerce(original, targetType)) return (T) coersion.coerce(original, targetType);
    }
   
    if (original instanceof CharSequence) {
      return (T) this.coerceCharSequence((CharSequence)original, targetType);
    }
View Full Code Here

Examples of org.apache.tapestry.ioc.services.Coercion.coerce()

        Object result;

        try
        {
            result = coercion.coerce(input);
        }
        catch (Exception ex)
        {
            throw new RuntimeException(ServiceMessages.failedCoercion(
                    input,
View Full Code Here

Examples of org.apache.tapestry.ioc.services.Coercion.coerce()

        Object result;

        try
        {
            result = coercion.coerce(input);
        }
        catch (Exception ex)
        {
            throw new RuntimeException(ServiceMessages.failedCoercion(
                    input,
View Full Code Here

Examples of org.apache.tapestry.ioc.services.Coercion.coerce()

        Object result;

        try
        {
            result = coercion.coerce(input);
        }
        catch (Exception ex)
        {
            throw new RuntimeException(ServiceMessages.failedCoercion(
                    input,
View Full Code Here

Examples of org.apache.tapestry.ioc.services.Coercion.coerce()

        if (effectiveTargetType.isAssignableFrom(sourceType)) return input;

        Coercion coercer = findCoercer(sourceType, effectiveTargetType);

        Object result = coercer.coerce(input);

        // Double check that the coercer provided a result of the correct type

        return effectiveTargetType.cast(result);
    }
View Full Code Here

Examples of org.apache.tapestry.ioc.services.Coercion.coerce()

        Object result;

        try
        {
            result = coercion.coerce(input);
        }
        catch (Exception ex)
        {
            throw new RuntimeException(ServiceMessages.failedCoercion(
                    input,
View Full Code Here

Examples of org.apache.tapestry.ioc.services.TypeCoercer.coerce()

    @Test
    public void string_to_select_model_type_coercion_integration()
    {
        TypeCoercer coercer = getService(TypeCoercer.class);

        SelectModel selectModel = coercer.coerce(" UK , USA , DE=Germany ", SelectModel.class);

        assertNull(selectModel.getOptionGroups());
        assertEquals(selectModel.getOptions().size(), 3);

        // Waste of effort to re-test each individual option model.
View Full Code Here

Examples of org.apache.tapestry.ioc.services.TypeCoercer.coerce()

    {
        TypeCoercer coercer = getObject(TypeCoercer.class, null);

        String input = "\\s+";

        Pattern pattern = coercer.coerce(input, Pattern.class);

        assertEquals(pattern.toString(), input);
    }

    @Test
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.