Example usage for java.math RoundingMode HALF_UP

List of usage examples for java.math RoundingMode HALF_UP

Introduction

In this page you can find the example usage for java.math RoundingMode HALF_UP.

Prototype

RoundingMode HALF_UP

To view the source code for java.math RoundingMode HALF_UP.

Click Source Link

Document

Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round up.

Usage

From source file:org.specvis.logic.Functions.java

/**
 * Generate double linspace vector./*from   www  . ja  v a  2  s .com*/
 * @param start
 * @param stop
 * @param n
 * @param roundToInt
 * @return Double linspace vector.
 */
public ArrayList<Double> linspace(double start, double stop, int n, boolean roundToInt) {
    ArrayList<Double> result = new ArrayList();
    double step = (stop - start) / (n - 1);
    for (int i = 0; i <= n - 2; i++) {
        if (roundToInt) {
            BigDecimal bd = new BigDecimal(start + (i * step));
            bd = bd.setScale(0, RoundingMode.HALF_UP);
            result.add(bd.doubleValue());
        } else {
            result.add(start + (i * step));
        }
    }
    result.add(stop);
    return result;
}

From source file:org.projectforge.statistics.TimesheetDisciplineChartBuilder.java

/**
 * Ein Diagramm, welches ber die letzten n Tage die Tage visualisiert, die zwischen Zeitberichtsdatum und Zeitpunkt der tatschlichen
 * Buchung liegen.//from  ww  w  . j  av  a 2s  . c om
 * @param timesheetDao
 * @param userId
 * @param forLastNDays
 * @param shape e. g. new Ellipse2D.Float(-3, -3, 6, 6) or null, if no marker should be printed.
 * @param stroke e. g. new BasicStroke(3.0f).
 * @param showAxisValues
 * @return
 */
public JFreeChart create(final TimesheetDao timesheetDao, final Integer userId, final short forLastNDays,
        final Shape shape, final Stroke stroke, final boolean showAxisValues) {
    final DayHolder dh = new DayHolder();
    final TimesheetFilter filter = new TimesheetFilter();
    filter.setStopTime(dh.getDate());
    dh.add(Calendar.DATE, -forLastNDays);
    filter.setStartTime(dh.getDate());
    filter.setUserId(userId);
    filter.setOrderType(OrderDirection.ASC);
    final List<TimesheetDO> list = timesheetDao.getList(filter);
    final TimeSeries planSeries = new TimeSeries("Soll");
    final TimeSeries actualSeries = new TimeSeries("Ist");
    final Iterator<TimesheetDO> it = list.iterator();
    TimesheetDO current = null;
    if (it.hasNext() == true) {
        current = it.next();
    }
    long numberOfBookedDays = 0;
    long totalDifference = 0;
    for (int i = 0; i <= forLastNDays; i++) {
        long difference = 0;
        long totalDuration = 0; // Weight for average.
        while (current != null && (dh.isSameDay(current.getStartTime()) == true
                || current.getStartTime().before(dh.getDate()) == true)) {
            long duration = current.getWorkFractionDuration();
            difference += (current.getCreated().getTime() - current.getStartTime().getTime()) * duration;
            totalDuration += duration;
            if (it.hasNext() == true) {
                current = it.next();
            } else {
                current = null;
                break;
            }
        }
        double averageDifference = difference > 0 ? ((double) difference) / totalDuration / 86400000 : 0; // In days.
        final Day day = new Day(dh.getDayOfMonth(), dh.getMonth() + 1, dh.getYear());
        if (averageDifference > 0) {
            planSeries.add(day, PLANNED_AVERAGE_DIFFERENCE_BETWEEN_TIMESHEET_AND_BOOKING); // plan average
            // (PLANNED_AVERAGE_DIFFERENCE_BETWEEN_TIMESHEET_AND_BOOKING
            // days).
            actualSeries.add(day, averageDifference);
            totalDifference += averageDifference;
            numberOfBookedDays++;
        }
        dh.add(Calendar.DATE, 1);
    }
    averageDifferenceBetweenTimesheetAndBooking = numberOfBookedDays > 0 ? new BigDecimal(totalDifference)
            .divide(new BigDecimal(numberOfBookedDays), 1, RoundingMode.HALF_UP) : BigDecimal.ZERO;
    return create(actualSeries, planSeries, shape, stroke, showAxisValues, "days");
}

From source file:sv.com.mined.sieni.controller.GestionNotasController.java

