Java examples for java.lang.annotation:Enterprise Annotation
get Entity Name from Annotation
import javax.persistence.Entity; import javax.persistence.Table; public class Main{ public static String getEntityName(Class<?> clazz) { Entity ann = clazz.getAnnotation(Entity.class); if (ann != null && !"".equals(ann.name())) { return ann.name(); }//w w w . ja v a2 s .com return clazz.getSimpleName(); } }