DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
| Wiki Markup |
|---|
{scrollbar} |
| Excerpt | ||
|---|---|---|
| ||
Adding a type coercion to enable the If component to test for anything |
...
| Code Block | ||||
|---|---|---|---|---|
| ||||
public static void contributeTypeCoercer(MappedConfiguration<CoercionTuple.Key, CoercionTuple> configuration) { add(configuration, SearchResult.class, Boolean.class, new Coercion<SearchResult, Boolean>() { public Boolean coerce(SearchResult input) { return !input.isEmpty(); } }); } private static <S, T> void add(MappedConfiguration<CoercionTuple.Key, CoercionTuple> configuration, Class<S> sourceType, Class<T> targetType, Coercion<S, T> coercion) { CoercionTuple<S, T> tuple = new CoercionTuple<S, T>(sourceType, targetType, coercion); configuration.add(tuple.getKey(), tuple); } |
| Code Block | ||||
|---|---|---|---|---|
| ||||
public static void contributeTypeCoercer(Configuration<CoercionTuple> configuration) {
add(configuration, SearchResult.class, Boolean.class,
new Coercion<SearchResult, Boolean>() {
public Boolean coerce(SearchResult input) {
return !input.isEmpty();
}
});
}
private static <S, T> void add(Configuration<CoercionTuple> configuration,
Class<S> sourceType, Class<T> targetType, Coercion<S, T> coercion) {
CoercionTuple<S, T> tuple = new CoercionTuple<S, T>(sourceType,
targetType, coercion);
configuration.add(tuple);
}
|
...