public synchronized void guardar() {
    try {/*from  w ww . ja  va 2 s .c  om*/
        FormatUtils fu = new FormatUtils();
        this.getNotaNuevo().setIdAlumno(this.getIdAlumno().getIdAlumno());
        this.getNotaNuevo().setIdEvaluacion(this.getIdEvaluacion());
        if (validarNuevo(this.getNotaNuevo())) {//valida el guardado
            HttpServletRequest req = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext()
                    .getRequest();
            LoginController loginBean = (LoginController) req.getSession().getAttribute("loginController");
            this.getNotaNuevo().setNtEstado('A');
            this.getNotaNuevo().setNtFechaIngreso(new Date());
            this.getNotaNuevo().setNtAnio(fu.getFormatedAnioInt(new Date()));
            this.getNotaNuevo().setNtDocente(loginBean.getDocente().getIdDocente());
            registrarEnBitacora("Crear", "Nota", this.getNotaNuevo().getIdNota());
            BigDecimal nota = new BigDecimal(this.getNotaNuevo().getNtCalificacion());
            this.getNotaNuevo().setNtCalificacion(nota.setScale(2, RoundingMode.HALF_UP).doubleValue());
            this.setNotaNuevo(sieniNotaFacadeRemote.createAndReturn(this.getNotaNuevo()));
            new ValidationPojo().printMsj("Nota Creada Exitosamente", FacesMessage.SEVERITY_INFO);
            this.setNotaNuevo(setInfoAlumno(this.getNotaNuevo()));
            this.getNotaList().add(this.getNotaNuevo());
            this.setNotaNuevo(new SieniNota());
            this.getNotaNuevo().setNtTipoIngreso("M");
        }
    } catch (Exception e) {
        new ValidationPojo().printMsj("Ocurri un error:" + e, FacesMessage.SEVERITY_ERROR);
        System.out.println(e.getMessage());
    }
}

From source file:org.projectforge.web.fibu.RechnungCostEditTablePanel.java

@SuppressWarnings("serial")
private WebMarkupContainer createRow(final String id, final AbstractRechnungsPositionDO position,
        final KostZuweisungDO zuweisung) {
    final WebMarkupContainer row = new WebMarkupContainer(id);
    row.setOutputMarkupId(true);//from   w ww .j a  v  a  2  s.c  om
    final Kost1FormComponent kost1 = new Kost1FormComponent("kost1",
            new PropertyModel<Kost1DO>(zuweisung, "kost1"), true);
    kost1.setLabel(new Model<String>(getString("fibu.kost1")));
    row.add(kost1);
    ajaxComponents.register(kost1);
    final Kost2FormComponent kost2 = new Kost2FormComponent("kost2",
            new PropertyModel<Kost2DO>(zuweisung, "kost2"), true);
    kost2.setLabel(new Model<String>(getString("fibu.kost2")));
    row.add(kost2);
    ajaxComponents.register(kost2);

    final MinMaxNumberField<BigDecimal> netto = new MinMaxNumberField<BigDecimal>("netto",
            new PropertyModel<BigDecimal>(zuweisung, "netto"), BigDecimal.ZERO, position.getNetSum()) {
        @SuppressWarnings({ "rawtypes", "unchecked" })
        @Override
        public IConverter getConverter(final Class type) {
            return new CurrencyConverter(position.getNetSum());
        }
    };
    netto.setLabel(new Model<String>(getString("fibu.common.netto")));
    WicketUtils.addTooltip(netto, getString("currencyConverter.percentage.help"));
    row.add(netto);
    ajaxComponents.register(netto); // Should be updated if e. g. percentage value is given.
    final Label pLabel = new Label("percentage", new Model<String>() {
        /**
         * @see org.apache.wicket.model.Model#getObject()
         */
        @Override
        public String getObject() {
            final BigDecimal percentage;
            if (NumberHelper.isZeroOrNull(position.getNetSum()) == true
                    || NumberHelper.isZeroOrNull(zuweisung.getNetto()) == true) {
                percentage = BigDecimal.ZERO;
            } else {
                percentage = zuweisung.getNetto().divide(position.getNetSum(), RoundingMode.HALF_UP);
            }
            final boolean percentageVisible = NumberHelper.isNotZero(percentage);
            if (percentageVisible == true) {
                return NumberFormatter.formatPercent(percentage);
            } else {
                return " ";
            }
        }
    });
    ajaxComponents.register(pLabel);
    row.add(pLabel);

    if (position.isKostZuweisungDeletable(zuweisung) == true) {
        final AjaxButton deleteRowButton = new AjaxButton(ButtonPanel.BUTTON_ID, form) {
            @Override
            protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
                position.deleteKostZuweisung(zuweisung.getIndex());
                final StringBuffer prependJavascriptBuf = new StringBuffer();
                prependJavascriptBuf
                        .append(WicketAjaxUtils.removeChild("costAssignmentBody", row.getMarkupId()));
                ajaxComponents.remove(row);
                rows.remove(row);
                target.prependJavaScript(prependJavascriptBuf.toString());
            }

            @Override
            protected void onError(final AjaxRequestTarget target, final Form<?> form) {
                target.add(feedbackPanel.setVisible(true));
            }
        };
        deleteRowButton.setDefaultFormProcessing(false);
        row.add(new IconButtonPanel("deleteEntry", deleteRowButton, IconType.TRASH, null).setLight());
    } else {
        // Don't show a delete button.
        row.add(new Label("deleteEntry", "&nbsp;").setEscapeModelStrings(false).setRenderBodyOnly(true));
    }
    return row;
}

