1919
2020package com .navercorp .fixturemonkey .api .matcher ;
2121
22+ import static org .apiguardian .api .API .Status .INTERNAL ;
23+
2224import java .util .ArrayList ;
2325import java .util .Collections ;
2426import java .util .Comparator ;
2830import java .util .concurrent .atomic .AtomicInteger ;
2931import java .util .stream .Collectors ;
3032
33+ import org .apiguardian .api .API ;
34+
3135import com .navercorp .fixturemonkey .api .property .Property ;
3236import com .navercorp .fixturemonkey .api .type .Types ;
3337import com .navercorp .fixturemonkey .api .type .Types .UnidentifiableType ;
3438
39+ /**
40+ * It is for internal use only.
41+ */
42+ @ API (since = "1.1.16" , status = INTERNAL )
3543public final class DefaultMatcherOperatorContainer <T >
3644 implements MatcherOperatorRegistry <T >, MatcherOperatorRetriever <T > {
3745 private final AtomicInteger sequenceIssuer = new AtomicInteger (0 );
@@ -54,17 +62,21 @@ public List<MatcherOperator<T>> getListByProperty(Property property) {
5462 Class <?> propertyType = Types .getActualType (property .getType ());
5563 List <PriorityMatcherOperator <T >> acc = new ArrayList <>(typeUnknownIntrospectors );
5664
57- if (propertyType != UnidentifiableType .class ) {
58- for (Map .Entry <Class <?>, List <PriorityMatcherOperator <T >>> e : typeAssignableIntrospectors .entrySet ()) {
59- Class <?> anchorType = e .getKey ();
60- if (anchorType .isAssignableFrom (propertyType )) {
61- acc .addAll (e .getValue ());
62- }
63- }
65+ if (propertyType == UnidentifiableType .class ) {
66+ return typeAssignableIntrospectors .getOrDefault (propertyType , Collections .emptyList ()).stream ()
67+ .map (it -> (MatcherOperator <T >)it )
68+ .collect (Collectors .toList ());
69+ }
6470
65- acc .addAll (typeAwareIntrospectors .getOrDefault (propertyType , Collections .emptyList ()));
71+ for (Map .Entry <Class <?>, List <PriorityMatcherOperator <T >>> e : typeAssignableIntrospectors .entrySet ()) {
72+ Class <?> anchorType = e .getKey ();
73+ if (anchorType .isAssignableFrom (propertyType )) {
74+ acc .addAll (e .getValue ());
75+ }
6676 }
6777
78+ acc .addAll (typeAwareIntrospectors .getOrDefault (propertyType , Collections .emptyList ()));
79+
6880 return acc .stream ()
6981 .sorted (Comparator .comparingInt (PriorityMatcherOperator ::getPriority ))
7082 .map (op -> (MatcherOperator <T >)op )
0 commit comments