| Constructor and Description |
|---|
Conf() |
| Modifier and Type | Method and Description |
|---|---|
Lang.Conf |
registerBoolTester(Lang.Function<Object,Boolean> tester)
Register a boolean tester.
|
public Lang.Conf registerBoolTester(Lang.Function<Object,Boolean> tester)
Register a boolean tester. A boolean tester is a Function<Object, Boolean> type function that applied to Object type parameter and returns a boolean value of the Object been tested. It should throw out NotAppliedException if the type of the object been tested is not recognized. there is no need to test if the parameter is null in the tester as the utility will garantee the object passed in is not null
Conf.registerBoolTester(new F1<Boolean, Object>() { @Override public Boolean apply(Object o) { if (o instanceof Score) { return ((Score)o).intValue() > 60; } if (o instanceof Person) { return ((Person)o).age() > 16; } … // since we do not recognize the object type, raise the NotAppliedException out throw new org.osgl.E.NotAppliedException(); } }); tester - the tester function takes an object as parameter and returns booleanLang.Conf instanceCopyright © 2014–2019 OSGL (Open Source General Library). All rights reserved.