List of usage examples for java.lang Boolean valueOf
public static Boolean valueOf(String s)
From source file:net.groupbuy.template.method.CurrencyMethod.java
@SuppressWarnings("rawtypes") public Object exec(List arguments) throws TemplateModelException { if (arguments != null && !arguments.isEmpty() && arguments.get(0) != null && StringUtils.isNotEmpty(arguments.get(0).toString())) { boolean showSign = false; boolean showUnit = false; if (arguments.size() == 2) { if (arguments.get(1) != null) { showSign = Boolean.valueOf(arguments.get(1).toString()); }/*from ww w .jav a2 s .c o m*/ } else if (arguments.size() > 2) { if (arguments.get(1) != null) { showSign = Boolean.valueOf(arguments.get(1).toString()); } if (arguments.get(2) != null) { showUnit = Boolean.valueOf(arguments.get(2).toString()); } } Setting setting = SettingUtils.get(); BigDecimal amount = new BigDecimal(arguments.get(0).toString()); String price = setting.setScale(amount).toString(); if (showSign) { price = setting.getCurrencySign() + price; } if (showUnit) { price += setting.getCurrencyUnit(); } return new SimpleScalar(price); } return null; }
From source file:com.sammyun.template.method.CurrencyMethod.java
@SuppressWarnings("rawtypes") public Object exec(List arguments) throws TemplateModelException { if (arguments != null && !arguments.isEmpty() && arguments.get(0) != null && StringUtils.isNotEmpty(arguments.get(0).toString())) { boolean showSign = false; boolean showUnit = false; if (arguments.size() == 2) { if (arguments.get(1) != null) { showSign = Boolean.valueOf(arguments.get(1).toString()); }/*w w w .j av a 2 s. c o m*/ } else if (arguments.size() > 2) { if (arguments.get(1) != null) { showSign = Boolean.valueOf(arguments.get(1).toString()); } if (arguments.get(2) != null) { showUnit = Boolean.valueOf(arguments.get(2).toString()); } } // Setting setting = SettingUtils.get(); // BigDecimal amount = new BigDecimal(arguments.get(0).toString()); /** String price = setting.setScale(amount).toString(); if (showSign) { price = setting.getCurrencySign() + price; } if (showUnit) { price += setting.getCurrencyUnit(); }**/ return new SimpleScalar("0"); } return null; }
From source file:com.xdtech.core.config.PropertiesConfigurer.java
public static boolean sysIsInitDataToCache() { String isInitData = props.getProperty("system.isInitDataToCache"); return isInitData != null ? Boolean.valueOf(isInitData) : false; }
From source file:com.glaf.core.config.SystemProperties.java
public static boolean getBoolean(String key) { if (hasObject(key)) { String value = conf.get(key); return Boolean.valueOf(value).booleanValue(); }/*from www .ja v a 2 s . c o m*/ return false; }
From source file:Main.java
/** * parse a string to an Object of given data type. <br> * @param strValue the string value//w ww . jav a 2s . com * @param valueType the full java class name which could be <br> * java.util.Date (default format is yyyy-MM-dd) <br> * java.sql.Date (default format is yyyy-MM-dd) <br> * java.sql.Timestamp (default format is yyyy-MM-dd HH:mm:ss) <br> * java.sql.Time (default format is HH:mm:ss) <br> * java.lang.String <br> * java.lang.Boolean <br> * java.lang.Double <br> * java.lang.Long <br> * java.lang.Short <br> * java.lang.Integer <br> * java.lang.Byte <br> * java.lang.Float <br> * java.math.BigInteger <br> * java.math.BigDecimal <br> * * @param format SimpleDateFormat allowed standard formats. * @return Object * @throws Exception */ public static Object parseStringToObject(String strValue, String valueType, String format) throws Exception { if ("java.util.Date".equals(valueType)) { // default format yyyy-MM-dd SimpleDateFormat fmt = new SimpleDateFormat(format != null ? format : "yyyy-MM-dd"); return (fmt.parse(strValue)); } else if ("java.sql.Date".equals(valueType)) { // default format yyyy-MM-dd SimpleDateFormat fmt = new SimpleDateFormat(format != null ? format : "yyyy-MM-dd"); return (new java.sql.Date(fmt.parse(strValue).getTime())); } else if ("java.sql.Timestamp".equals(valueType)) { // default format yyyy-MM-dd HH:mm:ss SimpleDateFormat fmt = new SimpleDateFormat(format != null ? format : "yyyy-MM-dd HH:mm:ss"); return (new java.sql.Timestamp(fmt.parse(strValue).getTime())); } else if ("java.sql.Time".equals(valueType)) { // default format HH:mm:ss SimpleDateFormat fmt = new SimpleDateFormat(format != null ? format : "HH:mm:ss"); return (new java.sql.Time(fmt.parse(strValue).getTime())); } else if ("java.lang.Boolean".equals(valueType)) { return (Boolean.valueOf(strValue)); } else if ("java.lang.Double".equals(valueType)) { return (Double.valueOf(strValue)); } else if ("java.lang.Long".equals(valueType)) { return (Long.valueOf(strValue)); } else if ("java.lang.Short".equals(valueType)) { return (Short.valueOf(strValue)); } else if ("java.lang.Integer".equals(valueType)) { return (Integer.valueOf(strValue)); } else if ("java.lang.Byte".equals(valueType)) { return (Byte.valueOf(strValue)); } else if ("java.lang.Float".equals(valueType)) { return (Float.valueOf(strValue)); } else if ("java.math.BigInteger".equals(valueType)) { return (new java.math.BigInteger(strValue)); } else if ("java.math.BigDecimal".equals(valueType)) { return (new java.math.BigDecimal(strValue)); } else { return (strValue); } }
From source file:com.smartling.api.sdk.ApiTestHelper.java
public static boolean getTestMode() { return System.getProperty("testMode") == null ? false : Boolean.valueOf(System.getProperty("testMode")); }
From source file:com.ocs.dynamo.importer.impl.BaseTextImporter.java
/** * Extracts a boolean value//w ww. j ava 2 s. co m * * @param unit * @return */ protected Boolean getBooleanValue(String unit) { String value = unit; if (StringUtils.isEmpty(value)) { return Boolean.FALSE; } return Boolean.valueOf(value); }
From source file:com.acc.fulfilmentprocess.strategy.impl.SplitByAvailableCount.java
@Override public Object getGroupingObject(final AbstractOrderEntryModel orderEntry) { if (orderEntry.getDeliveryPointOfService() != null) { final Long stock = getCommerceStockService().getStockLevelForProductAndPointOfService( orderEntry.getProduct(), orderEntry.getDeliveryPointOfService()); return Boolean.valueOf(stock == null || stock.longValue() >= orderEntry.getQuantity().longValue()); } else {/* w ww .j a va2s . com*/ Long stock = Long.valueOf(0); if (orderEntry.getOrder().getStore() != null) { stock = getCommerceStockService().getStockLevelForProductAndBaseStore(orderEntry.getProduct(), orderEntry.getOrder().getStore()); } return Boolean.valueOf(stock == null || stock.longValue() >= orderEntry.getQuantity().longValue()); } }
From source file:com.wabacus.system.datatype.BooleanType.java
public Object getColumnValue(ResultSet rs, String column, AbsDatabaseType dbtype) throws SQLException { return Boolean.valueOf(rs.getBoolean(column)); }
From source file:org.openmrs.web.taglib.OpenmrsHtmlEscapingAwareTag.java
/** * @see HtmlEscapingAwareTag#setHtmlEscape(boolean) *//*from www . j a v a2 s. c om*/ public void setHtmlEscape(String htmlEscape) throws JspException { this.htmlEscape = Boolean.valueOf(htmlEscape); }