Tabnine Logo
FloatConverter
Code IndexAdd Tabnine to your IDE (free)

How to use
FloatConverter
in
jodd.typeconverter.impl

Best Java code snippets using jodd.typeconverter.impl.FloatConverter (Showing top 4 results out of 315)

origin: oblac/jodd

  @Test
  void testConversion() {
    FloatConverter floatConverter = new FloatConverter();

    assertNull(floatConverter.convert(null));

    assertEquals(Float.valueOf(1), floatConverter.convert(Integer.valueOf(1)));
    assertEquals(Float.valueOf((float) 1.73), floatConverter.convert(Double.valueOf(1.73D)));
    assertEquals(Float.valueOf((float) 1.73), floatConverter.convert("1.73"));
    assertEquals(Float.valueOf((float) 1.73), floatConverter.convert(" 1.73 "));
    assertEquals(Float.valueOf((float) 1.73), floatConverter.convert(" +1.73 "));
    assertEquals(Float.valueOf((float) -1.73), floatConverter.convert(" -1.73 "));
    assertEquals(Float.valueOf((float) 1.73), floatConverter.convert(new BigDecimal("1.73")));

    try {
      floatConverter.convert("aaaa");
      fail("error");
    } catch (TypeConversionException ignore) {
    }
  }
}
origin: redisson/redisson

register(MutableByte.class, new MutableByteConverter(this));
FloatConverter floatConverter = new FloatConverter();
register(Float.class, floatConverter);
register(float.class, floatConverter);
origin: oblac/jodd

register(MutableByte.class, new MutableByteConverter(this));
FloatConverter floatConverter = new FloatConverter();
register(Float.class, floatConverter);
register(float.class, floatConverter);
origin: org.jodd/jodd-bean

register(MutableByte.class, new MutableByteConverter(this));
FloatConverter floatConverter = new FloatConverter();
register(Float.class, floatConverter);
register(float.class, floatConverter);
jodd.typeconverter.implFloatConverter

Javadoc

Converts given object to Float. Conversion rules:
  • null value is returned as null
  • object of destination type is simply casted
  • object is converted to string, trimmed, and then converted if possible.
Number string may start with plus and minus sign.

Most used methods

  • <init>
  • convert

Popular in Java

  • Finding current android device location
  • getSystemService (Context)
  • getSharedPreferences (Context)
  • onRequestPermissionsResult (Fragment)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now