@Test public void shouldInstantiatePredicateClass() { assertThat(ClassUtils.instantiatePredicateClass(PublicPredicate.class)).isNotNull(); }
public static <T> Predicate<T> instantiatePredicateClass(Class<? extends Predicate<T>> clazz) { try { Constructor<? extends Predicate<T>> c = clazz.getConstructor(); if (c != null) { return c.newInstance(); } else { throw new InstantiationException(INSTANTIATION_ERROR_PREFIX + clazz.getName()); } } catch (Exception e) { throw new InstantiationException(INSTANTIATION_ERROR_PREFIX + clazz.getName(), e); } }
ClassUtils { public static <T> Predicate<T> instantiatePredicateClass(Class<? extends Predicate<T>> clazz) { try { Constructor<? extends Predicate<T>> c = clazz.getConstructor(); if (c != null) { return c.newInstance(); } else { throw new InstantiationException(INSTANTIATION_ERROR_PREFIX + clazz.getName()); } } catch (Exception e) { throw new InstantiationException(INSTANTIATION_ERROR_PREFIX + clazz.getName(), e); } } }
ClassUtils { public static <T> Predicate<T> instantiatePredicateClass(Class<? extends Predicate<T>> clazz) { try { Constructor<? extends Predicate<T>> c = clazz.getConstructor(); if (c != null) { return c.newInstance(); } else { throw new InstantiationException(INSTANTIATION_ERROR_PREFIX + clazz.getName()); } } catch (Exception e) { throw new InstantiationException(INSTANTIATION_ERROR_PREFIX + clazz.getName(), e); } } private  ClassUtils(); }
ClassUtils { public static <T> Predicate<T> instantiatePredicateClass(Class<? extends Predicate<T>> clazz) { try { Constructor<? extends Predicate<T>> c = clazz.getConstructor(); if (c != null) { return c.newInstance(); } else { throw new InstantiationException(INSTANTIATION_ERROR_PREFIX + clazz.getName()); } } catch (Exception e) { throw new InstantiationException(INSTANTIATION_ERROR_PREFIX + clazz.getName(), e); } } private  ClassUtils(); static Predicate<T> instantiatePredicateClass(Class<? extends Predicate<T>> clazz); static T instantiateClassDefConstructor(Class<T> clazz); }
ClassUtils { public static <T> Predicate<T> instantiatePredicateClass(Class<? extends Predicate<T>> clazz) { try { Constructor<? extends Predicate<T>> c = clazz.getConstructor(); if (c != null) { return c.newInstance(); } else { throw new InstantiationException(INSTANTIATION_ERROR_PREFIX + clazz.getName()); } } catch (Exception e) { throw new InstantiationException(INSTANTIATION_ERROR_PREFIX + clazz.getName(), e); } } private  ClassUtils(); static Predicate<T> instantiatePredicateClass(Class<? extends Predicate<T>> clazz); static T instantiateClassDefConstructor(Class<T> clazz);  }