/** * Performs post-constructor initialization of an operator table. It can't * be part of the constructor, because the subclass constructor needs to * complete first. */ public final void init() { // Use reflection to register the expressions stored in public fields. for (Field field : getClass().getFields()) { try { if (SqlFunction.class.isAssignableFrom(field.getType())) { SqlFunction op = (SqlFunction) field.get(this); if (op != null) { register(op); } } else if ( SqlOperator.class.isAssignableFrom(field.getType())) { SqlOperator op = (SqlOperator) field.get(this); register(op); } } catch (IllegalArgumentException | IllegalAccessException e) { Util.throwIfUnchecked(e.getCause()); throw new RuntimeException(e.getCause()); } } }
/** * Performs post-constructor initialization of an operator table. It can't * be part of the constructor, because the subclass constructor needs to * complete first. */ public final void init() { // Use reflection to register the expressions stored in public fields. for (Field field : getClass().getFields()) { try { if (SqlFunction.class.isAssignableFrom(field.getType())) { SqlFunction op = (SqlFunction) field.get(this); if (op != null) { register(op); } } else if ( SqlOperator.class.isAssignableFrom(field.getType())) { SqlOperator op = (SqlOperator) field.get(this); register(op); } } catch (IllegalArgumentException | IllegalAccessException e) { Util.throwIfUnchecked(e.getCause()); throw new RuntimeException(e.getCause()); } } }