@Test public void testUntypedValidator() throws Exception { Validator<?> t = new UntypedValidator(); Assert.assertEquals(Object.class, t.getType()); }
@SuppressWarnings("unchecked") @Override public Class<T> getType() { try { ParameterizedType pt = (ParameterizedType) getClass().getGenericSuperclass(); return (Class<T>) pt.getActualTypeArguments()[0]; } catch (Exception e) { return (Class<T>) Object.class; } }
BaseValidator implements Validator<T> { @SuppressWarnings("unchecked") @Override public Class<T> getType() { try { ParameterizedType pt = (ParameterizedType) getClass().getGenericSuperclass(); return (Class<T>) pt.getActualTypeArguments()[0]; } catch (Exception e) { return (Class<T>) Object.class; } } }
BaseValidator implements Validator<T> { @SuppressWarnings("unchecked") @Override public Class<T> getType() { try { ParameterizedType pt = (ParameterizedType) getClass().getGenericSuperclass(); return (Class<T>) pt.getActualTypeArguments()[0]; } catch (Exception e) { return (Class<T>) Object.class; } } BaseValidator();  BaseValidator(QName name); }
BaseValidator implements Validator<T> { @SuppressWarnings("unchecked") @Override public Class<T> getType() { try { ParameterizedType pt = (ParameterizedType) getClass().getGenericSuperclass(); return (Class<T>) pt.getActualTypeArguments()[0]; } catch (Exception e) { return (Class<T>) Object.class; } } BaseValidator();  BaseValidator(QName name); @Override Validator<T> setName(QName name); @Override QName getName(); @SuppressWarnings("unchecked") @Override Class<T> getType(); static ValidationResult validResult(); static ValidationResult invalidResult(String error); static ValidationResult invalidResult(); }
BaseValidator implements Validator<T> { @SuppressWarnings("unchecked") @Override public Class<T> getType() { try { ParameterizedType pt = (ParameterizedType) getClass().getGenericSuperclass(); return (Class<T>) pt.getActualTypeArguments()[0]; } catch (Exception e) { return (Class<T>) Object.class; } } BaseValidator();  BaseValidator(QName name); @Override Validator<T> setName(QName name); @Override QName getName(); @SuppressWarnings("unchecked") @Override Class<T> getType(); static ValidationResult validResult(); static ValidationResult invalidResult(String error); static ValidationResult invalidResult();  }