Examples of AnnotationIgnores


Examples of org.apache.bval.jsr.xml.AnnotationIgnores

                contructorConstraints.put(Arrays.toString(cons.getParameterTypes()), consDesc);

                final List<String> names = factoryContext.getParameterNameProvider().getParameterNames(cons);
                final boolean isInnerClass = cons.getDeclaringClass().getEnclosingClass() != null && !Modifier.isStatic(cons.getDeclaringClass().getModifiers());

                final AnnotationIgnores annotationIgnores = factoryContext.getFactory().getAnnotationIgnores();

                {
                    final Annotation[][] paramsAnnos = cons.getParameterAnnotations();

                    int idx = 0;
                    if (isInnerClass) { // paramsAnnos.length = parameterTypes.length - 1 in this case
                        final ParameterDescriptorImpl paramDesc = new ParameterDescriptorImpl(metaBean, EMPTY_VALIDATION, names.get(idx));
                        consDesc.getParameterDescriptors().add(paramDesc);
                        idx++;
                    }

                    for (final Annotation[] paramAnnos : paramsAnnos) {
                        if (annotationIgnores.isIgnoreAnnotationOnParameter(cons, idx)) {
                            consDesc.getParameterDescriptors().add(new ParameterDescriptorImpl(metaBean, EMPTY_VALIDATION, names.get(idx)));
                        } else if (cons.getParameterTypes().length > idx) {
                            ParameterAccess access = new ParameterAccess(cons.getParameterTypes()[idx], idx);
                            consDesc.addValidations(processAnnotations(consDesc, paramAnnos, access, idx, names.get(idx)).getValidations());
                        } // else anonymous class so that's fine
                        idx++;
                    }

                    if (!annotationIgnores.isIgnoreAnnotations(cons)) {
                        for (final Annotation anno : cons.getAnnotations()) {
                            if (!Valid.class.isInstance(anno)) {
                                processAnnotations(null, consDesc, cons.getDeclaringClass(), anno);
                            } else {
                                consDesc.setCascaded(true);
                            }
                        }
                    }
                }

                if (annotationIgnores.isIgnoreAnnotationOnCrossParameter(cons) && consDesc.getCrossParameterDescriptor() != null) {
                    consDesc.setCrossParameterDescriptor(null);
                }
                if (annotationIgnores.isIgnoreAnnotationOnReturn(cons) && consDesc.getReturnValueDescriptor() != null) {
                    consDesc.setReturnValueDescriptor(null);
                }

                final MetaConstructor metaConstructor = metaBean.getConstructor(cons);
                if (metaConstructor != null) {
View Full Code Here

Examples of org.apache.bval.jsr.xml.AnnotationIgnores

                throw new ConstraintDeclarationException(msg);
            }
        }

        private void processMethod(final Method method, final MethodDescriptorImpl methodDesc) throws InvocationTargetException, IllegalAccessException {
            final AnnotationIgnores annotationIgnores = factoryContext.getFactory().getAnnotationIgnores();


            { // reflection
                if (!annotationIgnores.isIgnoreAnnotations(method)) {
                    // return value validations and/or cross-parameter validation
                    for (final Annotation anno : method.getAnnotations()) {
                        if (anno instanceof Valid || anno instanceof Validate) {
                            methodDesc.setCascaded(true);
                        } else {
                            processAnnotations(method, methodDesc, method.getReturnType(), anno);
                        }
                    }
                }

                // parameter validations
                final Annotation[][] paramsAnnos = method.getParameterAnnotations();
                int idx = 0;
                final List<String> names = factoryContext.getParameterNameProvider().getParameterNames(method);
                for (final Annotation[] paramAnnos : paramsAnnos) {
                    if (!annotationIgnores.isIgnoreAnnotationOnParameter(method, idx)) {
                        final ParameterAccess access = new ParameterAccess(method.getParameterTypes()[idx], idx);
                        processAnnotations(methodDesc, paramAnnos, access, idx, names.get(idx));
                    } else {
                        final ParameterDescriptorImpl parameterDescriptor = new ParameterDescriptorImpl(metaBean, EMPTY_VALIDATION, names.get(idx));
                        parameterDescriptor.setIndex(idx);
                        methodDesc.getParameterDescriptors().add(parameterDescriptor);
                    }
                    idx++;
                }
            }

            if (annotationIgnores.isIgnoreAnnotationOnCrossParameter(method) && methodDesc.getCrossParameterDescriptor() != null) {
                methodDesc.setCrossParameterDescriptor(null);
            }
            if (annotationIgnores.isIgnoreAnnotationOnReturn(method) && methodDesc.getReturnValueDescriptor() != null) {
                methodDesc.setReturnValueDescriptor(null);
            }

            final MetaMethod metaMethod = metaBean.getMethod(method);
            if (metaMethod != null) {
View Full Code Here

Examples of org.hibernate.validation.engine.xml.AnnotationIgnores

  public BeanMetaDataImpl(Class<T> beanClass, ConstraintHelper constraintHelper) {
    this(
        beanClass,
        constraintHelper,
        new AnnotationIgnores()
    );
  }
View Full Code Here

Examples of org.hibernate.validation.engine.xml.AnnotationIgnores

  private <T> void initBeanMetaData(Set<InputStream> mappingStreams) {

    XmlMappingParser mappingParser = new XmlMappingParser( constraintHelper );
    mappingParser.parse( mappingStreams );

    AnnotationIgnores annotationIgnores = mappingParser.getAnnotationIgnores();
    for ( Class<?> beanClass : mappingParser.getProcessedClasses() ) {
      BeanMetaDataImpl<?> metaData = new BeanMetaDataImpl<T>(
          ( Class<T> ) beanClass, constraintHelper, annotationIgnores
      );
      for ( MetaConstraint<?, ? extends Annotation> constraint : mappingParser.getConstraintMap()
View Full Code Here

Examples of org.hibernate.validation.metadata.AnnotationIgnores

  private final Map<Class<?>, List<Member>> cascadedMembers;
  private final Map<Class<?>, List<Class<?>>> defaultSequences;

  public XmlMappingParser(ConstraintHelper constraintHelper) {
    this.constraintHelper = constraintHelper;
    this.annotationIgnores = new AnnotationIgnores();
    this.constraintMap = new HashMap<Class<?>, List<MetaConstraint<?, ? extends Annotation>>>();
    this.cascadedMembers = new HashMap<Class<?>, List<Member>>();
    this.defaultSequences = new HashMap<Class<?>, List<Class<?>>>();
  }
View Full Code Here

Examples of org.hibernate.validation.metadata.AnnotationIgnores

  private final Map<Class<?>, List<Member>> cascadedMembers;
  private final Map<Class<?>, List<Class<?>>> defaultSequences;

  public XmlMappingParser(ConstraintHelper constraintHelper) {
    this.constraintHelper = constraintHelper;
    this.annotationIgnores = new AnnotationIgnores();
    this.constraintMap = new HashMap<Class<?>, List<MetaConstraint<?, ? extends Annotation>>>();
    this.cascadedMembers = new HashMap<Class<?>, List<Member>>();
    this.defaultSequences = new HashMap<Class<?>, List<Class<?>>>();
  }
View Full Code Here

Examples of org.hibernate.validation.metadata.AnnotationIgnores

  private <T> void initBeanMetaData(Set<InputStream> mappingStreams) {

    XmlMappingParser mappingParser = new XmlMappingParser( constraintHelper );
    mappingParser.parse( mappingStreams );

    AnnotationIgnores annotationIgnores = mappingParser.getAnnotationIgnores();
    for ( Class<?> clazz : mappingParser.getProcessedClasses() ) {
      Class<T> beanClass = ( Class<T> ) clazz;
      BeanMetaDataImpl<T> metaData = new BeanMetaDataImpl<T>(
          beanClass, constraintHelper, annotationIgnores
      );
View Full Code Here

Examples of org.hibernate.validator.internal.metadata.core.AnnotationIgnores

      }
      addAll( metaDataProvider.getAllBeanConfigurations() );
    }

    if ( annotationIgnores == null ) {
      annotationIgnores = new AnnotationIgnores();
    }
  }
View Full Code Here

Examples of org.hibernate.validator.internal.metadata.core.AnnotationIgnores

  private final Map<Class<?>, List<Member>> cascadedMembers;
  private final Map<Class<?>, List<Class<?>>> defaultSequences;

  public XmlMappingParser(ConstraintHelper constraintHelper) {
    this.constraintHelper = constraintHelper;
    this.annotationIgnores = new AnnotationIgnores();
    this.constraintMap = newHashMap();
    this.cascadedMembers = newHashMap();
    this.defaultSequences = newHashMap();
  }
View Full Code Here

Examples of org.hibernate.validator.metadata.AnnotationIgnores

    XmlMappingParser mappingParser = new XmlMappingParser( constraintHelper );
    mappingParser.parse( mappingStreams );

    Set<Class<?>> processedClasses = mappingParser.getProcessedClasses();
    AnnotationIgnores annotationIgnores = mappingParser.getAnnotationIgnores();
    for ( Class<?> clazz : processedClasses ) {
      @SuppressWarnings("unchecked")
      Class<T> beanClass = ( Class<T> ) clazz;
      BeanMetaDataImpl<T> metaData = new BeanMetaDataImpl<T>(
          beanClass, constraintHelper, annotationIgnores, beanMetaDataCache
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.