Example usage for org.apache.commons.beanutils ConvertUtils deregister

List of usage examples for org.apache.commons.beanutils ConvertUtils deregister

Introduction

In this page you can find the example usage for org.apache.commons.beanutils ConvertUtils deregister.

Prototype

public static void deregister() 

Source Link

Document

Remove all registered Converter s, and re-establish the standard Converters.

For more details see ConvertUtilsBean.

Usage

From source file:net.nicholaswilliams.java.teamcity.plugin.buildNumber.TestConfigurationDigesterModule.java

@After
public void tearDown() {
    ConvertUtils.deregister();
}

From source file:com.square.client.gwt.server.service.UtilServiceGwtImpl.java

/**
 * Enregistrement des converter./* ww  w .j  ava  2  s. c om*/
 */
private void resetConverter() {
    ConvertUtils.deregister();
    ConvertUtils.register(new StringConverter(), String.class);
}

From source file:com.rodaxsoft.junit.mailgun.MailgunManagerTestCase.java

/**
 * Test for {@link MailgunManager#getMailingListMembers(String, Class)}
 */// w  w w  .  ja  v a 2 s .c om
@Test
public void testGetMailingListMembersWithVarsType() {

    // Register converters
    Class<MemberDetails> varsType = MemberDetails.class;
    ConvertUtils.register(new MemberDetailsConverter(), varsType);

    Object result;
    try {
        result = MailgunManager.getMailingListMembers(sMailingListAddress, varsType);
        assertTrue(result != null);

    } catch (Exception e) {
        LOG.error("Get Mailing List Members Error", e);
        fail(e.getMessage());
    }

    finally {
        // De-register converters
        ConvertUtils.deregister();
    }

}

From source file:com.square.tarificateur.noyau.util.comparaison.famille.ComparaisonFamilleUtil.java

/** Enregistrement des converters. */
private void resetConverter() {
    ConvertUtils.deregister();
    if (customConverter != null) {
        for (Class<? extends Object> clazz : customConverter.keySet()) {
            ConvertUtils.register(customConverter.get(clazz), clazz);
        }/*from w  w  w .j av a 2s. c o  m*/
    }
}

From source file:org.apache.struts.action.ActionServlet.java

/**
 * <p>Initialize other global characteristics of the controller
 * servlet.</p>//  w w  w  .  j a v a2 s  . co  m
 *
 * @throws ServletException if we cannot initialize these resources
 */
protected void initOther() throws ServletException {
    String value;

    value = getServletConfig().getInitParameter("config");

    if (value != null) {
        config = value;
    }

    // Backwards compatibility for form beans of Java wrapper classes
    // Set to true for strict Struts 1.0 compatibility
    value = getServletConfig().getInitParameter("convertNull");

    if ("true".equalsIgnoreCase(value) || "yes".equalsIgnoreCase(value) || "on".equalsIgnoreCase(value)
            || "y".equalsIgnoreCase(value) || "1".equalsIgnoreCase(value)) {
        convertNull = true;
    }

    if (convertNull) {
        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);
        ConvertUtils.register(new LongConverter(null), Long.class);
        ConvertUtils.register(new ShortConverter(null), Short.class);
    }
}

From source file:org.quickbundle.third.struts.action.RmActionServlet.java

/**
  * <p>Initialize other global characteristics of the controller
  * servlet.</p>//from w ww  . ja v  a 2 s .  co  m
  *
  * @throws ServletException if we cannot initialize these resources
  */
protected void initOther() throws ServletException {
    String value;

    value = getServletConfig().getInitParameter("config");

    if (value != null) {
        //QB-RM add *.xml
        if (value.trim().length() > 0 && value.indexOf("*.xml") > -1) { //
            String finalValue = "";
            String[] aValue = value.trim().split(",");
            for (int j = 0; j < aValue.length; j++) {
                String path = aValue[j];
                if (path.trim().length() == 0) {
                    continue;
                }
                //??*.xml
                if (path.trim().endsWith("*.xml")) {
                    File fWarDirStr = RmPathHelper.getWarDir();
                    File fPath = new File(fWarDirStr + File.separator
                            + (path.substring(0, path.length() - "*.xml".length())));
                    for (int i = 0; i < fPath.listFiles().length; i++) {
                        File fPathXml = fPath.listFiles()[i];
                        if (fPathXml.isFile() && fPathXml.toString().toLowerCase().endsWith(".xml")) {
                            String newPath = fPathXml.getAbsolutePath()
                                    .substring((int) fWarDirStr.getAbsoluteFile().toString().length())
                                    .replaceAll("\\\\", "/");
                            finalValue += newPath + ",";
                        }
                    }
                } else {
                    finalValue += path + ",";
                }
            }
            if (finalValue.endsWith(",")) {
                finalValue = finalValue.substring(0, finalValue.length() - ",".length());
            }
            config = finalValue;
        } else {
            config = value;
        }
    }

    // Backwards compatibility for form beans of Java wrapper classes
    // Set to true for strict Struts 1.0 compatibility
    value = getServletConfig().getInitParameter("convertNull");

    if ("true".equalsIgnoreCase(value) || "yes".equalsIgnoreCase(value) || "on".equalsIgnoreCase(value)
            || "y".equalsIgnoreCase(value) || "1".equalsIgnoreCase(value)) {
        convertNull = true;
    }

    if (convertNull) {
        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);
        ConvertUtils.register(new LongConverter(null), Long.class);
        ConvertUtils.register(new ShortConverter(null), Short.class);
    }
}