예제 #1
0
  public static AnnotationTarget getTarget(
      ServiceRegistry serviceRegistry, ClassInfo classInfo, String name, TargetType type) {
    Class clazz =
        serviceRegistry.getService(ClassLoaderService.class).classForName(classInfo.toString());
    switch (type) {
      case FIELD:
        Field field = getField(clazz, name);
        if (field == null) {
          throw new HibernateException(
              "Unable to load field " + name + " of class " + clazz.getName());
        }

        return FieldInfo.create(
            classInfo, name, getType(field.getType()), (short) (field.getModifiers()));
      case METHOD:
        Method method = getMethod(clazz, name);
        if (method == null) {
          throw new HibernateException(
              "Unable to load method " + name + " of class " + clazz.getName());
        }
        return getMethodInfo(classInfo, method);
      case PROPERTY:
        method = getterMethod(clazz, name);
        if (method == null) {
          throw new HibernateException(
              "Unable to load property " + name + " of class " + clazz.getName());
        }
        return getMethodInfo(classInfo, method);
    }
    throw new HibernateException("");
  }
 private void processClass(
     final DeploymentUnit deploymentUnit,
     final EJBResourceWrapper annotation,
     final ClassInfo classInfo,
     final EEModuleDescription eeModuleDescription)
     throws DeploymentUnitProcessingException {
   if (isEmpty(annotation.name())) {
     throw MESSAGES.nameAttributeRequiredForEJBAnnotationOnClass(classInfo.toString());
   }
   if (isEmpty(annotation.beanInterface())) {
     throw MESSAGES.beanInterfaceAttributeRequiredForEJBAnnotationOnClass(classInfo.toString());
   }
   process(
       deploymentUnit,
       annotation.beanInterface(),
       annotation.beanName(),
       annotation.lookup(),
       classInfo,
       null,
       annotation.name(),
       eeModuleDescription);
 }
예제 #3
0
파일: MockHelper.java 프로젝트: enenuki/phd
/* 285:    */   
/* 286:    */   static AnnotationTarget getTarget(ServiceRegistry serviceRegistry, ClassInfo classInfo, String name, TargetType type)
/* 287:    */   {
/* 288:322 */     Class clazz = ((ClassLoaderService)serviceRegistry.getService(ClassLoaderService.class)).classForName(classInfo.toString());
/* 289:    */     Method method;
/* 290:323 */     switch (1.$SwitchMap$org$hibernate$metamodel$source$annotations$xml$mocker$MockHelper$TargetType[type.ordinal()])
/* 291:    */     {
/* 292:    */     case 1: 
/* 293:325 */       Field field = getField(clazz, name);
/* 294:326 */       if (field == null) {
/* 295:327 */         throw new HibernateException("Unable to load field " + name + " of class " + clazz.getName());
/* 296:    */       }
/* 297:334 */       return FieldInfo.create(classInfo, name, getType(field.getType()), (short)field.getModifiers());
/* 298:    */     case 2: 
/* 299:338 */       method = getMethod(clazz, name);
/* 300:339 */       if (method == null) {
/* 301:340 */         throw new HibernateException("Unable to load method " + name + " of class " + clazz.getName());
/* 302:    */       }
/* 303:346 */       return getMethodInfo(classInfo, method);
/* 304:    */     case 3: 
예제 #4
0
 @Override
 public String toString() {
   return classInfo.toString();
 }