private void configureDescriptions(BusAttachment busAttachment, Class<?> busInterface)
      throws AnnotationBusException {
    BusInterface ifcNote = busInterface.getAnnotation(BusInterface.class);
    if (null == ifcNote) return;

    boolean hasDescriptions = false;

    if (!ifcNote.description().equals("")) {
      setDescription(ifcNote.description());
      hasDescriptions = true;
    }

    for (Method method : busInterface.getMethods()) {
      String name = getName(method);

      BusMethod methodNote = method.getAnnotation(BusMethod.class);
      if (null != methodNote && (methodNote.description().length() > 0)) {
        setMemberDescription(name, methodNote.description(), false);
        hasDescriptions = true;
      }

      BusSignal signalNote = method.getAnnotation(BusSignal.class);
      if (null != signalNote && (signalNote.description().length() > 0)) {
        setMemberDescription(name, signalNote.description(), signalNote.sessionless());
        hasDescriptions = true;
      }

      BusProperty propNote = method.getAnnotation(BusProperty.class);
      if (null != propNote && (propNote.description().length() > 0)) {
        setPropertyDescription(name, propNote.description());
        hasDescriptions = true;
      }
    }

    if (hasDescriptions) {
      setDescriptionLanguage(ifcNote.descriptionLanguage());
    }

    try {
      if (ifcNote.descriptionTranslator().length() > 0) {
        // We store these so as not to create a separate instance each time it is used.
        // Although this means we'll be holding on to each instance forever this is probably
        // not a problem since most Translators will need to live forever anyway
        Translator dt = translatorCache.get(ifcNote.descriptionTranslator());
        if (null == dt) {
          Class<?> c = Class.forName(ifcNote.descriptionTranslator());
          dt = (Translator) c.newInstance();
          translatorCache.put(ifcNote.descriptionTranslator(), dt);
        }
        setDescriptionTranslator(busAttachment, dt);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
 /**
  * Get the DBus member output signature.
  *
  * @param method the method
  */
 public static String getOutSig(Method method) throws AnnotationBusException {
   BusMethod busMethod = method.getAnnotation(BusMethod.class);
   if (busMethod != null && busMethod.replySignature().length() > 0) {
     return Signature.typeSig(method.getGenericReturnType(), busMethod.replySignature());
   }
   BusSignal busSignal = method.getAnnotation(BusSignal.class);
   if (busSignal != null && busSignal.replySignature().length() > 0) {
     return Signature.typeSig(method.getGenericReturnType(), busSignal.replySignature());
   }
   return Signature.typeSig(method.getGenericReturnType(), null);
 }
 /**
  * Get the DBus member or property name.
  *
  * @param method The method.
  */
 public static String getName(Method method) {
   BusMethod busMethod = method.getAnnotation(BusMethod.class);
   if (busMethod != null && busMethod.name().length() > 0) {
     return busMethod.name();
   }
   BusSignal busSignal = method.getAnnotation(BusSignal.class);
   if (busSignal != null && busSignal.name().length() > 0) {
     return busSignal.name();
   }
   BusProperty busProperty = method.getAnnotation(BusProperty.class);
   if (busProperty != null) {
     if (busProperty.name().length() > 0) {
       return busProperty.name();
     } else {
       /* The rest of the method name following the "get" or "set" prefix. */
       return method.getName().substring(3);
     }
   }
   return method.getName();
 }
  private Status addMembers(Class<?> busInterface) throws AnnotationBusException {
    for (Method member : members) {
      int type = INVALID;
      int annotation = 0;
      String accessPerm = null;
      BusMethod m = member.getAnnotation(BusMethod.class);
      BusSignal s = member.getAnnotation(BusSignal.class);
      AccessPermission ap = member.getAnnotation(AccessPermission.class);

      if (m != null) {
        type = METHOD_CALL;
        annotation = m.annotation();
      } else if (s != null) {
        type = SIGNAL;
        annotation = s.annotation();
      }
      if (type != INVALID) {
        if (ap != null) {
          accessPerm = ap.value();
        }

        String memberName = getName(member);
        Status status =
            addMember(
                type, memberName, getInputSig(member), getOutSig(member), annotation, accessPerm);
        if (status != Status.OK) {
          return status;
        }

        // pull out the DBus annotations
        BusAnnotations dbusAnnotations = member.getAnnotation(BusAnnotations.class);
        if (dbusAnnotations != null) {
          for (BusAnnotation busAnnotation : dbusAnnotations.value()) {
            addMemberAnnotation(memberName, busAnnotation.name(), busAnnotation.value());
          }
        }
      }
    }
    return Status.OK;
  }