Package org.apache.commons.beanutils.converters

Examples of org.apache.commons.beanutils.converters.BooleanConverter


    String stringArray[] = new String[0];

    register(BigDecimal.class, new BigDecimalConverter());
    register(BigInteger.class, new BigIntegerConverter());

    register(Boolean.TYPE, new BooleanConverter());
    register(Boolean.class, new BooleanConverter());
    register(booleanArray.getClass(), new BooleanArrayConverter());

    register(Byte.TYPE, new ByteConverter());
    register(Byte.class, new ByteConverter());
    register(byteArray.getClass(), new ByteArrayConverter());
View Full Code Here


  public static final ConvertUtilsBean getDefault() {
    ConvertUtilsBean convertUtils = new ConvertUtilsBean();
    convertUtils.register(new SqlDateConverter(), java.sql.Date.class);
    convertUtils.register(new DateConverter(), java.util.Date.class);
    convertUtils.register(new BooleanConverter(null), Boolean.class);
    convertUtils.register(new IntegerConverter(null), Integer.class);
    convertUtils.register(new LongConverter(null), Long.class);
    convertUtils.register(new FloatConverter(null), Float.class);
    convertUtils.register(new DoubleConverter(null), Double.class);
    return convertUtils;
View Full Code Here

        }

        if (type.equals("boolean"))
        {
            dc.setTarget(Boolean.class);
            dc.setConverter(new BooleanConverter());
        }
        else if (type.equals("number"))
        {
            if (getValue() != null && getValue().toString().indexOf('.') < 0)
            {
View Full Code Here

            ConvertUtils.deregister();
            ConvertUtils.register(new BigDecimalConverter(null),
                BigDecimal.class);
            ConvertUtils.register(new BigIntegerConverter(null),
                BigInteger.class);
            ConvertUtils.register(new BooleanConverter(null), Boolean.class);
            ConvertUtils.register(new ByteConverter(null), Byte.class);
            ConvertUtils.register(new CharacterConverter(null), Character.class);
            ConvertUtils.register(new DoubleConverter(null), Double.class);
            ConvertUtils.register(new FloatConverter(null), Float.class);
            ConvertUtils.register(new IntegerConverter(null), Integer.class);
View Full Code Here

        return (defaultBoolean.booleanValue());
    }

    public static void setDefaultBoolean(boolean newDefaultBoolean) {
        defaultBoolean = new Boolean(newDefaultBoolean);
        converters.put(Boolean.TYPE, new BooleanConverter(defaultBoolean));
        converters.put(Boolean.class,  new BooleanConverter(defaultBoolean));
    }
View Full Code Here

    public static void deregister() {

        converters.clear();
        converters.put(BigDecimal.class, new BigDecimalConverter());
        converters.put(BigInteger.class, new BigIntegerConverter());
        converters.put(Boolean.TYPE, new BooleanConverter(defaultBoolean));
        converters.put(Boolean.class,  new BooleanConverter(defaultBoolean));
        converters.put(Byte.TYPE, new ByteConverter(defaultByte));
        converters.put(Byte.class, new ByteConverter(defaultByte));
        converters.put(Character.TYPE,
                       new CharacterConverter(defaultCharacter));
        converters.put(Character.class,
View Full Code Here

            this.converter = new AutoConverter();
        }
        else if (type.equals("boolean"))
        {
            this.target = Boolean.class;
            this.converter = new BooleanConverter();
        }
        else if (type.equals("number"))
        {
            this.target = Number.class;
            this.converter = new NumberConverter();
View Full Code Here

        public Object convert(String value)
        {
            // check if this looks like a typical boolean type
            if (value.matches("true|false|yes|no|y|n|on|off"))
            {
                return new BooleanConverter().convert(Boolean.class, value);
            }
            // check if this looks like a typical number
            else if (value.matches("-?[0-9]+(\\.[0-9]+)?"))
            {
                return new NumberConverter().convert(Number.class, value);
View Full Code Here

        ConvertUtils.register(new SqlDateConverter(null),java.sql.Date.class);
    ConvertUtils.register(new SqlTimeConverter(null),Time.class);
    ConvertUtils.register(new SqlTimestampConverter(null),Timestamp.class);
   
    //number
    ConvertUtils.register(new BooleanConverter(null), Boolean.class);
    ConvertUtils.register(new ShortConverter(null), Short.class);
    ConvertUtils.register(new IntegerConverter(null), Integer.class);
    ConvertUtils.register(new LongConverter(null), Long.class);
    ConvertUtils.register(new FloatConverter(null), Float.class);
    ConvertUtils.register(new DoubleConverter(null), Double.class);
View Full Code Here

     * @deprecated Register replacement converters for Boolean.TYPE and
     *  Boolean.class instead
     */
    public void setDefaultBoolean(boolean newDefaultBoolean) {
        defaultBoolean = (newDefaultBoolean ? Boolean.TRUE : Boolean.FALSE);
        register(new BooleanConverter(defaultBoolean), Boolean.TYPE);
        register(new BooleanConverter(defaultBoolean), Boolean.class);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.beanutils.converters.BooleanConverter

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.