Пример #1
0
  /**
   * @param managerClass
   * @param parent
   * @param dialogName
   */
  public CustomDialog(Class<T> managerClass, AppFrame parent, String dialogName) {

    super(parent);

    this.managerClass = managerClass;

    this.parent = parent;
    this.dialogName = dialogName;

    try {
      manager = (T) Class.forName(managerClass.getSimpleName()).newInstance();
    } catch (InstantiationException | ClassNotFoundException | IllegalAccessException ex) {
      logger.error(ex);
    }
  }
 private List<TypeSymbol> resolveInterfaces(
     final JavacNode annotationNode,
     final Class<? extends java.lang.annotation.Annotation> annotationType,
     final List<Object> listenerInterfaces) {
   List<TypeSymbol> resolvedInterfaces = new ArrayList<TypeSymbol>();
   for (Object listenerInterface : listenerInterfaces) {
     if (listenerInterface instanceof JCFieldAccess) {
       JCFieldAccess interfaze = (JCFieldAccess) listenerInterface;
       if ("class".equals(As.string(interfaze.name))) {
         Type interfaceType = CLASS.resolveMember(annotationNode, interfaze.selected);
         if (interfaceType == null) continue;
         if (interfaceType.isInterface()) {
           TypeSymbol interfaceSymbol = interfaceType.asElement();
           if (interfaceSymbol != null) resolvedInterfaces.add(interfaceSymbol);
         } else {
           annotationNode.addWarning(
               String.format(
                   "@%s works only with interfaces. %s was skipped",
                   annotationType.getName(), listenerInterface));
         }
       }
     }
   }
   return resolvedInterfaces;
 }