Package org.milyn.scribe.annotation

Examples of org.milyn.scribe.annotation.Update


   * @param method
   */
  private void analyzeUpdateMethod(final AnnotatedMethod aMethod) {
    Method method = aMethod.getMethod();

    Update annotation = aMethod.getAnnotation(Update.class);

    String name = annotation.name();
    if(name.length() == 0) {
      name = method.getName();
    }

    assertUniqueName(updateMethods, Update.class, name);

    if(annotation.isDefault() && defaultUpdateMethod != null) {
      throw new IllegalAnnotationUsageException("At least two methods are annotated with the '"+ Update.class.getName() +"' having the isDefault on true. Only one method per class is allowed to be the default update method.");
    }
    if(method.getParameterTypes().length == 0) {
      throw new IllegalAnnotationUsageException("The Update annotated method '"+ method +"' of the DAO class '"+ daoClass.getName() +"' doesn't have any parameters.");
    }
    if(method.getParameterTypes().length > 1) {
      throw new IllegalAnnotationUsageException("The Update annotated method '"+ method +"' of the DAO class '"+ daoClass.getName() +"' has more then 1 parameter, which isn't allowed.");
    }


    boolean returnsEntity  = !method.isAnnotationPresent(ReturnsNoEntity.class);

    EntityMethod updateMethod = new EntityMethod(method, returnsEntity);

    if(annotation.isDefault()) {
      defaultUpdateMethod = updateMethod;
    }
    updateMethods.put(name, updateMethod);
  }
View Full Code Here

TOP

Related Classes of org.milyn.scribe.annotation.Update

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.