From source file:com.hzq.car.CarTest.java

private void sendAndSave(String token, Date date, String url) throws ParseException, IOException {
    Integer pages = getPages(token, date, url);
    for (int i = 0; i <= pages; i++) {
        Map map = getData(token, date, url, i);
        List<Map> o = (List<Map>) ((Map) ((Map) map.get("data")).get("pager")).get("items");

        o.stream().filter(secondCar -> "".equals(secondCar.get("status"))
                && "".equals(secondCar.get("upShelf"))).forEach(data1 -> {
                    SecondCar car = new SecondCar();
                    car.setUserId(-1);//w  ww .j a v  a2s .  c o m
                    car.setMerchantId(0);
                    car.setIsMerchant(0);
                    //?
                    String brand = (String) data1.get("brand");
                    if (brand != null) {
                        Integer type = getCarType(brand);
                        car.setType(type);
                    }
                    //
                    String model = (String) data1.get("model");
                    car.setTitle(model);
                    // journey
                    String mileage = (String) data1.get("mileage");
                    BigDecimal journey = new BigDecimal(mileage).divide(new BigDecimal(10000), 2,
                            RoundingMode.HALF_UP);
                    car.setJourney(journey);

                    SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    SimpleDateFormat fmt2 = new SimpleDateFormat("yyyy-MM-dd");
                    //
                    String firstLicensePlateDate = (String) data1.get("firstLicensePlateDate");
                    try {
                        firstLicensePlateDate = fmt2.format(fmt.parse(firstLicensePlateDate));
                    } catch (ParseException e) {
                        e.printStackTrace();
                    }
                    car.setLicenseTime(firstLicensePlateDate);

                    //
                    car.setBuyTime(firstLicensePlateDate);

                    //
                    String insuranceExpiresDate = (String) data1.get("insuranceExpiresDate");
                    try {
                        if (insuranceExpiresDate != null && !"null".equals(insuranceExpiresDate)) {
                            insuranceExpiresDate = fmt2.format(fmt.parse(insuranceExpiresDate));
                        }
                    } catch (ParseException e) {
                        e.printStackTrace();
                    }
                    car.setInsuranceDeadtime(insuranceExpiresDate);
                    //??
                    String carDescribe = (String) data1.get("carDescribe");
                    car.setIntroduction(carDescribe);
                    //??? nature
                    Integer usage = 0;
                    String useType = (String) data1.get("useType");
                    if ("??".equals(useType))
                        usage = 1;
                    car.setNature(usage.toString());
                    //? exhaust
                    BigDecimal engineVolume = new BigDecimal((String) data1.get("engineVolume"));
                    car.setExhaust(engineVolume);
                    // carPicture
                    List<String> carPicture = (List<String>) data1.get("carPicture");
                    if (carPicture.size() > 0) {
                        car.setPictue(carPicture.get(0));
                        StringJoiner joiner = new StringJoiner(",");
                        carPicture.forEach(joiner::add);
                        car.setCarPic(joiner.toString());
                    }
                    // salePrice
                    Integer salePrice = Integer.parseInt((String) data1.get("salePrice"));
                    BigDecimal price = new BigDecimal(salePrice).divide(new BigDecimal(10000), 2,
                            RoundingMode.HALF_UP);
                    car.setPrice(price);
                    //?  firstLicensePlateDate
                    Integer year = Integer.parseInt(firstLicensePlateDate.substring(0, 4));
                    Integer toSet = 0;
                    int now = 2017 - year;
                    if (now <= 1)
                        toSet = 0;
                    if (now > 1 && now <= 3)
                        toSet = 1;
                    if (now > 3 && now <= 5)
                        toSet = 3;
                    if (now > 5 && now <= 8)
                        toSet = 4;
                    if (now > 8 && now <= 10)
                        toSet = 5;
                    if (now > 10)
                        toSet = 6;
                    car.setYear(toSet);
                    //
                    String color = (String) data1.get("color");
                    Integer resultColor = 15;
                    if (color != null) {
                        if (color.contains(""))
                            resultColor = 1;
                        if (color.contains(""))
                            resultColor = 2;
                        if (color.contains(""))
                            resultColor = 3;
                        if (color.contains("?"))
                            resultColor = 4;
                        if (color.contains(""))
                            resultColor = 5;
                        if (color.contains("?"))
                            resultColor = 6;
                        if (color.contains(""))
                            resultColor = 7;
                        if (color.contains(""))
                            resultColor = 8;
                        if (color.contains(""))
                            resultColor = 9;
                        if (color.contains(""))
                            resultColor = 10;
                        if (color.contains(""))
                            resultColor = 11;
                        if (color.contains(""))
                            resultColor = 12;
                        if (color.contains(""))
                            resultColor = 13;
                        if (color.contains(""))
                            resultColor = 14;
                    }
                    car.setColor(resultColor);
                    //?,?? contactPerson  phone
                    String contactPerson = (String) data1.get("contactPerson");
                    String phone = (String) data1.get("phone");
                    car.setConcactName(contactPerson);
                    car.setConcactPhone(phone);
                    //
                    Integer transferNumber = (Integer) data1.get("transferNumber");
                    car.setTimes(transferNumber);
                    //
                    try {
                        car.setCreatedAt(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
                                .parse((String) data1.get("upShelfDate")));
                    } catch (ParseException e) {
                        e.printStackTrace();
                    }
                    try {
                        secondCarMapper.insert(car);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                });

    }

}

From source file:nl.tudelft.stocktrader.derby.DerbyCustomerDAO.java

public void updateAccountBalance(int accountId, BigDecimal total) throws DAOException {
    if (logger.isDebugEnabled()) {
        logger.debug("MySQLCustomerDAO.updateAccoutBalance(int,BigDecimal)\n Account ID :" + accountId
                + "\nTotal :" + total);
    }/*from   w ww  .  j  a v  a2  s  .com*/
    PreparedStatement debitAccountStat = null;
    try {
        /* Tiago: we need to be very careful with BigDecimals. Round to 2 places */
        total = total.setScale(2, RoundingMode.HALF_UP);

        debitAccountStat = sqlConnection.prepareStatement(SQL_DEBIT_ACCOUNT);
        debitAccountStat.setBigDecimal(1, total);
        debitAccountStat.setInt(2, accountId);
        debitAccountStat.executeUpdate();

    } catch (SQLException e) {
        throw new DAOException("Excpetion is thrown when updating the account balance for accountID :"
                + accountId + " total :" + total, e);
    } finally {
        if (debitAccountStat != null) {
            try {
                debitAccountStat.close();
            } catch (SQLException e) {
                logger.debug("", e);
            }
        }
    }
}

From source file:org.yes.cart.shoppingcart.impl.DefaultAmountCalculationStrategy.java

Total calculate(final CustomerOrderDelivery orderDelivery) {

    final Total itemTotal = calculateItemTotal(new ArrayList<CartItem>(orderDelivery.getDetail()));

    final BigDecimal deliveryTax = orderDelivery.getGrossPrice().subtract(orderDelivery.getNetPrice());
    final BigDecimal deliveryListAmount;
    if (orderDelivery.isTaxExclusiveOfPrice()) {
        final BigDecimal ratio = orderDelivery.getListPrice().divide(orderDelivery.getPrice(), 10,
                RoundingMode.HALF_UP);
        deliveryListAmount = orderDelivery.getListPrice().add(multiply(deliveryTax, ratio));
    } else {//from   www.  j a  v  a 2 s  . c o  m
        deliveryListAmount = orderDelivery.getListPrice();
    }

    final Total deliveryCost = new TotalImpl(Total.ZERO, Total.ZERO, Total.ZERO, Total.ZERO, false, null,
            Total.ZERO, Total.ZERO, Total.ZERO, orderDelivery.getListPrice(), orderDelivery.getPrice(),
            orderDelivery.isPromoApplied(), orderDelivery.getAppliedPromo(), deliveryTax,
            orderDelivery.getGrossPrice(), orderDelivery.getPrice(), deliveryTax, deliveryListAmount,
            orderDelivery.getGrossPrice());

    return itemTotal.add(deliveryCost);

}

From source file:com.mythesis.userbehaviouranalysis.ProfileAnalysis.java

public static double round(double value, int places) {
    if (places < 0)
        throw new IllegalArgumentException();

    BigDecimal bd = new BigDecimal(value);
    bd = bd.setScale(places, RoundingMode.HALF_UP);
    return bd.doubleValue();
}

From source file:com.matel.service.impl.ShoppingCartServiceImpl.java

@Override
public void prepareTaxData(String state, ShoppingCartData shoppingCart) {
    States findStateByStateCode = shoppingCartDAO.findStateByStateCode(state);
    if (null != findStateByStateCode) {
        if (findStateByStateCode.getStateSalesTax() != null) {
            SalesTaxData taxData = new SalesTaxData();
            taxData.setState(findStateByStateCode);
            taxData.setTax(findStateByStateCode.getStateSalesTax().getTaxRate());
            taxData.setTaxCharge(shoppingCart.getSubTotal().multiply(taxData.getTax())
                    .divide(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP));
            shoppingCart.setSalesTaxData(taxData);
            shoppingCart/*from  w  w  w.j a  va 2  s. c  o  m*/
                    .setTotal(shoppingCart.getSubTotal().add(shoppingCart.getSalesTaxData().getTaxCharge()));
        }
    }
}

From source file:net.ceos.project.poi.annotated.bean.AutomaticPositionObjectBuilder.java

/**
 * Validate the AutomaticPositionObject passed as paratemers
 * //from   w w w .  java  2  s . c om
 * @param base
 *            the object base
 * @param toValidate
 *            the object to validate
 */
public static void validateAutomaticPositionObject(AutomaticPositionObject base,
        AutomaticPositionObject toValidate, boolean validateChilds) {

    Calendar calendar = Calendar.getInstance();
    calendar.setTime(new Date());

    Calendar calendarUnmarshal1 = Calendar.getInstance();
    calendarUnmarshal1.setTime(toValidate.getDateAttribute1());
    assertEquals(calendar.get(Calendar.YEAR), calendarUnmarshal1.get(Calendar.YEAR));
    assertEquals(calendar.get(Calendar.MONTH), calendarUnmarshal1.get(Calendar.MONTH));
    assertEquals(calendar.get(Calendar.DAY_OF_MONTH), calendarUnmarshal1.get(Calendar.DAY_OF_MONTH));
    Calendar calendarUnmarshal2 = Calendar.getInstance();
    calendarUnmarshal2.setTime(toValidate.getDateAttribute2());
    assertEquals(calendar.get(Calendar.YEAR), calendarUnmarshal2.get(Calendar.YEAR));
    assertEquals(calendar.get(Calendar.MONTH), calendarUnmarshal2.get(Calendar.MONTH));
    assertEquals(calendar.get(Calendar.DAY_OF_MONTH), calendarUnmarshal2.get(Calendar.DAY_OF_MONTH));
    Calendar calendarUnmarshal3 = Calendar.getInstance();
    calendarUnmarshal3.setTime(toValidate.getDateAttribute3());
    assertEquals(calendar.get(Calendar.YEAR), calendarUnmarshal3.get(Calendar.YEAR));
    assertEquals(calendar.get(Calendar.MONTH), calendarUnmarshal3.get(Calendar.MONTH));
    assertEquals(calendar.get(Calendar.DAY_OF_MONTH), calendarUnmarshal3.get(Calendar.DAY_OF_MONTH));

    assertEquals(base.getStringAttribute1(), toValidate.getStringAttribute1());
    assertEquals(base.getStringAttribute2(), toValidate.getStringAttribute2());
    assertEquals(base.getStringAttribute3(), toValidate.getStringAttribute3());
    assertEquals(base.getStringAttribute4(), toValidate.getStringAttribute4());
    assertEquals(base.getStringAttribute5(), toValidate.getStringAttribute5());
    assertEquals(base.getStringAttribute6(), toValidate.getStringAttribute6());
    assertEquals(base.getStringAttribute7(), toValidate.getStringAttribute7());
    assertEquals(base.getStringAttribute8(), toValidate.getStringAttribute8());
    assertEquals(base.getStringAttribute9(), toValidate.getStringAttribute9());
    assertEquals(base.getStringAttribute10(), toValidate.getStringAttribute10());
    assertEquals(base.getStringAttribute11(), toValidate.getStringAttribute11());
    assertEquals(base.getStringAttribute12(), toValidate.getStringAttribute12());

    assertEquals(base.getIntegerAttribute1(), toValidate.getIntegerAttribute1());
    assertEquals(base.getIntegerAttribute2(), toValidate.getIntegerAttribute2());
    assertEquals(base.getIntegerAttribute3(), toValidate.getIntegerAttribute3());
    assertEquals(base.getIntegerAttribute4(), toValidate.getIntegerAttribute4());
    assertEquals(base.getIntegerAttribute5(), toValidate.getIntegerAttribute5());
    assertEquals(base.getIntegerAttribute6(), toValidate.getIntegerAttribute6());
    assertEquals(base.getIntegerAttribute7(), toValidate.getIntegerAttribute7());

    assertEquals(base.getDoubleAttribute1(), toValidate.getDoubleAttribute1());
    assertEquals(base.getDoubleAttribute2(), toValidate.getDoubleAttribute2());
    assertEquals(base.getDoubleAttribute3(), toValidate.getDoubleAttribute3(), 0.001);

    assertEquals(base.getLongAttribute(), toValidate.getLongAttribute());
    assertEquals(base.getBooleanAttribute1(), toValidate.getBooleanAttribute1());
    assertEquals(base.getBooleanAttribute2(), toValidate.getBooleanAttribute2());
    assertEquals(base.getBooleanAttribute3(), toValidate.getBooleanAttribute3());
    assertEquals(base.getBooleanAttribute4(), toValidate.getBooleanAttribute4());

    if (validateChilds) {
        assertEquals(base.getJob().getJobCode(), toValidate.getJob().getJobCode());
        assertEquals(base.getJob().getJobFamily(), toValidate.getJob().getJobFamily());
        assertEquals(base.getJob().getJobName(), toValidate.getJob().getJobName());
    }

    assertEquals(base.getIntegerPrimitiveAttribute1(), toValidate.getIntegerPrimitiveAttribute1());
    assertEquals(base.getIntegerPrimitiveAttribute2(), toValidate.getIntegerPrimitiveAttribute2());
    assertEquals(base.getIntegerPrimitiveAttribute3(), toValidate.getIntegerPrimitiveAttribute3());
    assertEquals(base.getIntegerPrimitiveAttribute4(), toValidate.getIntegerPrimitiveAttribute4());
    assertEquals(base.getIntegerPrimitiveAttribute5(), toValidate.getIntegerPrimitiveAttribute5());
    assertEquals(base.getDoublePrimitiveAttribute(), toValidate.getDoublePrimitiveAttribute());
    assertEquals(base.getLongPrimitiveAttribute(), toValidate.getLongPrimitiveAttribute());
    assertEquals(base.isBooleanPrimitiveAttribute(), toValidate.isBooleanPrimitiveAttribute());

    if (validateChilds) {
        assertEquals(base.getAddressInfo().getAddress(), toValidate.getAddressInfo().getAddress());
        assertEquals(base.getAddressInfo().getNumber(), toValidate.getAddressInfo().getNumber());
        assertEquals(base.getAddressInfo().getCity(), toValidate.getAddressInfo().getCity());
        assertEquals(base.getAddressInfo().getCityCode(), toValidate.getAddressInfo().getCityCode());
        assertEquals(base.getAddressInfo().getCountry(), toValidate.getAddressInfo().getCountry());
    }

    assertEquals(base.getFloatAttribute(), toValidate.getFloatAttribute());
    assertEquals(base.getFloatPrimitiveAttribute(), toValidate.getFloatPrimitiveAttribute());
    assertEquals(base.getUnitFamily(), toValidate.getUnitFamily());
    assertEquals(base.getBigDecimalAttribute().setScale(2, RoundingMode.HALF_UP),
            toValidate.getBigDecimalAttribute().setScale(2, RoundingMode.HALF_UP));
    // TODO add new validation below
}