List of usage examples for java.math BigDecimal BigDecimal
public BigDecimal(long val)
From source file:com.dolgoter.configuration.TeamConfig.java
@Bean @Qualifier("boss") public Trainer getTrainer() { Trainer mour = new Trainer("Jose", "Mourinho", 45, new ArrayList<Team>()); mour.setSalary(new Salary(new BigDecimal(1000000))); return mour;/*from ww w . j ava 2s. co m*/ }
From source file:com.trenako.format.CurrencyFormatter.java
@Override public String print(Number object, Locale locale) { BigDecimal number = new BigDecimal((Integer) object).divide(RATIO); return super.print(number, locale); }
From source file:com.jive.myco.seyren.core.util.math.BigDecimalDeserializer.java
@Override public BigDecimal deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { return jp.getText() != null ? new BigDecimal(jp.getText()) : null; }
From source file:cz.muni.fi.dndtroopsweb.validation.TroopCreateDTOValidator.java
/** * Validates data for about to be created troop *//* ww w. j a v a2 s . co m*/ @Override public void validate(Object target, Errors errors) { TroopCreateDTO troopCreateDTO = (TroopCreateDTO) target; if (troopCreateDTO.getName() == null || troopCreateDTO.getName().length() < 3) { errors.rejectValue("name", "TroopCreateDTOValidator.bad.name"); } try { if (troopCreateDTO.getMoney() == null || (troopCreateDTO.getMoney().compareTo(new BigDecimal("0"))) == -1) { errors.rejectValue("money", "TroopCreateDTOValidator.bad.money"); } } catch (Exception e) { errors.rejectValue("money", "TroopCreateDTOValidator.bad.money"); } if (troopCreateDTO.getMission() == null || troopCreateDTO.getMission().length() < 3) { errors.rejectValue("mission", "TroopCreateDTOValidator.bad.mission"); } }
From source file:com.jaspersoft.studio.editor.preview.input.array.number.BigDecimalElement.java
@Override protected Object convertString(String str) { return new BigDecimal(str); }
From source file:com.dolgoter.configuration.PlayerConfig.java
@Bean public Salary getSalaryForMessi() { Salary sal = new Salary(new BigDecimal(100000000)); return sal; }
From source file:cn.ctyun.amazonaws.util.StringUtils.java
public static BigDecimal toBigDecimal(String s) { return new BigDecimal(s); }
From source file:com.create.databind.MoneyDeserializer.java
@Override public BigDecimal deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { final String value = jsonParser.getValueAsString(); return new BigDecimal(value).setScale(CURRENCY_SCALE, BigDecimal.ROUND_HALF_UP); }
From source file:com.creditcloud.interestbearing.ta.message.asset.UserQueryLatestAssetResponseMessage.java
public BigDecimal getBookValue() { return new BigDecimal(book_value); }
From source file:com.bstek.dorado.data.type.BigDecimalDataType.java
@Override public Object fromObject(Object value) { if (value == null) { return null; } else if (value instanceof BigDecimal) { return value; } else if (value instanceof Number) { return new BigDecimal(((Number) value).toString()); } else if (value instanceof String) { return fromText((String) value); } else {// ww w.j a v a 2 s . c o m throw new DataConvertException(value.getClass(), BigDecimal.class); } }