List of usage examples for java.lang Float toString
public String toString()
From source file:com.nridge.core.base.std.StrUtl.java
/** * Convenience method that converts a generic ArrayList of * Objects into an array of string values. * * @param anArrayList Array of value object instances. * * @return An array of values extracted from the array list. *///from ww w.ja v a 2s. c om public static String[] convertToMulti(ArrayList<?> anArrayList) { if ((anArrayList == null) || (anArrayList.size() == 0)) { String[] emptyList = new String[1]; emptyList[0] = StringUtils.EMPTY; return emptyList; } int offset = 0; String[] multiValues = new String[anArrayList.size()]; for (Object arrayObject : anArrayList) { if (arrayObject instanceof Integer) { Integer integerValue = (Integer) arrayObject; multiValues[offset++] = integerValue.toString(); } else if (arrayObject instanceof Long) { Long longValue = (Long) arrayObject; multiValues[offset++] = longValue.toString(); } else if (arrayObject instanceof Float) { Float floatValue = (Float) arrayObject; multiValues[offset++] = floatValue.toString(); } else if (arrayObject instanceof Double) { Double doubleValue = (Double) arrayObject; multiValues[offset++] = doubleValue.toString(); } else if (arrayObject instanceof Date) { Date dateValue = (Date) arrayObject; multiValues[offset++] = Field.dateValueFormatted(dateValue, Field.FORMAT_DATETIME_DEFAULT); } else multiValues[offset++] = arrayObject.toString(); } return multiValues; }
From source file:com.invbf.sistemagestionmercadeo.reportes.ReportCreator.java
public static void generadorSolicitudBono(Solicitudentrega elemento) { ServletOutputStream servletOutputStream = null; try {/*from ww w . ja va 2 s. c o m*/ SolicitudBonoJuego elementoReporte = new SolicitudBonoJuego(); if (elemento.getSolicitante().getUsuariodetalle().getIdcargo() != null) { elementoReporte.setCargo(elemento.getSolicitante().getUsuariodetalle().getIdcargo().getNombre()); } else { elementoReporte.setCargo(""); } elementoReporte.setCasino(elemento.getIdCasino().getNombre()); SimpleDateFormat formateador = new SimpleDateFormat("dd-MMMM-yy", new Locale("es_ES")); elementoReporte.setFecha(formateador.format(elemento.getFecha())); elementoReporte.setJustificacion(elemento.getJustificacion()); elementoReporte.setNombre(elemento.getSolicitante().getNombreUsuario()); elementoReporte.setProposito(elemento.getPropositoEntrega().getNombre()); elementoReporte.setTipobono(elemento.getTipoBono().getNombre()); List<SolicitudBonoJuegoCliente> clientes = new ArrayList<SolicitudBonoJuegoCliente>(); int item = 1; Float total = 0f; for (Solicitudentregacliente sec : elemento.getSolicitudentregaclienteList()) { clientes.add(new SolicitudBonoJuegoCliente((item) + "", sec.getCliente().getNombres() + " " + sec.getCliente().getApellidos(), sec.getValorTotal().toString(), sec.getAreaid().getNombre())); total += sec.getValorTotal(); item++; } elementoReporte.setClientes(clientes); elementoReporte.setTotal(total.toString()); ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); InputStream input = externalContext .getResourceAsStream("/resources/reportes/solicitudbonosjuego.jasper"); InputStream subreport = externalContext .getResourceAsStream("/resources/reportes/solicitudbonosjuego_cliente.jasper"); InputStream logo = externalContext.getResourceAsStream("/resources/reportes/LogoMRCNegro.jpeg"); InputStream logoibf = externalContext.getResourceAsStream("/resources/reportes/IBFLogo01jpeg.jpeg"); ImageIcon tlc = new ImageIcon(IOUtils.toByteArray(logo)); ImageIcon ibf = new ImageIcon(IOUtils.toByteArray(logoibf)); elementoReporte.setIbf(ibf.getImage()); elementoReporte.setLogo(tlc.getImage()); List<SolicitudBonoJuego> lista = new ArrayList<SolicitudBonoJuego>(); lista.add(elementoReporte); JRBeanCollectionDataSource beanColDataSource = new JRBeanCollectionDataSource(lista); JasperReport jasperMasterReport = (JasperReport) JRLoader.loadObject(input); JasperReport jasperSubReport = (JasperReport) JRLoader.loadObject(subreport); elementoReporte.setSubreportclientes(jasperSubReport); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("logo", lista.get(0).getLogo()); parameters.put("ibf", lista.get(0).getIbf()); parameters.put("clientes", lista.get(0).getClientes()); parameters.put("subreportclientes", jasperSubReport); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperMasterReport, parameters, beanColDataSource); HttpServletResponse httpServletResponse = (HttpServletResponse) FacesContext.getCurrentInstance() .getExternalContext().getResponse(); httpServletResponse.addHeader("Content-disposition", "attachment; filename=ActaSolicitudBonosJuego" + elemento.getId() + ".pdf"); servletOutputStream = httpServletResponse.getOutputStream(); JasperExportManager.exportReportToPdfStream(jasperPrint, servletOutputStream); } catch (IOException ex) { Logger.getLogger(ReportCreator.class.getName()).log(Level.SEVERE, null, ex); } catch (JRException ex) { Logger.getLogger(ReportCreator.class.getName()).log(Level.SEVERE, null, ex); } finally { try { servletOutputStream.close(); } catch (IOException ex) { Logger.getLogger(ReportCreator.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:uk.ac.ebi.intact.editor.config.property.FloatPropertyConverter.java
@Override public String convertToString(Float obj) { if (obj == null) return null; return obj.toString(); }
From source file:ec.edu.espe.distribuidas.facturacion.socket.estrucMsj.tipoDato.Dec.java
public Dec(Float numero, Integer enteros, Integer decimal) { this.txtDecimal = numero.toString(); this.enteros = enteros; this.decimal = decimal; this.longitud = this.enteros + this.decimal; }
From source file:org.openmrs.customdatatype.datatype.FloatDatatype.java
/** * @see SerializingCustomDatatype#serialize(Object) *///from w w w . j a v a2s. co m @Override public String serialize(Float typedValue) { if (typedValue == null) { return null; } return typedValue.toString(); }
From source file:org.apache.hadoop.hive.ql.udf.UDFToString.java
public String evaluate(Float i) { if (i == null) { return null; } else {/*ww w . j ava 2s. c om*/ return i.toString(); } }
From source file:com.couchbase.sqoop.mapreduce.db.CouchbaseRecordReadSerializeTest.java
@Before @Override/*from w ww . ja v a2 s.c o m*/ public void setUp() throws Exception { super.setUp(); tappedStuff = new HashMap<String, ResponseMessage>(); URI uri = new URI(CouchbaseUtils.CONNECT_STRING); String user = CouchbaseUtils.COUCHBASE_USER_NAME; String pass = CouchbaseUtils.COUCHBASE_USER_PASS; try { cb = new CouchbaseClient(Arrays.asList(uri), user, pass); } catch (IOException e) { LOG.error("Couldn't connect to server" + e.getMessage()); fail(e.toString()); } this.client = new TapClient(Arrays.asList(uri), user, pass); cb.flush(); Thread.sleep(500); // set up the items we're going to deserialize Integer anint = new Integer(Integer.MIN_VALUE); cb.set(anint.toString(), 0x300, anint).get(); Long along = new Long(Long.MAX_VALUE); cb.set(along.toString(), 0, along).get(); Float afloat = new Float(Float.MAX_VALUE); cb.set(afloat.toString(), 0, afloat).get(); Double doubleBase = new Double(Double.NEGATIVE_INFINITY); cb.set(doubleBase.toString(), 0, doubleBase).get(); Boolean booleanBase = true; cb.set(booleanBase.toString(), 0, booleanBase).get(); rightnow = new Date(); // instance, needed later dateText = rightnow.toString().replaceAll(" ", "_"); cb.set(dateText, 0, rightnow).get(); Byte byteMeSix = new Byte("6"); cb.set(byteMeSix.toString(), 0, byteMeSix).get(); String ourString = "hi,there"; cb.set(ourString.toString(), 0, ourString).get(); client.tapDump("tester"); while (client.hasMoreMessages()) { ResponseMessage m = client.getNextMessage(); if (m == null) { continue; } tappedStuff.put(m.getKey(), m); } }
From source file:io.pivotal.xd.chaoslemur.RandomFateEngine.java
@Autowired RandomFateEngine(@Value("${blacklist:}") String[] blacklist, @Value("${default.probability:0.2}") Float defaultProbability, Environment environment, Random random) { this.blacklist = blacklist; this.defaultProbability = defaultProbability.toString(); this.environment = environment; this.random = random; this.logger.info("Blacklist: {}", StringUtils.arrayToCommaDelimitedString(blacklist)); this.logger.info("Default probability: {}", defaultProbability); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamMssCF.MSSBamMssCFBindFloatDefMaxValue.java
public String expandBody(MssCFGenContext genContext) { final String S_ProcName = "MSSBamMssCFBindFloatDefMaxValue.expandBody() "; if (genContext == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext"); }/* ww w. j av a 2s. com*/ IMssCFAnyObj genDef = genContext.getGenDef(); if (genDef == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext.getGenDef()"); } String ret; if (genDef instanceof IMSSBamBLFloatDefObj) { Float maxValue = ((IMSSBamBLFloatDefObj) genDef).getOptionalMaxValue(); if (maxValue == null) { ret = null; } else { ret = maxValue.toString(); } } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody", "genContext.getGenDef()", genDef, "IMSSBamBLFloatDefObj"); } return (ret); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamMssCF.MSSBamMssCFBindFloatDefMinValue.java
public String expandBody(MssCFGenContext genContext) { final String S_ProcName = "MSSBamMssCFBindFloatDefMinValue.expandBody() "; if (genContext == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext"); }/*from ww w . ja v a2s. c o m*/ IMssCFAnyObj genDef = genContext.getGenDef(); if (genDef == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext.getGenDef()"); } String ret; if (genDef instanceof IMSSBamBLFloatDefObj) { Float minValue = ((IMSSBamBLFloatDefObj) genDef).getOptionalMinValue(); if (minValue == null) { ret = null; } else { ret = minValue.toString(); } } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody", "genContext.getGenDef()", genDef, "IMSSBamBLFloatDefObj"); } return (ret); }