List of usage examples for org.apache.commons.beanutils.converters BooleanConverter BooleanConverter
public BooleanConverter(Object defaultValue)
From source file:org.apache.struts.action.ActionServlet.java
/** * <p>Initialize other global characteristics of the controller * servlet.</p>//from ww w . j a 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) { 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.beanfuse.struts2.action.helper.ParamHelper.java
public static void registerConverter() { 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); }
From source file:org.beangle.commons.converters.Converter.java
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; }
From source file:org.kuali.rice.kns.web.struts.action.KualiActionServlet.java
/** * <p>Initialize other global characteristics of the controller servlet.</p> * Overridden to remove the ConvertUtils.deregister() command that caused problems * with the concurrent data dictionary load. (KULRNE-4405) * * @exception ServletException if we cannot initialize these resources *///from w ww .j av a 2s .c om @Override protected void initOther() throws ServletException { String value = null; 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.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); } // KULRICE-8176: KFS Notes/Attachments Tab Functionality for Note Text Error - Visible/Special characters, spaces, or tabs parameterEncoding = getServletConfig().getInitParameter("PARAMETER_ENCODING"); }
From source file:org.mule.providers.jcr.JcrMessageReceiver.java
public JcrMessageReceiver(UMOConnector connector, UMOComponent component, UMOEndpoint endpoint) throws InitialisationException { super(connector, component, endpoint); jcrConnector = (JcrConnector) getConnector(); if (logger.isDebugEnabled()) { logger.debug("Initializing for: " + endpoint); }//from w w w . jav a 2 s .c o m // Future JCR version will offer a standard way to get a repository // instance, at that time host/port will be used for what they are on // the endpoint because it will become possible to specify a full URL to // a repository absPath = endpoint.getEndpointURI().getAddress(); eventTypes = (Integer) new IntegerConverter(jcrConnector.getEventTypes()).convert(Integer.class, endpoint.getProperty("eventTypes")); deep = (Boolean) new BooleanConverter(jcrConnector.isDeep()).convert(Boolean.class, endpoint.getProperty("deep")); Object uuidProperty = endpoint.getProperty("uuid"); if (uuidProperty == null) { uuid = jcrConnector.getUuid(); } else { uuid = (List) uuidProperty; } Object nodeTypeNameProperty = (List) endpoint.getProperty("nodeTypeName"); if (nodeTypeNameProperty == null) { nodeTypeName = jcrConnector.getNodeTypeName(); } else { nodeTypeName = (List) nodeTypeNameProperty; } noLocal = (Boolean) new BooleanConverter(jcrConnector.isNoLocal()).convert(Boolean.class, endpoint.getProperty("noLocal")); String contentPayloadTypeProperty = (String) endpoint.getProperty("contentPayloadType"); if (contentPayloadTypeProperty == null) { contentPayloadTypeProperty = jcrConnector.getContentPayloadType(); } try { contentPayloadType = JcrContentPayloadType.fromString(contentPayloadTypeProperty); } catch (IllegalArgumentException iae) { throw new InitialisationException(iae, this); } }
From source file:org.quickbundle.third.struts.action.RmActionServlet.java
/** * <p>Initialize other global characteristics of the controller * servlet.</p>/*w w w.j ava2 s.c o 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); } }
From source file:org.sputnikdev.bluetooth.gattparser.FieldHolder.java
/** * Returns a Boolean representation of the field or a default value in case if the field cannot * be converted to a Boolean.// w w w .j av a 2 s. c om * @param def the default value to be returned if an error occurs converting the field * @return a Boolean representation of the field */ public Boolean getBoolean(Boolean def) { return new BooleanConverter(def).convert(Boolean.class, prepareValue()); }