List of usage examples for java.lang Byte valueOf
public static Byte valueOf(String s) throws NumberFormatException
From source file:org.op4j.functions.FnBigInteger.java
/** * <p>/* w ww .j a v a 2 s . c o m*/ * It divides the target element by the given divisor and returns its result * </p> * * @param divisor the divisor * @return the result of target/divisor */ public final static Function<BigInteger, BigInteger> divideBy(byte divisor) { return divideBy(Byte.valueOf(divisor)); }
From source file:org.eclipse.kapua.app.console.server.GwtDeviceManagementServiceImpl.java
private Object[] getObjectValue(GwtConfigParameter gwtConfigParam, String[] defaultValues) { List<Object> values = new ArrayList<Object>(); GwtConfigParameterType type = gwtConfigParam.getType(); switch (type) { case BOOLEAN: for (String value : defaultValues) { values.add(Boolean.valueOf(value)); }//w ww . j av a2 s. co m return values.toArray(new Boolean[] {}); case BYTE: for (String value : defaultValues) { values.add(Byte.valueOf(value)); } return values.toArray(new Byte[] {}); case CHAR: for (String value : defaultValues) { values.add(new Character(value.charAt(0))); } return values.toArray(new Character[] {}); case DOUBLE: for (String value : defaultValues) { values.add(Double.valueOf(value)); } return values.toArray(new Double[] {}); case FLOAT: for (String value : defaultValues) { values.add(Float.valueOf(value)); } return values.toArray(new Float[] {}); case INTEGER: for (String value : defaultValues) { values.add(Integer.valueOf(value)); } return values.toArray(new Integer[] {}); case LONG: for (String value : defaultValues) { values.add(Long.valueOf(value)); } return values.toArray(new Long[] {}); case SHORT: for (String value : defaultValues) { values.add(Short.valueOf(value)); } return values.toArray(new Short[] {}); case PASSWORD: for (String value : defaultValues) { values.add(new Password(value)); } return values.toArray(new Password[] {}); case STRING: default: return defaultValues; } }
From source file:org.apache.openjpa.kernel.StateManagerImpl.java
public Object fetchField(int field, boolean transitions) { FieldMetaData fmd = _meta.getField(field); if (fmd == null) throw new UserException(_loc.get("no-field", String.valueOf(field), getManagedInstance().getClass())) .setFailedObject(getManagedInstance()); // do normal state transitions if (!fmd.isPrimaryKey() && transitions) accessingField(field);//from ww w. java 2s .c o m switch (fmd.getDeclaredTypeCode()) { case JavaTypes.STRING: return fetchStringField(field); case JavaTypes.OBJECT: return fetchObjectField(field); case JavaTypes.BOOLEAN: return (fetchBooleanField(field)) ? Boolean.TRUE : Boolean.FALSE; case JavaTypes.BYTE: return Byte.valueOf(fetchByteField(field)); case JavaTypes.CHAR: return Character.valueOf(fetchCharField(field)); case JavaTypes.DOUBLE: return Double.valueOf(fetchDoubleField(field)); case JavaTypes.FLOAT: return Float.valueOf(fetchFloatField(field)); case JavaTypes.INT: return fetchIntField(field); case JavaTypes.LONG: return fetchLongField(field); case JavaTypes.SHORT: return Short.valueOf(fetchShortField(field)); default: return fetchObjectField(field); } }
From source file:org.apache.hadoop.hbase.HTableDescriptor.java
/** * @see java.lang.Object#hashCode()/*from w w w.java 2 s . c o m*/ */ @Override public int hashCode() { int result = this.name.hashCode(); result ^= Byte.valueOf(TABLE_DESCRIPTOR_VERSION).hashCode(); if (this.families != null && this.families.size() > 0) { for (HColumnDescriptor e : this.families.values()) { result ^= e.hashCode(); } } result ^= values.hashCode(); result ^= configuration.hashCode(); return result; }
From source file:org.op4j.functions.FnLong.java
/** * <p>//from w w w . j a v a 2 s . c o m * It subtracts the given number from the target and returns the result * </p> * * @param subtract number to be subtracted from the target * @return the result of the subtraction */ public final static Function<Long, Long> subtract(byte subtract) { return subtract(Byte.valueOf(subtract)); }
From source file:org.op4j.functions.FnFloat.java
/** * <p>//from w w w .j a va 2s. co m * It subtracts the given number from the target and returns the result * </p> * * @param subtract number to be subtracted from the target * @return the result of the subtraction */ public final static Function<Float, Float> subtract(byte subtract) { return subtract(Byte.valueOf(subtract)); }
From source file:org.op4j.functions.FnShort.java
/** * <p>/*from w w w. j av a2 s . c om*/ * It subtracts the given number from the target and returns the result * </p> * * @param subtract number to be subtracted from the target * @return the result of the subtraction */ public final static Function<Short, Short> subtract(byte subtract) { return subtract(Byte.valueOf(subtract)); }
From source file:com.turborep.turbotracker.banking.controller.BankingController.java
@RequestMapping(value = "/saveTransactionDetails", method = RequestMethod.POST) public @ResponseBody Integer saveTransactionDetails( @RequestParam(value = "transactionDetails[]", required = false) ArrayList<?> theTransactionDetails, @RequestParam(value = "editamount", required = false) BigDecimal editamount, @RequestParam(value = "oldamount", required = false) BigDecimal oldamount, @RequestParam(value = "currentbalance", required = false) BigDecimal currentbalance, @RequestParam(value = "resultingbalance", required = false) BigDecimal resultingbalance, @RequestParam(value = "NewMoTypeId", required = false) String NewMoTypeId, @RequestParam(value = "coFiscalPeriodId", required = false) Integer periodID, @RequestParam(value = "coFiscalYearId", required = false) Integer yearID, @RequestParam(value = "gridData", required = false) String gridData, HttpSession session, HttpServletResponse theResponse, HttpServletRequest request) throws IOException, ParseException, BankingException, CompanyException, MessagingException { Motransaction aMotransaction = new Motransaction(); Byte aBigDecimal = 0;// www. j a va 2 s. c om boolean accountStatus = false; Byte printed = 0; Byte void_ = 0; Byte tempRec = 0; String aTypeID = ""; Date transdate = null; Date currdate = null; boolean futureornot = true; int motransiid = 0; String DepositType = "Single"; UserBean aUserBean; aUserBean = (UserBean) session.getAttribute(SessionConstants.USER); try { if (theTransactionDetails.get(0) != "" && theTransactionDetails.get(0) != null) { aMotransaction.setTransactionDate( DateUtils.parseDate((String) theTransactionDetails.get(0), new String[] { "MM/dd/yyyy" })); //transdate=DateUtils.parseDate( (String) theTransactionDetails.get(0), new String[]{"yyyy-MM-dd"}); Date myDate = new Date(); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); String dateAsString_format = simpleDateFormat.format(myDate); if (myDate.compareTo(aMotransaction.getTransactionDate()) < 0 || myDate.compareTo(aMotransaction.getTransactionDate()) == 0) { //System.out.println("transdate date is greater than todate"); futureornot = false; } else { futureornot = true; //System.out.println("transdate date is lesser than todate"); } } if (theTransactionDetails.get(1) != "" && theTransactionDetails.get(1) != null) { aTypeID = theTransactionDetails.get(1).toString(); aMotransaction.setMoTransactionTypeId(Short.parseShort(aTypeID)); } if (theTransactionDetails.get(2) != "" && theTransactionDetails.get(2) != null) { aMotransaction.setReference((String) theTransactionDetails.get(2)); } if (theTransactionDetails.get(3) != "" && theTransactionDetails.get(3) != null) { String aDescription = theTransactionDetails.get(3).toString().replaceAll("\n", "").replaceAll("\t", ""); aMotransaction.setDescription(aDescription); } if (theTransactionDetails.get(4) != "" && theTransactionDetails.get(4) != null) { String aCoAccountID = theTransactionDetails.get(4).toString(); aMotransaction.setCoAccountId(Integer.parseInt(aCoAccountID)); System.out.println("===========>>=" + aCoAccountID); if (!aCoAccountID.equals("-1")) accountStatus = true; } if (theTransactionDetails.get(5) != "" && theTransactionDetails.get(5) != null) { String aReconcil = theTransactionDetails.get(5).toString(); aMotransaction.setReconciled(Byte.valueOf(aReconcil)); } if (theTransactionDetails.get(6) != "" && theTransactionDetails.get(6) != null) { String aAmount = ""; String theAmount = ""; if (theTransactionDetails.get(6).equals("0")) { aAmount = "0"; } else { if (aTypeID.equalsIgnoreCase("0")) { aAmount = theTransactionDetails.get(6).toString(); } else { aAmount = "-" + theTransactionDetails.get(6).toString(); } } BigDecimal aPrice = new BigDecimal(aAmount); aMotransaction.setAmount(aPrice); } if (theTransactionDetails.get(9) != "" && theTransactionDetails.get(9) != null) { String aMoAccountID = theTransactionDetails.get(9).toString(); aMotransaction.setMoAccountId(Integer.valueOf(aMoAccountID)); } String aOperation = theTransactionDetails.get(7).toString(); Motransaction mts = bankingAccountsService.getResultingBalance(aMotransaction.getMoAccountId()); currentbalance = mts.getCurrentbalance(); String aMemo = theTransactionDetails.get(11).toString(); String aRxMasterID = theTransactionDetails.get(12).toString(); String aRxAddressID = theTransactionDetails.get(13).toString(); aMotransaction.setDirectDeposit(aBigDecimal); aMotransaction.setPrinted(printed); aMotransaction.setVoid_(void_); aMotransaction.setTempRec(tempRec); System.out.println("aOperation---" + aMotransaction.getMoAccountId() + "--->" + aOperation); //aMotransaction.setBalance(currentbalance); MoAccount moAccount = new MoAccount(); moAccount.setMoAccountId(aMotransaction.getMoAccountId()); moAccount.setOper(aOperation); /** * Created By :Leo Description:New Check Creation * * Date:28-10-2014 * * */ /*---------------------------New Check----------------------*/ if (aOperation.equalsIgnoreCase("new")) { moAccount.setMoTransactionTypeId(aMotransaction.getMoTransactionTypeId()); BigDecimal balance = new BigDecimal("0.00"); if (aMotransaction.getMoTransactionTypeId() == 0) { moAccount.setAdditions(aMotransaction.getAmount()); //Commented by: Leo purpose:BID#1326 /*if(futureornot){ balance=currentbalance.add(aMotransaction.getAmount()); }else{ balance=currentbalance; }*/ balance = currentbalance.add(aMotransaction.getAmount()); } else { moAccount.setSubtractions(aMotransaction.getAmount()); /*if(futureornot){ balance=currentbalance.add(aMotransaction.getAmount()); }else{ balance=currentbalance; }*/ balance = currentbalance.add(aMotransaction.getAmount()); } aMotransaction.setMemo(aMemo); aMotransaction.setRxMasterId(Integer.parseInt(aRxMasterID)); if (aRxAddressID != "" && aRxAddressID != null) aMotransaction.setRxAddressId( bankingAccountsService.getRxAddressIDfmRxmasterID(Integer.parseInt(aRxMasterID))); motransiid = bankingAccountsService.createtransactionBanknewCheck(moAccount, aMotransaction, DepositType, yearID, periodID, aUserBean.getFullName(), balance, accountStatus, motransiid, aOperation, "", false, null, null, "", null, "", ""); } /*---------------------------New Transaction----------------------*/ else if (aOperation.equalsIgnoreCase("add")) { moAccount.setMoTransactionTypeId(aMotransaction.getMoTransactionTypeId()); BigDecimal balance = new BigDecimal("0.00"); if (aMotransaction.getMoTransactionTypeId() == 0) { moAccount.setAdditions(aMotransaction.getAmount()); /*if(futureornot){ balance=currentbalance.add(aMotransaction.getAmount()); }else{ balance=currentbalance; }*/ balance = currentbalance.add(aMotransaction.getAmount()); } else { moAccount.setSubtractions(aMotransaction.getAmount()); /*if(futureornot){ balance=currentbalance.add(aMotransaction.getAmount()); }else{ balance=currentbalance; }*/ balance = currentbalance.add(aMotransaction.getAmount()); } motransiid = bankingAccountsService.createtransactionBanknewCheck(moAccount, aMotransaction, DepositType, yearID, periodID, aUserBean.getFullName(), balance, accountStatus, motransiid, aOperation, gridData, false, null, null, "", null, "", ""); } /*---------------------------Edit Transaction----------------------*/ else if (aOperation.equalsIgnoreCase("edit")) { Motransaction M1 = new Motransaction(); M1 = aMotransaction; boolean motransaceditStatus = false; BigDecimal balance = new BigDecimal("0.00"); short transtypid = M1.getMoTransactionTypeId(); BigDecimal amt = M1.getAmount(); moAccount.setMoTransactionTypeId(M1.getMoTransactionTypeId()); if (theTransactionDetails.get(8) != "" && theTransactionDetails.get(8) != null) { String aTransID = theTransactionDetails.get(8).toString(); M1.setMoTransactionId(Integer.valueOf(aTransID)); } M1.setStatus(true); Motransaction checkforTestMotrans = new Motransaction(); checkforTestMotrans = bankingAccountsService .getMOtransactionDetails(aMotransaction.getMoTransactionId()); if (checkforTestMotrans != null) { if (!(M1.getMoTransactionTypeId().equals(checkforTestMotrans.getMoTransactionTypeId()))) { motransaceditStatus = true; } else if (!M1.getTransactionDate().equals(checkforTestMotrans.getTransactionDate())) { motransaceditStatus = true; } else if (!(M1.getReference() == null ? "" : M1.getReference()) .equals(checkforTestMotrans.getReference())) { motransaceditStatus = true; } else if (!(M1.getDescription() == null ? "" : M1.getDescription()) .equals(checkforTestMotrans.getDescription())) { motransaceditStatus = true; } else if (!M1.getReconciled().equals(checkforTestMotrans.getReconciled())) { motransaceditStatus = true; } else if (!M1.getAmount().equals(checkforTestMotrans.getAmount())) { motransaceditStatus = true; } else if (!M1.getCoAccountId().equals(checkforTestMotrans.getCoAccountId())) { motransaceditStatus = true; } } motransiid = bankingAccountsService.createtransactionBanknewCheck(moAccount, M1, DepositType, yearID, periodID, aUserBean.getFullName(), balance, accountStatus, motransiid, aOperation, gridData, futureornot, currentbalance, oldamount, NewMoTypeId, amt, aMemo, aRxMasterID); } /*---------------------------Delete Transaction----------------------*/ else if (aOperation.equalsIgnoreCase("delete")) { Motransaction dM1 = new Motransaction(); dM1 = aMotransaction; if (theTransactionDetails.get(8) != "" && theTransactionDetails.get(8) != null) { String aTransID = theTransactionDetails.get(8).toString(); dM1.setMoTransactionId(Integer.valueOf(aTransID)); } if (aRxMasterID != "" && aRxMasterID != null) dM1.setRxMasterId(Integer.parseInt(aRxMasterID)); if (aRxAddressID != "" && aRxAddressID != null) dM1.setRxAddressId(Integer.parseInt(aRxAddressID)); moAccount.setMoAccountId(dM1.getMoAccountId()); moAccount.setMoTransactionTypeId(dM1.getMoTransactionTypeId()); dM1.setStatus(true); bankingAccountsService.createtransactionBanknewCheck(moAccount, dM1, DepositType, yearID, periodID, aUserBean.getFullName(), BigDecimal.ZERO, accountStatus, motransiid, aOperation, "", futureornot, currentbalance, null, "", null, "", ""); } else if (aOperation.equalsIgnoreCase("void")) { Motransaction vM1 = new Motransaction(); vM1 = aMotransaction; if (theTransactionDetails.get(8) != "" && theTransactionDetails.get(8) != null) { String aTransID = theTransactionDetails.get(8).toString(); vM1.setMoTransactionId(Integer.valueOf(aTransID)); } if (theTransactionDetails.get(10) != "" && theTransactionDetails.get(10) != null) { String aVoid = theTransactionDetails.get(10).toString(); vM1.setVoid_(Byte.valueOf(aVoid)); } if (aRxMasterID != "" && aRxMasterID != null) vM1.setRxMasterId(Integer.parseInt(aRxMasterID)); if (aRxAddressID != "" && aRxAddressID != null) vM1.setRxAddressId(Integer.parseInt(aRxAddressID)); vM1.setStatus(true); moAccount.setMoAccountId(vM1.getMoAccountId()); moAccount.setMoTransactionTypeId(vM1.getMoTransactionTypeId()); bankingAccountsService.createtransactionBanknewCheck(moAccount, vM1, DepositType, yearID, periodID, aUserBean.getFullName(), BigDecimal.ZERO, accountStatus, motransiid, aOperation, "", futureornot, currentbalance, null, "", null, "", ""); } } catch (BankingException e) { logger.error(e.getMessage(), e); theResponse.sendError(e.getItsErrorStatusCode(), e.getMessage()); sendTransactionException("<b>MoTransactionID:</b>" + aMotransaction.getMoTransactionId() + "<br><b>RxMasterID:</b>" + aMotransaction.getRxMasterId(), "Banking.", e, session, request); } return motransiid; }
From source file:org.op4j.functions.FnBigInteger.java
/** * <p>// w w w .jav a2 s . co m * It performs a module operation and returns the value * of (input mod module) which is always positive * (whereas remainder is not) * </p> * * @param module the module * @return the result of (input mod module) */ public final static Function<BigInteger, BigInteger> module(byte module) { return new Module(fromNumber(Byte.valueOf(module))); }
From source file:org.op4j.functions.FnInteger.java
/** * <p>//from w w w. j av a2 s. c o m * It subtracts the given number from the target and returns the result * </p> * * @param subtract number to be subtracted from the target * @return the result of the subtraction */ public final static Function<Integer, Integer> subtract(byte subtract) { return subtract(Byte.valueOf(subtract)); }