List of usage examples for java.lang Short valueOf
@HotSpotIntrinsicCandidate public static Short valueOf(short s)
From source file:org.broadleafcommerce.openadmin.server.service.persistence.module.provider.BasicFieldPersistenceProvider.java
@Override public FieldProviderResponse populateValue(PopulateValueRequest populateValueRequest, Serializable instance) { if (!canHandlePersistence(populateValueRequest, instance)) { return FieldProviderResponse.NOT_HANDLED; }/* w ww. ja v a 2 s . c o m*/ boolean dirty = false; try { Property prop = populateValueRequest.getProperty(); Object origValue = populateValueRequest.getFieldManager().getFieldValue(instance, prop.getName()); switch (populateValueRequest.getMetadata().getFieldType()) { case BOOLEAN: boolean v = Boolean.valueOf(populateValueRequest.getRequestedValue()); prop.setOriginalValue(String.valueOf(origValue)); prop.setOriginalDisplayValue(prop.getOriginalValue()); try { dirty = checkDirtyState(populateValueRequest, instance, v); populateValueRequest.getFieldManager().setFieldValue(instance, populateValueRequest.getProperty().getName(), v); } catch (IllegalArgumentException e) { char c = v ? 'Y' : 'N'; dirty = checkDirtyState(populateValueRequest, instance, c); populateValueRequest.getFieldManager().setFieldValue(instance, populateValueRequest.getProperty().getName(), c); } break; case DATE: Date date = (Date) populateValueRequest.getFieldManager().getFieldValue(instance, populateValueRequest.getProperty().getName()); String oldValue = null; if (date != null) { oldValue = populateValueRequest.getDataFormatProvider().getSimpleDateFormatter().format(date); } prop.setOriginalValue(oldValue); prop.setOriginalDisplayValue(prop.getOriginalValue()); dirty = !StringUtils.equals(oldValue, populateValueRequest.getRequestedValue()); populateValueRequest.getFieldManager().setFieldValue(instance, populateValueRequest.getProperty().getName(), populateValueRequest.getDataFormatProvider() .getSimpleDateFormatter().parse(populateValueRequest.getRequestedValue())); break; case DECIMAL: if (origValue != null) { prop.setOriginalValue(String.valueOf(origValue)); prop.setOriginalDisplayValue(prop.getOriginalValue()); } if (BigDecimal.class.isAssignableFrom(populateValueRequest.getReturnType())) { DecimalFormat format = populateValueRequest.getDataFormatProvider().getDecimalFormatter(); format.setParseBigDecimal(true); BigDecimal val = (BigDecimal) format.parse(populateValueRequest.getRequestedValue()); dirty = checkDirtyState(populateValueRequest, instance, val); populateValueRequest.getFieldManager().setFieldValue(instance, populateValueRequest.getProperty().getName(), val); format.setParseBigDecimal(false); } else { Double val = populateValueRequest.getDataFormatProvider().getDecimalFormatter() .parse(populateValueRequest.getRequestedValue()).doubleValue(); dirty = checkDirtyState(populateValueRequest, instance, val); populateValueRequest.getFieldManager().setFieldValue(instance, populateValueRequest.getProperty().getName(), val); } break; case MONEY: if (origValue != null) { prop.setOriginalValue(String.valueOf(origValue)); prop.setOriginalDisplayValue(prop.getOriginalValue()); } if (BigDecimal.class.isAssignableFrom(populateValueRequest.getReturnType())) { DecimalFormat format = populateValueRequest.getDataFormatProvider().getDecimalFormatter(); format.setParseBigDecimal(true); BigDecimal val = (BigDecimal) format.parse(populateValueRequest.getRequestedValue()); dirty = checkDirtyState(populateValueRequest, instance, val); populateValueRequest.getFieldManager().setFieldValue(instance, populateValueRequest.getProperty().getName(), val); format.setParseBigDecimal(true); } else if (Double.class.isAssignableFrom(populateValueRequest.getReturnType())) { Double val = populateValueRequest.getDataFormatProvider().getDecimalFormatter() .parse(populateValueRequest.getRequestedValue()).doubleValue(); dirty = checkDirtyState(populateValueRequest, instance, val); LOG.warn("The requested Money field is of type double and could result in a loss of precision." + " Broadleaf recommends that the type of all Money fields are 'BigDecimal' in order to avoid" + " this loss of precision that could occur."); populateValueRequest.getFieldManager().setFieldValue(instance, populateValueRequest.getProperty().getName(), val); } else { DecimalFormat format = populateValueRequest.getDataFormatProvider().getDecimalFormatter(); format.setParseBigDecimal(true); BigDecimal val = (BigDecimal) format.parse(populateValueRequest.getRequestedValue()); dirty = checkDirtyState(populateValueRequest, instance, val); populateValueRequest.getFieldManager().setFieldValue(instance, populateValueRequest.getProperty().getName(), new Money(val)); format.setParseBigDecimal(false); } break; case INTEGER: if (origValue != null) { prop.setOriginalValue(String.valueOf(origValue)); prop.setOriginalDisplayValue(prop.getOriginalValue()); } if (int.class.isAssignableFrom(populateValueRequest.getReturnType()) || Integer.class.isAssignableFrom(populateValueRequest.getReturnType())) { dirty = checkDirtyState(populateValueRequest, instance, Integer.valueOf(populateValueRequest.getRequestedValue())); populateValueRequest.getFieldManager().setFieldValue(instance, populateValueRequest.getProperty().getName(), Integer.valueOf(populateValueRequest.getRequestedValue())); } else if (byte.class.isAssignableFrom(populateValueRequest.getReturnType()) || Byte.class.isAssignableFrom(populateValueRequest.getReturnType())) { dirty = checkDirtyState(populateValueRequest, instance, Byte.valueOf(populateValueRequest.getRequestedValue())); populateValueRequest.getFieldManager().setFieldValue(instance, populateValueRequest.getProperty().getName(), Byte.valueOf(populateValueRequest.getRequestedValue())); } else if (short.class.isAssignableFrom(populateValueRequest.getReturnType()) || Short.class.isAssignableFrom(populateValueRequest.getReturnType())) { dirty = checkDirtyState(populateValueRequest, instance, Short.valueOf(populateValueRequest.getRequestedValue())); populateValueRequest.getFieldManager().setFieldValue(instance, populateValueRequest.getProperty().getName(), Short.valueOf(populateValueRequest.getRequestedValue())); } else if (long.class.isAssignableFrom(populateValueRequest.getReturnType()) || Long.class.isAssignableFrom(populateValueRequest.getReturnType())) { dirty = checkDirtyState(populateValueRequest, instance, Long.valueOf(populateValueRequest.getRequestedValue())); populateValueRequest.getFieldManager().setFieldValue(instance, populateValueRequest.getProperty().getName(), Long.valueOf(populateValueRequest.getRequestedValue())); } break; case CODE: // **NOTE** We want to fall through in this case, do not break. setNonDisplayableValues(populateValueRequest); case STRING: case HTML_BASIC: case HTML: case EMAIL: if (origValue != null) { prop.setOriginalValue(String.valueOf(origValue)); prop.setOriginalDisplayValue(prop.getOriginalValue()); } dirty = checkDirtyState(populateValueRequest, instance, populateValueRequest.getRequestedValue()); populateValueRequest.getFieldManager().setFieldValue(instance, populateValueRequest.getProperty().getName(), populateValueRequest.getRequestedValue()); break; case FOREIGN_KEY: { if (origValue != null) { prop.setOriginalValue(String.valueOf(origValue)); } Serializable foreignInstance; if (StringUtils.isEmpty(populateValueRequest.getRequestedValue())) { foreignInstance = null; } else { if (SupportedFieldType.INTEGER.toString() .equals(populateValueRequest.getMetadata().getSecondaryType().toString())) { foreignInstance = populateValueRequest.getPersistenceManager().getDynamicEntityDao() .retrieve(Class.forName(populateValueRequest.getMetadata().getForeignKeyClass()), Long.valueOf(populateValueRequest.getRequestedValue())); } else { foreignInstance = populateValueRequest.getPersistenceManager().getDynamicEntityDao() .retrieve(Class.forName(populateValueRequest.getMetadata().getForeignKeyClass()), populateValueRequest.getRequestedValue()); } } if (Collection.class.isAssignableFrom(populateValueRequest.getReturnType())) { Collection collection; try { collection = (Collection) populateValueRequest.getFieldManager().getFieldValue(instance, populateValueRequest.getProperty().getName()); } catch (FieldNotAvailableException e) { throw new IllegalArgumentException(e); } if (!collection.contains(foreignInstance)) { collection.add(foreignInstance); dirty = true; } } else if (Map.class.isAssignableFrom(populateValueRequest.getReturnType())) { throw new IllegalArgumentException("Map structures are not supported for foreign key fields."); } else { dirty = checkDirtyState(populateValueRequest, instance, foreignInstance); populateValueRequest.getFieldManager().setFieldValue(instance, populateValueRequest.getProperty().getName(), foreignInstance); } break; } case ADDITIONAL_FOREIGN_KEY: { Serializable foreignInstance; if (StringUtils.isEmpty(populateValueRequest.getRequestedValue())) { foreignInstance = null; } else { if (SupportedFieldType.INTEGER.toString() .equals(populateValueRequest.getMetadata().getSecondaryType().toString())) { foreignInstance = populateValueRequest.getPersistenceManager().getDynamicEntityDao() .retrieve(Class.forName(populateValueRequest.getMetadata().getForeignKeyClass()), Long.valueOf(populateValueRequest.getRequestedValue())); } else { foreignInstance = populateValueRequest.getPersistenceManager().getDynamicEntityDao() .retrieve(Class.forName(populateValueRequest.getMetadata().getForeignKeyClass()), populateValueRequest.getRequestedValue()); } } // Best guess at grabbing the original display value String fkProp = populateValueRequest.getMetadata().getForeignKeyDisplayValueProperty(); Object origDispVal = null; if (origValue != null) { if (AdminMainEntity.MAIN_ENTITY_NAME_PROPERTY.equals(fkProp)) { if (origValue instanceof AdminMainEntity) { origDispVal = ((AdminMainEntity) origValue).getMainEntityName(); } } else { origDispVal = populateValueRequest.getFieldManager().getFieldValue(origValue, fkProp); } } if (origDispVal != null) { prop.setOriginalDisplayValue(String.valueOf(origDispVal)); Session session = populateValueRequest.getPersistenceManager().getDynamicEntityDao() .getStandardEntityManager().unwrap(Session.class); prop.setOriginalValue(String.valueOf(session.getIdentifier(foreignInstance))); } if (Collection.class.isAssignableFrom(populateValueRequest.getReturnType())) { Collection collection; try { collection = (Collection) populateValueRequest.getFieldManager().getFieldValue(instance, populateValueRequest.getProperty().getName()); } catch (FieldNotAvailableException e) { throw new IllegalArgumentException(e); } if (!collection.contains(foreignInstance)) { collection.add(foreignInstance); dirty = true; } } else if (Map.class.isAssignableFrom(populateValueRequest.getReturnType())) { throw new IllegalArgumentException("Map structures are not supported for foreign key fields."); } else { dirty = checkDirtyState(populateValueRequest, instance, foreignInstance); populateValueRequest.getFieldManager().setFieldValue(instance, populateValueRequest.getProperty().getName(), foreignInstance); } break; } case ID: if (populateValueRequest.getSetId()) { switch (populateValueRequest.getMetadata().getSecondaryType()) { case INTEGER: dirty = checkDirtyState(populateValueRequest, instance, Long.valueOf(populateValueRequest.getRequestedValue())); populateValueRequest.getFieldManager().setFieldValue(instance, populateValueRequest.getProperty().getName(), Long.valueOf(populateValueRequest.getRequestedValue())); break; case STRING: dirty = checkDirtyState(populateValueRequest, instance, populateValueRequest.getRequestedValue()); populateValueRequest.getFieldManager().setFieldValue(instance, populateValueRequest.getProperty().getName(), populateValueRequest.getRequestedValue()); break; } } break; } } catch (Exception e) { throw new PersistenceException(e); } populateValueRequest.getProperty().setIsDirty(dirty); return FieldProviderResponse.HANDLED; }
From source file:com.domain.java.util.IDCardUtils.java
/** * ???/*from w w w . java2 s.c o m*/ * @param idCard ? * @return (MM) */ public static Short getMonthByIdCard(String idCard) { Integer len = idCard.length(); if (len == CHINA_ID_MIN_LENGTH) { idCard = convert15CardTo18(idCard); } if (idCard == null) { return null; } return Short.valueOf(idCard.substring(10, 12)); }
From source file:entity.service.EntryFacadeREST.java
@POST @Path("/processcsv/{raceid}") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces("application/json; charset=UTF-8") public Response processCSV(@FormParam("filename") String fileName, @PathParam("raceid") Integer raceid) { parameters.initClubs();/*from w w w . j a v a 2s . c o m*/ List<String> invalidLicences = new ArrayList<>(); invalidLicences.add("nev;rajtszam;licensz"); try (Reader in = new InputStreamReader( new FileInputStream(appParameters.getProperty("uploadFolder") + fileName), "UTF-8")) { Iterable<CSVRecord> records = CSVFormat.EXCEL.withSkipHeaderRecord().withDelimiter(';') .withHeader(CSV_HEADERS).withNullString("").parse(in); int count = 0; for (CSVRecord record : records) { EntryData ed = new EntryData(); ed.setPreentry(true); ed.setStatus("PRE"); ed.setName(record.get("name")); ed.setRacenum(record.get("racenum")); ed.setGender(record.get("gender")); ed.setBirthYear(Short.valueOf(record.get("birthyear"))); ed.setCategory(record.get("category")); ed.setFromTown(record.get("fromtown")); ed.setClubName(record.get("club")); ed.setAgegroup(record.get("agegroup")); ed.setPaid(record.get("paid").equals("IGEN")); ed.setRemainingpayment( record.get("paid").matches("[1-9]\\d{0,10}") ? Integer.parseInt(record.get("paid")) : 0); ed.setLicencenum(record.get("licencenum")); if (ed.getLicencenum() != null && !ed.getLicencenum().isEmpty()) { if (!licenceFacade.exists(ed.getLicencenum())) { invalidLicences.add(ed.getName() + ";" + ed.getRacenum() + ";" + ed.getLicencenum()); } } insertEntry(ed, raceid); ++count; } String invalidLicencesFileName = "invalid_licences_" + fileName; Files.write(Paths.get(appParameters.getProperty("uploadFolder"), invalidLicencesFileName), invalidLicences, Charset.forName("UTF-8")); HashMap<String, Object> params = new HashMap<>(); params.put("invalidLicences", invalidLicencesFileName); JsonObject jsonMsg = JsonBuilder.getJsonMsg(count + " db elnevezs beolvasva!", JsonBuilder.MsgType.INFO, params); return Response.ok(String.valueOf(jsonMsg)).build(); } catch (FileNotFoundException ex) { HashMap<String, Object> params = new HashMap<>(); params.put("fileName", fileName); JsonObject jsonMsg = JsonBuilder.getJsonMsg("A megadott fjl nem tallhat!", JsonBuilder.MsgType.ERROR, params); return Response.status(500).entity(jsonMsg).build(); } catch (IOException ex) { HashMap<String, Object> params = new HashMap<>(); params.put("fileName", fileName); JsonObject jsonMsg = JsonBuilder.getJsonMsg("Hiba a CSV fjl beolvassa kzben!", JsonBuilder.MsgType.ERROR, params); return Response.status(500).entity(jsonMsg).build(); } }
From source file:com.domain.java.util.IDCardUtils.java
/** * ???//from w ww. ja v a 2 s . c o m * @param idCard ? * @return (dd) */ public static Short getDateByIdCard(String idCard) { Integer len = idCard.length(); if (len == CHINA_ID_MIN_LENGTH) { idCard = convert15CardTo18(idCard); } if (idCard == null) { return null; } return Short.valueOf(idCard.substring(12, 14)); }
From source file:org.mifos.accounts.loan.business.LoanBORedoDisbursalIntegrationTest.java
@Ignore @Test(expected = org.mifos.accounts.exceptions.AccountException.class) public void testRedoLoanApplyFractionalMiscPenaltyAfterPartialPayment() throws Exception { try {//ww w .jav a 2s. co m LoanBO loan = redoLoanWithMondayMeetingAndVerify(userContext, 14, new ArrayList<AccountFeesEntity>()); disburseLoanAndVerify(userContext, loan, 14); LoanTestUtils.assertInstallmentDetails(loan, 1, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 2, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 3, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 4, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 5, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 6, 45.5, 0.5, 0.0, 0.0, 0.0); applyAndVerifyPayment(userContext, loan, 7, new Money(getCurrency(), "50")); LoanTestUtils.assertInstallmentDetails(loan, 1, 1.0, 0.0, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 2, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 3, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 4, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 5, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 6, 45.5, 0.5, 0.0, 0.0, 0.0); Assert.assertFalse(MoneyUtils.isRoundedAmount(33.7)); Assert.assertFalse(loan.canApplyMiscCharge(new Money(getCurrency(), new BigDecimal(33.7)))); // Should throw AccountExcption applyCharge(loan, Short.valueOf(AccountConstants.MISC_PENALTY), new Double("33.7")); LoanTestUtils.assertInstallmentDetails(loan, 1, 1.0, 0.0, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 2, 51.2, 0.1, 0.0, 0.0, 33.7); LoanTestUtils.assertInstallmentDetails(loan, 3, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 4, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 5, 50.9, 0.1, 0.0, 0.0, 0.0); LoanTestUtils.assertInstallmentDetails(loan, 6, 45.2, 0.8, 0.0, 0.0, 0.0); Assert.fail("Expected AccountException !!"); } catch (AccountException e) { } }
From source file:org.mifos.customers.struts.actionforms.CustomerActionForm.java
private boolean isFrequencyMatches(ApplicableAccountFeeDto fee, MeetingBO meeting) { String feeRecur = fee.getFeeSchedule().split(" ")[0]; return (((fee.isMonthly() && meeting.isMonthly()) || (fee.isWeekly() && meeting.isWeekly())) && Short.valueOf(feeRecur) % meeting.getRecurAfter() == 0); }
From source file:com.gargoylesoftware.htmlunit.html.HtmlElement.java
/** * Returns this element's tab index, if it has one. If the tab index is outside of the * valid range (less than <tt>0</tt> or greater than <tt>32767</tt>), this method * returns {@link #TAB_INDEX_OUT_OF_BOUNDS}. If this element does not have * a tab index, or its tab index is otherwise invalid, this method returns {@code null}. * * @return this element's tab index// ww w .ja va 2 s . c o m */ public Short getTabIndex() { final String index = getAttribute("tabindex"); if (index == null || index.isEmpty()) { return null; } try { final long l = Long.parseLong(index); if (l >= 0 && l <= Short.MAX_VALUE) { return Short.valueOf((short) l); } return TAB_INDEX_OUT_OF_BOUNDS; } catch (final NumberFormatException e) { return null; } }
From source file:com.icsshs.datatransfer.database.impl.QueryBeanProcessor.java
/** * Convert a <code>ResultSet</code> column into an object. Simple * implementations could just call <code>rs.getObject(index)</code> while * more complex implementations could perform type manipulation to match * the column's type to the bean property type. * * <p>//w ww . j ava 2 s . com * This implementation calls the appropriate <code>ResultSet</code> getter * method for the given property type to perform the type conversion. If * the property type doesn't match one of the supported * <code>ResultSet</code> types, <code>getObject</code> is called. * </p> * * @param rs The <code>ResultSet</code> currently being processed. It is * positioned on a valid row before being passed into this method. * * @param index The current column index being processed. * * @param propType The bean property type that this column needs to be * converted into. * * @throws SQLException if a database access error occurs * * @return The object from the <code>ResultSet</code> at the given column * index after optional type processing or <code>null</code> if the column * value was SQL NULL. */ protected Object processColumn(ResultSet rs, int index, Class<?> propType) throws SQLException { if (!propType.isPrimitive() && rs.getObject(index) == null) { return null; } if (propType.equals(String.class)) { return rs.getString(index); } else if (propType.equals(Integer.TYPE) || propType.equals(Integer.class)) { return Integer.valueOf(rs.getInt(index)); } else if (propType.equals(Boolean.TYPE) || propType.equals(Boolean.class)) { return Boolean.valueOf(rs.getBoolean(index)); } else if (propType.equals(Long.TYPE) || propType.equals(Long.class)) { return Long.valueOf(rs.getLong(index)); } else if (propType.equals(Double.TYPE) || propType.equals(Double.class)) { return Double.valueOf(rs.getDouble(index)); } else if (propType.equals(Float.TYPE) || propType.equals(Float.class)) { return Float.valueOf(rs.getFloat(index)); } else if (propType.equals(Short.TYPE) || propType.equals(Short.class)) { return Short.valueOf(rs.getShort(index)); } else if (propType.equals(Byte.TYPE) || propType.equals(Byte.class)) { return Byte.valueOf(rs.getByte(index)); } else if (propType.equals(Timestamp.class)) { return rs.getTimestamp(index); } else if (propType.equals(byte[].class)) { return rs.getBytes(index); } else { return rs.getObject(index); } }
From source file:cat.albirar.framework.dynabean.impl.DynaBeanImpl.java
/** * Test if the value is for a primitive type and return an object representation with default (0) value. If value is * null and the type is primitive, return a representation of default value for the primitive corresponding type. * // www .ja v a 2s. co m * @param value the value, can be null * @param pb The property bean descriptor * @return The value or the default value representation for the primitive type (0) */ private Object nullSafeValue(Object value, DynaBeanPropertyDescriptor pb) { if (!pb.isPrimitive()) { return value; } if (pb.getPropertyType().getName().equals("byte")) { return (value == null ? Byte.valueOf((byte) 0) : (Byte) value); } if (pb.getPropertyType().getName().equals("short")) { return (value == null ? Short.valueOf((short) 0) : (Short) value); } if (pb.getPropertyType().getName().equals("int")) { return (value == null ? Integer.valueOf(0) : (Integer) value); } if (pb.getPropertyType().getName().equals("long")) { return (value == null ? Long.valueOf(0L) : (Long) value); } if (pb.getPropertyType().getName().equals("float")) { return (value == null ? Float.valueOf(0F) : (Float) value); } if (pb.getPropertyType().getName().equals("double")) { return (value == null ? Double.valueOf(0D) : (Double) value); } if (pb.getPropertyType().getName().equals("char")) { return (value == null ? Character.valueOf('\u0000') : (Character) value); } return (value == null ? Boolean.FALSE : (Boolean) value); }
From source file:org.codice.ddf.spatial.ogc.csw.catalog.converter.CswUnmarshallHelper.java
/** * Converts the CSW record property {@code reader} is currently at to the specified Metacard * attribute format.//from w w w .jav a2 s . com * * @param attributeFormat the {@link AttributeType.AttributeFormat} corresponding to the type that the value * in {@code reader} should be converted to * @param reader the reader at the element whose value you want to convert * @param cswAxisOrder the order of the coordinates in the XML being read by {@code reader} * @return the value that was extracted from {@code reader} and is of the type described by * {@code attributeFormat} */ public static Serializable convertRecordPropertyToMetacardAttribute( AttributeType.AttributeFormat attributeFormat, HierarchicalStreamReader reader, CswAxisOrder cswAxisOrder) { LOGGER.debug("converting csw record property {}", reader.getValue()); Serializable ser = null; switch (attributeFormat) { case BOOLEAN: ser = Boolean.valueOf(reader.getValue()); break; case DOUBLE: ser = Double.valueOf(reader.getValue()); break; case FLOAT: ser = Float.valueOf(reader.getValue()); break; case INTEGER: ser = Integer.valueOf(reader.getValue()); break; case LONG: ser = Long.valueOf(reader.getValue()); break; case SHORT: ser = Short.valueOf(reader.getValue()); break; case XML: case STRING: ser = reader.getValue(); break; case DATE: ser = CswUnmarshallHelper.convertStringValueToMetacardValue(attributeFormat, reader.getValue()); break; case GEOMETRY: // We pass in cswAxisOrder, so we can determine coord order (LAT/LON vs // LON/LAT). BoundingBoxReader bboxReader = new BoundingBoxReader(reader, cswAxisOrder); try { ser = bboxReader.getWkt(); } catch (CswException cswException) { LOGGER.error( "CswUnmarshallHelper.convertRecordPropertyToMetacardAttribute(): could not read BoundingBox.", cswException); } LOGGER.debug("WKT = {}", (String) ser); break; case BINARY: try { ser = reader.getValue().getBytes(UTF8_ENCODING); } catch (UnsupportedEncodingException e) { LOGGER.warn("Error encoding the binary value into the metacard.", e); } break; default: break; } return ser; }