Codota Logo
AnnotatedMethod
Code IndexAdd Codota to your IDE (free)

How to use
AnnotatedMethod
in
org.milyn.annotation

Best Java code snippets using org.milyn.annotation.AnnotatedMethod (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Connection c =
  • Codota IconDataSource dataSource;dataSource.getConnection()
  • Codota IconString url;DriverManager.getConnection(url)
  • Codota IconIdentityDatabaseUtil.getDBConnection()
  • Smart code suggestions by Codota
}
origin: smooks/smooks

if(method.getAllAnnotations().length > 0) {
  if(method.isAnnotationPresent(Insert.class)) {
  } else if(method.isAnnotationPresent(Update.class)) {
  } else if(method.isAnnotationPresent(Delete.class)) {
  } else if(method.isAnnotationPresent(Flush.class)) {
  } else if(method.isAnnotationPresent(Lookup.class)) {
  } else if(method.isAnnotationPresent(LookupByQuery.class)) {
origin: smooks/smooks

/**
 *
 */
private void analyzeParameters() {
  final AnnotatedMethod aMethod = AnnotationManager.getAnnotatedClass(method.getDeclaringClass()).getAnnotatedMethod(method);
  final Annotation[][] parameterAnnotations = aMethod.getParameterAnnotations();
  int parameterSize = aMethod.getMethod().getParameterTypes().length;
  for(int i = 0; i < parameterAnnotations.length; i++) {
    for(final Annotation annotation : parameterAnnotations[i]) {
      if(Param.class.equals(annotation.annotationType())) {
        namedParameters = true;
        final Param param = (Param) annotation;
        final String name = param.value().trim();
        if(name.length() == 0) {
          throw new RuntimeException("Illegal empty parameter value encounterd on parameter " + i
              + " of method '" + method + "' from class '" + method.getDeclaringClass().getName() +"'.");
        }
        if(parameterPositions == null) {
          parameterPositions = new HashMap<String, Integer>();
        }
        parameterPositions.put(param.value(), i);
        break;
      }
    }
  }
  if(namedParameters && parameterPositions.size() != parameterSize) {
    throw new RuntimeException("Not all the parameters of the method '" + method.getDeclaringClass().getName() + "." + method + "' are annotated with the '" + Param.class.getName() + "' annotation."
        + " All the parameters of the method need to be have the '" + Param.class.getName() + "' annotation when using the annotation on a method.");
  }
}
origin: smooks/smooks

/**
 * @param method
 */
private void analyzeFindByMethod(final AnnotatedMethod aMethod) {
  Method method = aMethod.getMethod();
  Lookup findByAnnotation = aMethod.getAnnotation(Lookup.class);
  String name = findByAnnotation.name();
  if(name.trim().length() == 0) {
    name = method.getName();
  }
  assertUniqueName(lookupWithNamedParameters, Lookup.class, name);
  if(void.class.equals(method.getReturnType())){
    throw new IllegalAnnotationUsageException("The FindBy annotated method '"+ method +"' of the DAO class '"+ daoClass.getName() +"' " +
        "returns void, which isn't allowed. The method must return something.");
  }
  lookupWithNamedParameters.put(name, new LookupMethod(method));
}
origin: org.milyn/milyn-commons

/**
 * @param result is the map of classes to annotations to fill
 * @param annotatedMethod the method to get annotations. Does nothing
 * if the annotated method is null.
 */
private void fillAnnotationsForOneMethod(final HashMap<Class<?>, Annotation> result,
    final AnnotatedMethod annotatedMethod) {
  if (annotatedMethod == null) {
    return;
  }
  addAnnotations(result, annotatedMethod.getAllAnnotations());
}
origin: org.milyn/milyn-commons

final Annotation[][] paramAnnotations = aMethod.getParameterAnnotations();
final Annotation[][] paramAnnotations = aMethod.getParameterAnnotations();
origin: org.milyn/milyn-smooks-all

/**
 * @param method
 */
private void analyzeFlushMethod(final AnnotatedMethod aMethod) {
  Method method = aMethod.getMethod();
  if(flushMethod != null) {
    throw new IllegalAnnotationUsageException("At least two methods are annotated with the '"+ Flush.class.getName() +"'. Only one method per class is allowed to be the flush method.");
  }
  if(method.getParameterTypes().length > 0) {
    throw new IllegalAnnotationUsageException("The Flush annotated method '"+ method +"' of the DAO class '"+ daoClass.getName() +"' has parameters, which isn't allowed.");
  }
  flushMethod = new FlushMethod(method);
}
origin: smooks/smooks

/**
 * @param result is the map of classes to annotations to fill
 * @param annotatedMethod the method to get annotations. Does nothing
 * if the annotated method is null.
 */
private void fillAnnotationsForOneMethod(final HashMap<Class<?>, Annotation> result,
    final AnnotatedMethod annotatedMethod) {
  if (annotatedMethod == null) {
    return;
  }
  addAnnotations(result, annotatedMethod.getAllAnnotations());
}
origin: smooks/smooks

final Annotation[][] paramAnnotations = aMethod.getParameterAnnotations();
final Annotation[][] paramAnnotations = aMethod.getParameterAnnotations();
origin: smooks/smooks

/**
 * @param method
 */
private void analyzeFlushMethod(final AnnotatedMethod aMethod) {
  Method method = aMethod.getMethod();
  if(flushMethod != null) {
    throw new IllegalAnnotationUsageException("At least two methods are annotated with the '"+ Flush.class.getName() +"'. Only one method per class is allowed to be the flush method.");
  }
  if(method.getParameterTypes().length > 0) {
    throw new IllegalAnnotationUsageException("The Flush annotated method '"+ method +"' of the DAO class '"+ daoClass.getName() +"' has parameters, which isn't allowed.");
  }
  flushMethod = new FlushMethod(method);
}
origin: org.milyn/milyn-smooks-all

/**
 * @param method
 */
private void analyzeFindByMethod(final AnnotatedMethod aMethod) {
  Method method = aMethod.getMethod();
  Lookup findByAnnotation = aMethod.getAnnotation(Lookup.class);
  String name = findByAnnotation.name();
  if(name.trim().length() == 0) {
    name = method.getName();
  }
  assertUniqueName(lookupWithNamedParameters, Lookup.class, name);
  if(void.class.equals(method.getReturnType())){
    throw new IllegalAnnotationUsageException("The FindBy annotated method '"+ method +"' of the DAO class '"+ daoClass.getName() +"' " +
        "returns void, which isn't allowed. The method must return something.");
  }
  lookupWithNamedParameters.put(name, new LookupMethod(method));
}
origin: org.milyn/milyn-smooks-all

/**
 *
 */
private void analyzeParameters() {
  final AnnotatedMethod aMethod = AnnotationManager.getAnnotatedClass(method.getDeclaringClass()).getAnnotatedMethod(method);
  final Annotation[][] parameterAnnotations = aMethod.getParameterAnnotations();
  int parameterSize = aMethod.getMethod().getParameterTypes().length;
  for(int i = 0; i < parameterAnnotations.length; i++) {
    for(final Annotation annotation : parameterAnnotations[i]) {
      if(Param.class.equals(annotation.annotationType())) {
        namedParameters = true;
        final Param param = (Param) annotation;
        final String name = param.value().trim();
        if(name.length() == 0) {
          throw new RuntimeException("Illegal empty parameter value encounterd on parameter " + i
              + " of method '" + method + "' from class '" + method.getDeclaringClass().getName() +"'.");
        }
        if(parameterPositions == null) {
          parameterPositions = new HashMap<String, Integer>();
        }
        parameterPositions.put(param.value(), i);
        break;
      }
    }
  }
  if(namedParameters && parameterPositions.size() != parameterSize) {
    throw new RuntimeException("Not all the parameters of the method '" + method.getDeclaringClass().getName() + "." + method + "' are annotated with the '" + Param.class.getName() + "' annotation."
        + " All the parameters of the method need to be have the '" + Param.class.getName() + "' annotation when using the annotation on a method.");
  }
}
origin: org.milyn/milyn-smooks-all

if(method.getAllAnnotations().length > 0) {
  if(method.isAnnotationPresent(Insert.class)) {
  } else if(method.isAnnotationPresent(Update.class)) {
  } else if(method.isAnnotationPresent(Delete.class)) {
  } else if(method.isAnnotationPresent(Flush.class)) {
  } else if(method.isAnnotationPresent(Lookup.class)) {
  } else if(method.isAnnotationPresent(LookupByQuery.class)) {
origin: org.milyn/milyn-smooks-all

/**
 * @param result is the map of classes to annotations to fill
 * @param annotatedMethod the method to get annotations. Does nothing
 * if the annotated method is null.
 */
private void fillAnnotationsForOneMethod(final HashMap<Class<?>, Annotation> result,
    final AnnotatedMethod annotatedMethod) {
  if (annotatedMethod == null) {
    return;
  }
  addAnnotations(result, annotatedMethod.getAllAnnotations());
}
origin: org.milyn/milyn-smooks-all

final Annotation[][] paramAnnotations = aMethod.getParameterAnnotations();
final Annotation[][] paramAnnotations = aMethod.getParameterAnnotations();
origin: org.milyn/milyn-smooks-all

Method method = aMethod.getMethod();
origin: smooks/smooks

/**
 * @param method
 */
private void analyzeDeleteMethod(final AnnotatedMethod aMethod) {
  Method method = aMethod.getMethod();
  Delete annotation = aMethod.getAnnotation(Delete.class);
  String name = annotation.name();
  if(name.length() == 0) {
    name = method.getName();
  }
  assertUniqueName(deleteMethods, Delete.class, name);
  if(annotation.isDefault() && defaultDeleteMethod != null) {
    throw new IllegalAnnotationUsageException("At least two methods are annotated with the '"+ Delete.class.getName() +"' annotation having the isDefault on true. Only one method per class is allowed to be the default delete method.");
  }
  if(method.getParameterTypes().length == 0) {
    throw new IllegalAnnotationUsageException("The Delete annotated method '"+ method +"' of the DAO class '"+ daoClass.getName() +"' doesn't have a parameter, which it needs.");
  }
  if(method.getParameterTypes().length > 1) {
    throw new IllegalAnnotationUsageException("The Delete annotated method '"+ method +"'  the DAO class '"+ daoClass.getName() +"' has more then 1 parameter, which isn't allowed.");
  }
  boolean returnsEntity  = !method.isAnnotationPresent(ReturnsNoEntity.class);
  EntityMethod deleteMethod = new EntityMethod(method, returnsEntity);
  if(annotation.isDefault()) {
    defaultDeleteMethod = deleteMethod;
  }
  deleteMethods.put(name, deleteMethod);
}
origin: smooks/smooks

Method method = aMethod.getMethod();
origin: smooks/smooks

/**
 * @param method
 */
private void analyzeInsertMethod(final AnnotatedMethod aMethod) {
  Method method = aMethod.getMethod();
  Insert annotation = aMethod.getAnnotation(Insert.class);
  String name = annotation.name();
  if(name.length() == 0) {
    name = method.getName();
  }
  assertUniqueName(insertMethods, Insert.class, name);
  if(annotation.isDefault() && defaultInsertMethod != null) {
    throw new IllegalAnnotationUsageException("At least two methods are annotated with the '"+ Insert.class.getName() +"'annotation having the isDefault on true. Only one method per class is allowed to be the default insert method.");
  }
  if(method.getParameterTypes().length == 0) {
    throw new IllegalAnnotationUsageException("The Insert annotated method '"+ method +"' of the DAO class '"+ daoClass.getName() +"'  doesn't have any parameters.");
  }
  if(method.getParameterTypes().length > 1) {
    throw new IllegalAnnotationUsageException("The Insert 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 insertMethod = new EntityMethod(method, returnsEntity);
  if(annotation.isDefault()) {
    defaultInsertMethod = insertMethod;
  }
  insertMethods.put(name, insertMethod);
}
origin: org.milyn/milyn-smooks-all

/**
 * @param method
 */
private void analyzeDeleteMethod(final AnnotatedMethod aMethod) {
  Method method = aMethod.getMethod();
  Delete annotation = aMethod.getAnnotation(Delete.class);
  String name = annotation.name();
  if(name.length() == 0) {
    name = method.getName();
  }
  assertUniqueName(deleteMethods, Delete.class, name);
  if(annotation.isDefault() && defaultDeleteMethod != null) {
    throw new IllegalAnnotationUsageException("At least two methods are annotated with the '"+ Delete.class.getName() +"' annotation having the isDefault on true. Only one method per class is allowed to be the default delete method.");
  }
  if(method.getParameterTypes().length == 0) {
    throw new IllegalAnnotationUsageException("The Delete annotated method '"+ method +"' of the DAO class '"+ daoClass.getName() +"' doesn't have a parameter, which it needs.");
  }
  if(method.getParameterTypes().length > 1) {
    throw new IllegalAnnotationUsageException("The Delete annotated method '"+ method +"'  the DAO class '"+ daoClass.getName() +"' has more then 1 parameter, which isn't allowed.");
  }
  boolean returnsEntity  = !method.isAnnotationPresent(ReturnsNoEntity.class);
  EntityMethod deleteMethod = new EntityMethod(method, returnsEntity);
  if(annotation.isDefault()) {
    defaultDeleteMethod = deleteMethod;
  }
  deleteMethods.put(name, deleteMethod);
}
origin: smooks/smooks

/**
 * @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);
}
org.milyn.annotationAnnotatedMethod

Javadoc

The annotated method is a wrapping for some method providing inheritance of all annotations of the method being overridden by this one. If the same method has different annotations in different superclasses or superinterface, the last annotation met is taken. So you better maintain the same annotations in this case. Note: This class is a modified version of the original Fusionsoft Annotation library. See: http://www.fusionsoft-online.com/articles-java-annotations.php

Most used methods

  • getAllAnnotations
  • getParameterAnnotations
    Returns an array of arrays that represent the annotations on the formal parameters, in declaration o
  • getAnnotation
  • getMethod
  • isAnnotationPresent
    Returns true if an annotation for the specified type is present on this element, else false.

Popular in Java

  • Running tasks concurrently on multiple threads
  • getContentResolver (Context)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • addToBackStack (FragmentTransaction)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • FileWriter (java.io)
    Convenience class for writing character files. The constructors of this class assume that the defaul
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • LogFactory (org.apache.commons.logging)
    A minimal incarnation of Apache Commons Logging's LogFactory API, providing just the common Log look
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now