| Constructor and Description |
|---|
Conf() |
| Modifier and Type | Method and Description |
|---|---|
Osgl.Conf |
registerBoolTester(Osgl.Function<Object,Boolean> tester)
Register a boolean tester.
|
public Osgl.Conf registerBoolTester(Osgl.Function<Object,Boolean> tester)
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
Osgl.Conf.registerBoolTester(new Osgl.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 booleanOsgl.Conf instanceCopyright © 2017. All Rights Reserved.