@@ -470,7 +470,7 @@ private Object autoCreatePropertyIfPossible(BeanWrapper bean, String propertyNam
470470 Object val = bean .isReadableProperty (propertyName ) ? bean .getPropertyValue (propertyName ) : null ;
471471
472472 LOG .debug ("Checking if auto-create is possible for property [" +propertyName +"] and type [" +type +"]" );
473- if (type != null && val == null && DomainClassArtefactHandler . isDomainClass (type )) {
473+ if (type != null && val == null && isDomainClass (type )) {
474474 if (!shouldPropertyValueSkipAutoCreate (propertyValue ) && isNullAndWritableProperty (bean , propertyName )) {
475475
476476 Object created = autoInstantiateDomainInstance (type );
@@ -504,7 +504,7 @@ private Object autoCreatePropertyIfPossible(BeanWrapper bean, String propertyNam
504504 int index = Integer .parseInt (indexString );
505505
506506
507- if (DomainClassArtefactHandler . isDomainClass (referencedType )) {
507+ if (isDomainClass (referencedType )) {
508508 Object instance = findIndexedValue (c , index );
509509 if (instance != null ) {
510510 val = instance ;
@@ -546,7 +546,7 @@ else if(type!=null && Map.class.isAssignableFrom(type)) {
546546 if (currentKeyStart > -1 && currentKeyEnd > -1 ) {
547547 String indexString = propertyNameWithIndex .substring (currentKeyStart +1 , currentKeyEnd );
548548 Class referencedType = getReferencedTypeForCollection (propertyName , beanInstance );
549- if (DomainClassArtefactHandler . isDomainClass (referencedType )) {
549+ if (isDomainClass (referencedType )) {
550550 final Object domainInstance = autoInstantiateDomainInstance (referencedType );
551551 val = domainInstance ;
552552 map .put (indexString , domainInstance );
@@ -558,6 +558,10 @@ else if(type!=null && Map.class.isAssignableFrom(type)) {
558558 return val ;
559559 }
560560
561+ private boolean isDomainClass (final Class clazz ) {
562+ return DomainClassArtefactHandler .isDomainClass (clazz ) || AnnotationDomainClassArtefactHandler .isJPADomainClass (clazz );
563+ }
564+
561565 private boolean shouldPropertyValueSkipAutoCreate (Object propertyValue ) {
562566 return (propertyValue instanceof Map ) || ((propertyValue instanceof String ) && StringUtils .isBlank ((String ) propertyValue ));
563567 }
@@ -570,7 +574,7 @@ private Collection decorateCollectionForDomainAssociation(Collection c, final Cl
570574 }
571575
572576 private boolean canDecorateWithListOrderedSet (Collection c , Class referencedType ) {
573- return (c instanceof Set ) && !(c instanceof ListOrderedSet ) && !(c instanceof SortedSet ) && DomainClassArtefactHandler . isDomainClass (referencedType );
577+ return (c instanceof Set ) && !(c instanceof ListOrderedSet ) && !(c instanceof SortedSet ) && isDomainClass (referencedType );
574578 }
575579
576580 private Object findIndexedValue (Collection c , int index ) {
@@ -776,7 +780,7 @@ private void associateObjectForId(PropertyValue pv, Object id, Class associatedT
776780 }
777781
778782 private boolean isDomainAssociation (Class associatedType ) {
779- return associatedType != null && DomainClassArtefactHandler . isDomainClass (associatedType );
783+ return associatedType != null && isDomainClass (associatedType );
780784 }
781785
782786 private void addAssociationToTarget (String name , Object target , Object obj ) {
0 commit comments