private static Field findField(Class<?> beanClass, String fieldName, List<String> alreadyProcessedFieldNames) { if ( alreadyProcessedFieldNames.contains( fieldName ) ) { throw log.getIsDefinedTwiceInMappingXmlForBeanException( fieldName, beanClass ); } else { alreadyProcessedFieldNames.add( fieldName ); } final Field field = run( GetDeclaredField.action( beanClass, fieldName ) ); if ( field == null ) { throw log.getBeanDoesNotContainTheFieldException( beanClass, fieldName ); } return field; }
private static Method findGetter(Class<?> beanClass, String getterName, List<String> alreadyProcessedGetterNames) { if ( alreadyProcessedGetterNames.contains( getterName ) ) { throw log.getIsDefinedTwiceInMappingXmlForBeanException( getterName, beanClass ); } else { alreadyProcessedGetterNames.add( getterName ); } final Method method = run( GetMethodFromPropertyName.action( beanClass, getterName ) ); if ( method == null ) { throw log.getBeanDoesNotContainThePropertyException( beanClass, getterName ); } return method; }
ConstrainedExecutable build(Class<?> beanClass, List<String> alreadyProcessedGetterNames) { if ( alreadyProcessedGetterNames.contains( mainAttributeValue ) ) { throw LOG.getIsDefinedTwiceInMappingXmlForBeanException( mainAttributeValue, beanClass );
ConstrainedField build(Class<?> beanClass, List<String> alreadyProcessedFieldNames) { if ( alreadyProcessedFieldNames.contains( mainAttributeValue ) ) { throw LOG.getIsDefinedTwiceInMappingXmlForBeanException( mainAttributeValue, beanClass ); } else { alreadyProcessedFieldNames.add( mainAttributeValue ); } Field field = findField( beanClass, mainAttributeValue ); ConstraintLocation constraintLocation = ConstraintLocation.forField( field ); Set<MetaConstraint<?>> metaConstraints = constraintTypeStaxBuilders.stream() .map( builder -> builder.build( constraintLocation, java.lang.annotation.ElementType.FIELD, null ) ) .collect( Collectors.toSet() ); ContainerElementTypeConfiguration containerElementTypeConfiguration = getContainerElementTypeConfiguration( ReflectionHelper.typeOf( field ), constraintLocation ); ConstrainedField constrainedField = new ConstrainedField( ConfigurationSource.XML, field, metaConstraints, containerElementTypeConfiguration.getMetaConstraints(), getCascadingMetaData( containerElementTypeConfiguration.getTypeParametersCascadingMetaData(), ReflectionHelper.typeOf( field ) ) ); // ignore annotations if ( ignoreAnnotations.isPresent() ) { annotationProcessingOptions.ignoreConstraintAnnotationsOnMember( field, ignoreAnnotations.get() ); } return constrainedField; }