Skip to main content
This revision made November 15, 2010 16:39, by Vladimir Zhukov

Utils Library fo Java 1.5+ (test name elava)

Emsoft-utils is an open source utils library for Java 1.5+. Contains assertion utility for check arguments, collections utility, strings utility, io utility, password utility, observer impementation, exceptions utility, operation templates and other. For full detail see java doc or sources.

Assert example:


    public void exaples() {
        List list = new ArrayList();
        method(new Object(), "text", list); // exception with arg3
        list.add(new Object());
        method(new Object(), "text", list); // success
        method(new Object(), "", list); // exception with arg2
        method(null, "text", list); // exception with arg1
    }

    public void method(Object arg1, String arg2, Collection arg3) {
        Assert.notNull(arg1, "arg1");
        Assert.notNullOrEmpty(arg2, "arg2");
        Assert.notNullOrEmpty(arg3, "arg3");
        // do something
        // ...
    }

Difference compared to previous revision
= Utils Library fo Java 1.5+ (test name elava)= Utils Library fo Java 1.5+ = '''Emsoft-utils''' is an open source utils library for Java 1.5+. Contains assertion utility for check arguments, collections utility, strings utility, io utility, password utility, observer impementation, exceptions utility, operation templates and other. For full detail see java doc or sources. ====E= '''Emsoft-utils''' is an open source utils library for Java 1.5+. Contains assertion utility for check arguments, collections utility, strings utility, io utility, password utility, observer impementation, exceptions utility, operation templates and other. For full detail see java doc or sources. ====Assert examples:====
 xample:====


    public void exaples() {
        List list = new ArrayList();
        
public void exaples() {
    method(numethod(new Object(), "text", llist); // exception with arg3
        list.add(new Object());
        method(new Object(), "text", list); // success
        method(new Object(), "", list); // exception with arg2
        method(null, "text", list); // exception with arg1
    }

    public void method(Object arg1, String arg2, Collection arg3) {
        Assert.notNull(arg1, "arg1");
        Assert.notNullOrEmpty(arg2, "arg2");
        Assert.notNullOrEmpty(arg3, "arg3");
        // do something
        // ...
    }

 
 
Close
loading
Please Confirm
Close