Package br.gov.frameworkdemoiselle.annotation

Examples of br.gov.frameworkdemoiselle.annotation.ManagedOperation


    // Para cada metodo verifica se ele está anotado com ManagedOperation e cria um MBeanOperationInfo para ele.
    Method[] methodList = type.getMethods();
    if (methodList != null) {
      for (Method method : methodList) {
        ManagedOperation opAnnotation = method.getAnnotation(ManagedOperation.class);

        if (opAnnotation != null) {
          // Lemos as informações sobre o método e criamos uma instância
          // de MethodDetail para representar este método como uma
          // operação.

          Class<?>[] parameterTypes = method.getParameterTypes();
          Annotation[][] parameterAnnotations = method.getParameterAnnotations();
          ParameterDetail[] parameterDetails = new ParameterDetail[parameterTypes.length];
          OperationType operationType = opAnnotation.type();

          for (int i = 0; i < parameterTypes.length; i++) {
            OperationParameter paramAnnotation = null;
            for (Annotation annotation : parameterAnnotations[i]) {
              if (annotation.annotationType() == OperationParameter.class) {
                paramAnnotation = (OperationParameter) annotation;
                break;
              }
            }

            String name = paramAnnotation != null ? paramAnnotation.name() : ("arg" + i);
            String description = paramAnnotation != null ? paramAnnotation.description() : null;

            parameterDetails[i] = new ParameterDetail(parameterTypes[i], name, description);
          }

          // Com todas as informações, criamos nossa instância de MethodDetail e
          // acrescentamos na lista de todas as operações.
          MethodDetail detail = new MethodDetail(method, opAnnotation.description(), operationType, parameterDetails);
          operationMethods.put(method.getName(), detail);
        }
      }
    }
  }
View Full Code Here


    // Para cada metodo verifica se ele está anotado com ManagedOperation e cria um MBeanOperationInfo para ele.
    Method[] methodList = type.getMethods();
    if (methodList != null) {
      for (Method method : methodList) {
        ManagedOperation opAnnotation = method.getAnnotation(ManagedOperation.class);

        if (opAnnotation != null) {
          // Lemos as informações sobre o método e criamos uma instância
          // de MethodDetail para representar este método como uma
          // operação.

          Class<?>[] parameterTypes = method.getParameterTypes();
          Annotation[][] parameterAnnotations = method.getParameterAnnotations();
          ParameterDetail[] parameterDetails = new ParameterDetail[parameterTypes.length];
          OperationType operationType = opAnnotation.type();

          for (int i = 0; i < parameterTypes.length; i++) {
            OperationParameter paramAnnotation = null;
            for (Annotation annotation : parameterAnnotations[i]) {
              if (annotation.annotationType() == OperationParameter.class) {
                paramAnnotation = (OperationParameter) annotation;
                break;
              }
            }

            String name = paramAnnotation != null ? paramAnnotation.name() : ("arg" + i);
            String description = paramAnnotation != null ? paramAnnotation.description() : null;

            parameterDetails[i] = new ParameterDetail(parameterTypes[i], name, description);
          }

          // Com todas as informações, criamos nossa instância de MethodDetail e
          // acrescentamos na lista de todas as operações.
          MethodDetail detail = new MethodDetail(method, opAnnotation.description(), operationType, parameterDetails);
          operationMethods.put(method.getName(), detail);
        }
      }
    }
  }
View Full Code Here

    // Para cada metodo verifica se ele está anotado com ManagedOperation e cria um MBeanOperationInfo para ele.
    Method[] methodList = type.getMethods();
    if (methodList != null) {
      for (Method method : methodList) {
        ManagedOperation opAnnotation = method.getAnnotation(ManagedOperation.class);

        if (opAnnotation != null) {
          // Lemos as informações sobre o método e criamos uma instância
          // de MethodDetail para representar este método como uma
          // operação.

          Class<?>[] parameterTypes = method.getParameterTypes();
          Annotation[][] parameterAnnotations = method.getParameterAnnotations();
          ParameterDetail[] parameterDetails = new ParameterDetail[parameterTypes.length];
          OperationType operationType = opAnnotation.type();

          for (int i = 0; i < parameterTypes.length; i++) {
            OperationParameter paramAnnotation = null;
            for (Annotation annotation : parameterAnnotations[i]) {
              if (annotation.annotationType() == OperationParameter.class) {
                paramAnnotation = (OperationParameter) annotation;
                break;
              }
            }

            String name = paramAnnotation != null ? paramAnnotation.name() : ("arg" + i);
            String description = paramAnnotation != null ? paramAnnotation.description() : null;

            parameterDetails[i] = new ParameterDetail(parameterTypes[i], name, description);
          }

          // Com todas as informações, criamos nossa instância de MethodDetail e
          // acrescentamos na lista de todas as operações.
          MethodDetail detail = new MethodDetail(method, opAnnotation.description(), operationType, parameterDetails);
          operationMethods.put(method.getName(), detail);
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of br.gov.frameworkdemoiselle.annotation.ManagedOperation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.