Java 8 Formattable - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Formattable class.

This code example shows how to use the following methods:formatTo
    @Test
    public final void convertsDifferentFormats() throws Exception {
        final Formattable decor = this.decor();
        final Appendable dest = Mockito.mock(Appendable.class);
        final Formatter fmt = new Formatter(dest);
        decor.formatTo(fmt, this.flags, this.width, this.precision);
        Mockito.verify(dest).append(this.text);
    } 
 
    /** 
     * AbstractDecor can convert object to text, via Logger. 
     * @throws Exception If some problem inside 
     */ 
    @Test
    public final void convertsDifferentFormatsViaLogger() throws Exception {
        final StringBuilder format = new StringBuilder();
        format.append('%');
        if ((this.flags & FormattableFlags.LEFT_JUSTIFY) == FormattableFlags
            .LEFT_JUSTIFY) {
            format.append('-');
3
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Java 8 Formattable Methods: