Package java.lang.annotation

Examples of java.lang.annotation.Annotation


            for(Field f : cls.getDeclaredFields()) {
                if(f.getName().startsWith("this$")) {// for anonymous class
                    f.setAccessible(true);
                    injectFieldResource(f.get(target), annCls, injector); // recursion
                } else {
                    Annotation ann = f.getAnnotation(annCls);
                    if(ann != null) {
                        injector.inject(f, target, ann);
                    }
                }
            }
View Full Code Here


    Method[] methods = actionClass.getMethods();

    NavigationReader reader = null;
    Method containingMethod = null;
    Annotation annotationFound = null;

    boolean found = false;

    for (Method method : methods)
    {

      NavigationReader tempReader = null;
      Annotation tempAnnotation = null;

      Annotation[] annotations = method.getAnnotations();

      for (Annotation annotation : annotations)
      {
View Full Code Here

            }
            if (annotationTarget == null) {
                return;
            }

            Annotation optional = annotationTarget.getAnnotation(Optional.class);
            if (optional == null) {
                propertyInfo.setNotNullValidator(notNullValidator);
            }

            propertyInfo.attachActions(handler);
View Full Code Here

  /**
   * Create a field config from the javax.persistence annotations associated with the field argument. Returns null if
   * none.
   */
  public static DatabaseFieldConfig createFieldConfig(DatabaseType databaseType, Field field) throws SQLException {
    Annotation columnAnnotation = null;
    Annotation idAnnotation = null;
    Annotation generatedValueAnnotation = null;
    Annotation oneToOneAnnotation = null;
    Annotation manyToOneAnnotation = null;

    for (Annotation annotation : field.getAnnotations()) {
      Class<?> annotationClass = annotation.annotationType();
      if (annotationClass.getName().equals("javax.persistence.Column")) {
        columnAnnotation = annotation;
View Full Code Here

  /**
   * Return the javax.persistence.Entity annotation name for the class argument or null if none or if there was no
   * entity name.
   */
  public static String getEntityName(Class<?> clazz) {
    Annotation entityAnnotation = null;
    for (Annotation annotation : clazz.getAnnotations()) {
      Class<?> annotationClass = annotation.annotationType();
      if (annotationClass.getName().equals("javax.persistence.Entity")) {
        entityAnnotation = annotation;
      }
    }

    if (entityAnnotation == null) {
      return null;
    }
    try {
      Method method = entityAnnotation.getClass().getMethod("name");
      String name = (String) method.invoke(entityAnnotation);
      if (name != null && name.length() > 0) {
        return name;
      } else {
        return null;
View Full Code Here

        Annotation[] annotations = m.getParameterAnnotations()[index];

        for (int i = 0; i < annotations.length; i++)
        {
            Annotation annotation = annotations[i];
            if (annotation.annotationType().equals(XmlParamType.class))
            {
                return (XmlParamType) annotations[i];
            }
        }
View Full Code Here

        }
        else
        {
            for (int i = 0; i < annotations[parameter].length; i++)
            {
                Annotation annotation = annotations[parameter][i];
                if (annotation.annotationType().equals(WebParam.class))
                {
                    return true;
                }
            }
            return false;
View Full Code Here

            return null;
        }
        WebParam webParam = null;
        for (int i = 0; i < annotations[parameter].length; i++)
        {
            Annotation annotation = annotations[parameter][i];
            if (annotation.annotationType().equals(WebParam.class))
            {
                webParam = (WebParam) annotations[parameter][i];
                break;
            }
        }
View Full Code Here

                                                                    AnnotationVisitor visitor,
                                                                    Method visitorMethod) {
       
        for (U element : elements) {
            for (Class<? extends Annotation> clz : annotationTypes) {
                Annotation ann = element.getAnnotation(clz);
                if (ann != null) {
                    try {
                        visitorMethod.invoke(visitor, element, ann);
                    } catch (IllegalAccessException e) {
                        // ignore, we're invoking methods of a public interface
View Full Code Here

    }

    public static WebResult getWebResult(Method method) {

        Annotation ann = method.getAnnotation(WebResult.class);
        if (ann == null) {
            return null;
        } else {
            return (WebResult)ann;
        }
View Full Code Here

TOP

Related Classes of java.lang.annotation.Annotation

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.