All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jparams.test.tostring.template.Templates Maven / Gradle / Ivy

There is a newer version: 1.1.2
Show newest version
package com.jparams.test.tostring.template;

import com.jparams.test.tostring.template.matcher.ClassNameMatcher;
import com.jparams.test.tostring.template.matcher.FieldValueMatcher;
import com.jparams.test.tostring.template.matcher.IdentityHashMatcher;
import com.jparams.test.tostring.template.matcher.SimpleClassNameMatcher;
import com.jparams.test.tostring.template.matcher.StringMatcher;

import static java.util.function.Function.identity;

public class Templates
{
    public static Template APACHE_COMMONS_LANG_3 =
        TemplateBuilder.newTemplate()
                       .match(new ClassNameMatcher())
                       .match(new StringMatcher("@"))
                       .match(new IdentityHashMatcher())
                       .match(new StringMatcher("["))
                       .match(new FieldValueMatcher(",", "=", identity(), String::valueOf))
                       .match(new StringMatcher("]"))
                       .build();

    public static Template GOOGLE_GUAVA =
        TemplateBuilder.newTemplate()
                       .match(new SimpleClassNameMatcher())
                       .match(new StringMatcher("{"))
                       .match(new FieldValueMatcher(", ", "=", identity(), String::valueOf))
                       .match(new StringMatcher("}"))
                       .build();

    public static final Template INTELLI_J =
        TemplateBuilder.newTemplate()
                       .match(new SimpleClassNameMatcher())
                       .match(new StringMatcher("{"))
                       .match(new FieldValueMatcher(", ", "=", identity(), val -> String.format("'%s'", val)))
                       .match(new StringMatcher("}"))
                       .build();

    public static final Template ECLIPSE =
        TemplateBuilder.newTemplate()
                       .match(new SimpleClassNameMatcher())
                       .match(new StringMatcher(" "))
                       .match(new StringMatcher("["))
                       .match(new FieldValueMatcher(", ", "=", identity(), String::valueOf))
                       .match(new StringMatcher("]"))
                       .build();

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy