@@ -91,6 +91,11 @@ public class POJOPropertiesCollector
9191
9292 protected List <POJOPropertyBuilder > _creatorProperties ;
9393
94+ /**
95+ * @since 2.18
96+ */
97+ protected PotentialCreators _potentialCreators ;
98+
9499 /**
95100 * A set of "field renamings" that have been discovered, indicating
96101 * intended renaming of other accessors: key is the implicit original
@@ -218,6 +223,14 @@ public List<BeanPropertyDefinition> getProperties() {
218223 return new ArrayList <>(props .values ());
219224 }
220225
226+ // @since 2.18
227+ public PotentialCreators getPotentialCreators () {
228+ if (!_collected ) {
229+ collectAll ();
230+ }
231+ return _potentialCreators ;
232+ }
233+
221234 public Map <Object , AnnotatedMember > getInjectables () {
222235 if (!_collected ) {
223236 collectAll ();
@@ -626,6 +639,8 @@ protected void _addFields(Map<String, POJOPropertyBuilder> props)
626639 // Completely rewritten in 2.18
627640 protected void _addCreators (Map <String , POJOPropertyBuilder > props )
628641 {
642+ final PotentialCreators creators = new PotentialCreators ();
643+ _potentialCreators = creators ;
629644 _creatorProperties = new ArrayList <>();
630645
631646 // First, resolve explicit annotations for all potential Creators
@@ -648,35 +663,35 @@ protected void _addCreators(Map<String, POJOPropertyBuilder> props)
648663 _removeDisabledCreators (constructors );
649664 _removeDisabledCreators (factories );
650665
651- final PotentialCreators collector = new PotentialCreators ();
652666 // and use annotations to find explicitly chosen Creators
653667 if (_useAnnotations ) { // can't have explicit ones without Annotation introspection
654668 // Start with Constructors as they have higher precedence:
655- _addExplicitlyAnnotatedCreators (collector , constructors , props , false );
669+ _addExplicitlyAnnotatedCreators (creators , constructors , props , false );
656670 // followed by Factory methods (lower precedence)
657- _addExplicitlyAnnotatedCreators (collector , factories , props ,
658- collector .hasPropertiesBased ());
671+ _addExplicitlyAnnotatedCreators (creators , factories , props ,
672+ creators .hasPropertiesBased ());
659673 }
660674
661675 // If no Explicitly annotated creators found, look
662676 // for ones with explicitly-named ({@code @JsonProperty}) parameters
663- if (!collector .hasPropertiesBased ()) {
677+ if (!creators .hasPropertiesBased ()) {
664678 // only discover constructor Creators?
665- _addCreatorsWithAnnotatedNames (collector , constructors );
679+ _addCreatorsWithAnnotatedNames (creators , constructors );
666680 }
667681
668682 // But if no annotation-based Creators found, find/use canonical Creator
669683 // (JDK 17 Record/Scala/Kotlin)
670- if (!collector .hasPropertiesBased ()) {
684+ if (!creators .hasPropertiesBased ()) {
671685 // for Records:
672686 if ((canonical != null ) && constructors .contains (canonical )) {
673687 constructors .remove (canonical );
674- collector .addPropertiesBased (_config , canonical , "canonical" );
688+ creators .addPropertiesBased (_config , canonical , "canonical" );
675689 }
676690 }
677691
678- // And finally add logical properties:
679- PotentialCreator primary = collector .propertiesBased ;
692+ // And finally add logical properties for the One Properties-based
693+ // creator selected (if any):
694+ PotentialCreator primary = creators .propertiesBased ;
680695 if (primary != null ) {
681696 _addCreatorParams (props , primary );
682697 }
0 commit comments