2929import  java .util .concurrent .locks .Lock ;
3030import  java .util .concurrent .locks .ReentrantReadWriteLock ;
3131import  java .util .function .Predicate ;
32+ import  java .util .regex .Pattern ;
3233import  java .util .stream .Collectors ;
3334
3435import  org .apache .commons .logging .Log ;
9394 * @author Mark Paluch 
9495 * @author Mikael Klamra 
9596 * @author Christoph Strobl 
97+  * @author Kamil Krzywański 
9698 */ 
9799public  abstract  class  AbstractMappingContext <E  extends  MutablePersistentEntity <?, P >, P  extends  PersistentProperty <P >>
98100		implements  MappingContext <E , P >, ApplicationEventPublisherAware , ApplicationContextAware , BeanFactoryAware ,
@@ -819,8 +821,8 @@ public boolean matches(Property property) {
819821		 */ 
820822		static  class  PropertyMatch  {
821823
822- 			 private  final  @ Nullable  String   namePattern ;
823- 			 private  final  @ Nullable  String  typeName ;
824+              private  final  @ Nullable  Pattern   namePatternRegex ;
825+              private  final  @ Nullable  String  typeName ;
824826
825827			/** 
826828			 * Creates a new {@link PropertyMatch} for the given name pattern and type name. At least one of the parameters 
@@ -833,8 +835,8 @@ public PropertyMatch(@Nullable String namePattern, @Nullable String typeName) {
833835
834836				Assert .isTrue (!((namePattern  == null ) && (typeName  == null )), "Either name pattern or type name must be given" );
835837
836- 				 this .namePattern  =  namePattern ;
837- 				 this .typeName  = typeName ;
838+                  this .namePatternRegex  =  namePattern  ==  null  ?  null  :  Pattern . compile ( namePattern ) ;
839+                  this .typeName  = typeName ;
838840			}
839841
840842			/** 
@@ -869,9 +871,9 @@ public boolean matches(String name, Class<?> type) {
869871				Assert .notNull (name , "Name must not be null" );
870872				Assert .notNull (type , "Type must not be null" );
871873
872- 				 if  (( namePattern  != null )  && !name .matches (namePattern )) {
873- 					 return  false ;
874- 				 }
874+                  if  (namePatternRegex  != null  && !namePatternRegex . matcher ( name ) .matches ()) {
875+                      return  false ;
876+                  }
875877
876878				if  ((typeName  != null ) && !type .getName ().equals (typeName )) {
877879					return  false ;
0 commit comments