@Test public void testMissingEntity() throws UIMAException { JCas jCas = JCasSingleton.getJCasInstance(); try { TypeUtils.getEntityClass("Missing", jCas); fail("Expected exception not found"); } catch (BaleenException e) { } }
@SuppressWarnings("unchecked") public static Class<? extends Entity> getEntityClass(String typeName, JCas jCas) throws BaleenException { Class<? extends AnnotationBase> at = getType(typeName, jCas); if (at == null) { throw new BaleenException("Couldn't find type '" + typeName + "'"); } if (!Entity.class.isAssignableFrom(at)) { throw new BaleenException("Entity type '" + typeName + "' does not inherit from Entity"); } return (Class<? extends Entity>) at; }
TypeUtils { @SuppressWarnings("unchecked") public static Class<? extends Entity> getEntityClass(String typeName, JCas jCas) throws BaleenException { Class<? extends AnnotationBase> at = getType(typeName, jCas); if (at == null) { throw new BaleenException("Couldn't find type '" + typeName + "'"); } if (!Entity.class.isAssignableFrom(at)) { throw new BaleenException("Entity type '" + typeName + "' does not inherit from Entity"); } return (Class<? extends Entity>) at; } }
TypeUtils { @SuppressWarnings("unchecked") public static Class<? extends Entity> getEntityClass(String typeName, JCas jCas) throws BaleenException { Class<? extends AnnotationBase> at = getType(typeName, jCas); if (at == null) { throw new BaleenException("Couldn't find type '" + typeName + "'"); } if (!Entity.class.isAssignableFrom(at)) { throw new BaleenException("Entity type '" + typeName + "' does not inherit from Entity"); } return (Class<? extends Entity>) at; } private  TypeUtils(); }
TypeUtils { @SuppressWarnings("unchecked") public static Class<? extends Entity> getEntityClass(String typeName, JCas jCas) throws BaleenException { Class<? extends AnnotationBase> at = getType(typeName, jCas); if (at == null) { throw new BaleenException("Couldn't find type '" + typeName + "'"); } if (!Entity.class.isAssignableFrom(at)) { throw new BaleenException("Entity type '" + typeName + "' does not inherit from Entity"); } return (Class<? extends Entity>) at; } private  TypeUtils(); static Class<? extends AnnotationBase> getType(String typeName, JCas jCas); @SuppressWarnings("unchecked") static Class<AnnotationBase> getType(String typeName, TypeSystem typeSystem); @SuppressWarnings("unchecked") static Class<? extends Entity> getEntityClass(String typeName, JCas jCas); @SuppressWarnings({"unchecked", "squid:S2175" /* false positive */}) static List<T> filterAnnotations(
      Collection<? extends BaleenAnnotation> collection, Set<Class<? extends T>> annotationTypes); static Set<Class<? extends T>> getAnnotationClasses(
      Class<T> annotationType); static Set<Class<? extends T>> getTypeClasses(
      Class<T> parentClass, String... typeNames); }
TypeUtils { @SuppressWarnings("unchecked") public static Class<? extends Entity> getEntityClass(String typeName, JCas jCas) throws BaleenException { Class<? extends AnnotationBase> at = getType(typeName, jCas); if (at == null) { throw new BaleenException("Couldn't find type '" + typeName + "'"); } if (!Entity.class.isAssignableFrom(at)) { throw new BaleenException("Entity type '" + typeName + "' does not inherit from Entity"); } return (Class<? extends Entity>) at; } private  TypeUtils(); static Class<? extends AnnotationBase> getType(String typeName, JCas jCas); @SuppressWarnings("unchecked") static Class<AnnotationBase> getType(String typeName, TypeSystem typeSystem); @SuppressWarnings("unchecked") static Class<? extends Entity> getEntityClass(String typeName, JCas jCas); @SuppressWarnings({"unchecked", "squid:S2175" /* false positive */}) static List<T> filterAnnotations(
      Collection<? extends BaleenAnnotation> collection, Set<Class<? extends T>> annotationTypes); static Set<Class<? extends T>> getAnnotationClasses(
      Class<T> annotationType); static Set<Class<? extends T>> getTypeClasses(
      Class<T> parentClass, String... typeNames);  }