List of usage examples for java.lang Short valueOf
@HotSpotIntrinsicCandidate public static Short valueOf(short s)
From source file:org.codehaus.enunciate.modules.jaxws.TestJAXWSSupportDeploymentModule.java
/** * Tests the request bean template.//from w ww . j a v a 2s . co m */ public void testRequestBeanTemplate() throws Exception { EndpointInterface ei = new EndpointInterface( getDeclaration("org.codehaus.enunciate.samples.jaxws.BasicEndpointInterface")); WebMethod notConflictingMethod = null; for (WebMethod webMethod : ei.getWebMethods()) { if ("notConflictingMethod".equals(webMethod.getSimpleName())) { notConflictingMethod = webMethod; } } RequestWrapper requestWrapper = new RequestWrapper(notConflictingMethod); Class generatedClass = createWrapperClass(requestWrapper); XmlRootElement rootElementInfo = (XmlRootElement) generatedClass.getAnnotation(XmlRootElement.class); assertNotNull(rootElementInfo); assertEquals(requestWrapper.getElementNamespace(), rootElementInfo.namespace()); assertEquals(requestWrapper.getElementName(), rootElementInfo.name()); XmlType typeInfo = (XmlType) generatedClass.getAnnotation(XmlType.class); assertNotNull(typeInfo); assertEquals(requestWrapper.getElementNamespace(), typeInfo.namespace()); assertEquals(requestWrapper.getElementName(), typeInfo.name()); assertEquals(2, typeInfo.propOrder().length); assertEquals("s", typeInfo.propOrder()[0]); assertEquals("l", typeInfo.propOrder()[1]); Map<String, Object> properties = new HashMap<String, Object>(); Short shortValue = Short.valueOf((short) 123); Long longValue = Long.valueOf((long) 987654); properties.put("s", shortValue); properties.put("l", longValue); Object requestBean = generatedClass.newInstance(); BeanUtils.populate(requestBean, properties); Map description = BeanUtils.describe(requestBean); description.remove("class"); assertEquals(2, description.size()); assertEquals(shortValue.toString(), description.get("s")); assertEquals(longValue.toString(), description.get("l")); }
From source file:org.mifos.accounts.fees.struts.actionforms.FeeActionForm.java
public RecurrenceType getFeeRecurrenceTypeValue() { return StringUtils.isNotBlank(feeRecurrenceType) ? RecurrenceType.fromInt(Short.valueOf(feeRecurrenceType)) : null; }
From source file:com.workday.autoparse.json.demo.InstanceUpdaterTest.java
@Test public void testBoxedPrimitives() { TestObject testObject = new TestObject(); testObject.myBoxedBoolean = false;//w w w . ja v a2s. c o m testObject.myBoxedByte = 1; testObject.myBoxedChar = 'a'; testObject.myBoxedDouble = 1.1; testObject.myBoxedFloat = 1.1f; testObject.myBoxedInt = 1; testObject.myBoxedLong = 1L; testObject.myBoxedShort = 1; Map<String, Object> updates = new HashMap<>(); updates.put("myBoxedBoolean", true); updates.put("myBoxedByte", (byte) 2); updates.put("myBoxedChar", 'b'); updates.put("myBoxedDouble", 2.2); updates.put("myBoxedFloat", 2.2f); updates.put("myBoxedInt", 2); updates.put("myBoxedLong", 2L); updates.put("myBoxedShort", (short) 2); TestObject$$JsonObjectParser.INSTANCE.updateInstanceFromMap(testObject, updates, CONTEXT); assertEquals("myBoxedBoolean", true, testObject.myBoxedBoolean); assertEquals("myBoxedByte", Byte.valueOf((byte) 2), testObject.myBoxedByte); assertEquals("myBoxedChar", Character.valueOf('b'), testObject.myBoxedChar); assertEquals("myBoxedDouble", Double.valueOf(2.2), testObject.myBoxedDouble); assertEquals("myBoxedFloat", Float.valueOf(2.2f), testObject.myBoxedFloat); assertEquals("myBoxedInt", Integer.valueOf(2), testObject.myBoxedInt); assertEquals("myBoxedLong", Long.valueOf(2L), testObject.myBoxedLong); assertEquals("myBoxedShort", Short.valueOf((short) 2), testObject.myBoxedShort); }
From source file:com.okwei.walletportal.web.CompanyAccountController.java
@ResponseBody @RequestMapping(value = "/save", method = RequestMethod.POST) public String addOrUpdateCompanyAccount(UPublicBanks bc, Model model) { LoginUser user = super.getLoginUser(); if (bc == null) { bc = new UPublicBanks(); }//w w w .ja v a 2 s . c om try { boolean flag = false; UPublicBanks accountInfo = companyAccountService.getCompanyAccount(user.getWeiID()); if (accountInfo != null) { flag = true; bc.setPid(accountInfo.getPid()); bc.setProcessTime(accountInfo.getProcessTime()); //? ?? if (Short.valueOf(PublicBanksStatusEnum.Applying.toString()).equals(accountInfo.getState())) { return AjaxUtil.ajaxFail("?????!"); } else if (Short.valueOf(PublicBanksStatusEnum.Pass.toString()).equals(accountInfo.getState())) { bc.setState(Short.valueOf(PublicBanksStatusEnum.Pass.toString())); } else { bc.setState(Short.valueOf(PublicBanksStatusEnum.Applying.toString())); } } String msg = companyAccountService.addOrUpdateCompanyAccount(bc, user, flag); return AjaxUtil.ajaxSuccess(msg); } catch (Exception e) { logger.error("??" + e.getMessage()); return AjaxUtil.ajaxFail("?"); } }
From source file:org.mifos.accounts.loan.struts.action.AccountStatusAction.java
@TransactionDemarcate(joinToken = true) public ActionForward getLoanOfficers(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse httpservletresponse) throws Exception { AccountStatusActionForm accountStatusActionForm = (AccountStatusActionForm) form; Short officeId = Short.valueOf(accountStatusActionForm.getOfficeId()); ChangeAccountStatusDto changeAccountStatusDto = this.loanAccountServiceFacade .retrieveLoanOfficerDetailsForBranch(officeId); SessionUtils.setCollectionAttribute(LoanConstants.LOAN_OFFICERS, changeAccountStatusDto.getLoanOfficers(), request);/*from w ww . j a v a 2s .c o m*/ if (officeId != null) { AccountStateEntity accountStateEntity = legacyMasterDao.getPersistentObject(AccountStateEntity.class, changeAccountStatusDto.getAccountState()); SessionUtils.setAttribute(LoanConstants.LOANACCOUNTSTAES, accountStateEntity, request); } return mapping.findForward(ActionForwards.changeAccountStatus_success.toString()); }
From source file:org.mifos.application.servicefacade.LoanServiceFacadeWebTier.java
private MeetingBO createNewMeetingForRepaymentDay(DateTime disbursementDate, final LoanAccountActionForm loanAccountActionForm, final CustomerBO customer) throws NumberFormatException, MeetingException { MeetingBO newMeetingForRepaymentDay = null; Short recurrenceId = Short.valueOf(loanAccountActionForm.getRecurrenceId()); final int minDaysInterval = new ConfigurationPersistence() .getConfigurationKeyValueInteger(MIN_DAYS_BETWEEN_DISBURSAL_AND_FIRST_REPAYMENT_DAY).getValue(); final Date repaymentStartDate = disbursementDate.plusDays(minDaysInterval).toDate(); if (RecurrenceType.WEEKLY.getValue().equals(recurrenceId)) { newMeetingForRepaymentDay = new MeetingBO( WeekDay.getWeekDay(Short.valueOf(loanAccountActionForm.getWeekDay())), Short.valueOf(loanAccountActionForm.getRecurWeek()), repaymentStartDate, MeetingType.LOAN_INSTALLMENT, customer.getCustomerMeeting().getMeeting().getMeetingPlace()); } else if (RecurrenceType.MONTHLY.getValue().equals(recurrenceId)) { if (loanAccountActionForm.getMonthType().equals("1")) { newMeetingForRepaymentDay = new MeetingBO(Short.valueOf(loanAccountActionForm.getMonthDay()), Short.valueOf(loanAccountActionForm.getDayRecurMonth()), repaymentStartDate, MeetingType.LOAN_INSTALLMENT, customer.getCustomerMeeting().getMeeting().getMeetingPlace()); } else {// w ww. ja v a 2 s. c o m newMeetingForRepaymentDay = new MeetingBO(Short.valueOf(loanAccountActionForm.getMonthWeek()), Short.valueOf(loanAccountActionForm.getRecurMonth()), repaymentStartDate, MeetingType.LOAN_INSTALLMENT, customer.getCustomerMeeting().getMeeting().getMeetingPlace(), Short.valueOf(loanAccountActionForm.getMonthRank())); } } return newMeetingForRepaymentDay; }
From source file:com.aol.advertising.qiao.util.ContextUtils.java
protected static Object stringToValueByType(String str, DataType type) { switch (type) { case STRING:/*from w w w . jav a2s.c o m*/ return str; case INTEGER: return Integer.parseInt(str); case CLZ_INTEGER: return Integer.valueOf(str); case SHORT: return Short.parseShort(str); case CLZ_SHORT: return Short.valueOf(str); case LONG: return Long.parseLong(str); case CLZ_LONG: return Long.valueOf(str); case FLOAT: return Float.parseFloat(str); case CLZ_FLOAT: return Float.valueOf(str); case DOUBLE: return Double.parseDouble(str); case CLZ_DOUBLE: return Double.valueOf(str); case BOOLEAN: return Boolean.parseBoolean(str); case CLZ_BOOLEAN: return Boolean.valueOf(str); default: // default to string return str; } }
From source file:org.esco.grouperui.tools.property.PropertyFinder.java
/** * @param <T>//from w ww.j av a 2s . c o m * le type du retour * @param theType * le type de retour de la valeur. La liste des types se trouve * dans la classe : TypeFinder * @return la valeur trouve dans un property */ @SuppressWarnings("unchecked") public final <T> T deType(final Class<T> theType) { Validate.notEmpty(new Object[] { theType }, "Le type de retour ne peut pas tre vide"); // PropertyFinder.LOGGER.debug("Appel de deType avec le parametre " // + theType.getClass().getCanonicalName()); T resulat = null; PropertiesConfiguration configIntoSearch = this.findPropertiesFile(); if (configIntoSearch == null && this.defaultValue == null) { throw new ESCOTechnicalException("Aucun fichier n'a t trouv pour la cl " + this.keyToFind); } else { // /Conversion dans le type voulu du resultat de recherche if ("java.lang.String".equals(theType.getName())) { resulat = (T) configIntoSearch.getString(this.keyToFind, this.defaultValue); } else if ("java.math.BigInteger".equals(theType.getName())) { resulat = (T) configIntoSearch.getBigInteger(this.keyToFind, new BigInteger(this.defaultValue)); } else if ("java.math.BigDecimal".equals(theType.getName())) { resulat = (T) configIntoSearch.getBigDecimal(this.keyToFind, new BigDecimal(this.defaultValue)); } else if ("java.lang.Boolean".equals(theType.getName())) { resulat = (T) configIntoSearch.getBoolean(this.keyToFind, Boolean.valueOf(this.defaultValue)); } else if ("java.lang.Byte".equals(theType.getName())) { resulat = (T) configIntoSearch.getByte(this.keyToFind, Byte.valueOf(this.defaultValue)); } else if ("java.lang.Double".equals(theType.getName())) { resulat = (T) new Double( configIntoSearch.getDouble(this.keyToFind, Double.valueOf(this.defaultValue))); } else if ("java.lang.Float".equals(theType.getName())) { resulat = (T) new Float( configIntoSearch.getFloat(this.keyToFind, Float.valueOf(this.defaultValue))); } else if ("java.lang.Integer".equals(theType.getName())) { resulat = (T) Integer .valueOf(configIntoSearch.getInt(this.keyToFind, Integer.valueOf(this.defaultValue))); } else if ("java.util.List".equals(theType.getName())) { resulat = (T) configIntoSearch.getList(this.keyToFind, Arrays.asList(this.defaultValue.split("|"))); } else if ("java.lang.Long".equals(theType.getName())) { resulat = (T) configIntoSearch.getLong(this.keyToFind, Long.valueOf(this.defaultValue)); } else if ("java.lang.Short".equals(theType.getName())) { resulat = (T) configIntoSearch.getShort(this.keyToFind, Short.valueOf(this.defaultValue)); } else if ("java.lang.String[]".equals(theType.getName())) { resulat = (T) configIntoSearch.getStringArray(this.keyToFind); } else { resulat = (T) configIntoSearch.getString(this.keyToFind, this.defaultValue); } } return resulat; }
From source file:org.mifos.accounts.fees.struts.actionforms.FeeActionForm.java
public FeeStatus getFeeStatusValue() { return StringUtils.isNotBlank(feeStatus) ? FeeStatus.getFeeStatus(Short.valueOf(feeStatus)) : null; }
From source file:org.mifos.customers.office.struts.action.OffAction.java
@TransactionDemarcate(joinToken = true) public ActionForward loadParent(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception { OffActionForm offActionForm = (OffActionForm) form; String officeLevel = request.getParameter("officeLevel"); if (StringUtils.isNotBlank(officeLevel)) { offActionForm.setOfficeLevel(officeLevel); List<OfficeDetailsDto> parents = this.officeServiceFacade .retrieveActiveParentOffices(Short.valueOf(officeLevel)); OfficeDto office = (OfficeDto) SessionUtils.getAttribute(OfficeConstants.OFFICE_DTO, request); if (offActionForm.getInput() != null && offActionForm.getInput().equals("edit") && office != null) { for (int i = 0; i < parents.size(); i++) { OfficeDetailsDto view = parents.get(i); if (view.getOfficeId().equals(office.getOfficeId())) { parents.remove(view); }/*from w ww .ja va 2 s. co m*/ } } SessionUtils.setCollectionAttribute(OfficeConstants.PARENTS, parents, request); } if (offActionForm.getInput() != null && offActionForm.getInput().equals("edit")) { return mapping.findForward(ActionForwards.edit_success.toString()); } return mapping.findForward(ActionForwards.load_success.toString()); }