@@ -158,14 +158,17 @@ public void setProxyInterfaceName(String proxyInterfaceName) {
158158 this .proxyInterface = null ;
159159 }
160160
161+ private Class <?> getClassForName (String className ) {
162+ return classForName ( className , metadataBuildingContext .getBootstrapContext () );
163+ }
164+
161165 public Class <?> getMappedClass () throws MappingException {
162166 if ( className == null ) {
163167 return null ;
164168 }
165-
166169 try {
167170 if ( mappedClass == null ) {
168- mappedClass = classForName ( className , metadataBuildingContext . getBootstrapContext () );
171+ mappedClass = getClassForName ( className );
169172 }
170173 return mappedClass ;
171174 }
@@ -180,7 +183,7 @@ public Class<?> getProxyInterface() {
180183 }
181184 try {
182185 if ( proxyInterface == null ) {
183- proxyInterface = classForName ( proxyInterfaceName , metadataBuildingContext . getBootstrapContext () );
186+ proxyInterface = getClassForName ( proxyInterfaceName );
184187 }
185188 return proxyInterface ;
186189 }
@@ -538,26 +541,26 @@ else if ( identifierProperty == null && getIdentifierMapper() != null ) {
538541 }
539542
540543 private Property getProperty (String propertyName , List <Property > properties ) throws MappingException {
541- String root = root ( propertyName );
542- for ( Property prop : properties ) {
543- if ( prop .getName ().equals ( root )
544- || ( prop instanceof Backref || prop instanceof IndexBackref )
545- && prop .getName ().equals ( propertyName ) ) {
546- return prop ;
544+ final String root = root ( propertyName );
545+ for ( Property property : properties ) {
546+ if ( property .getName ().equals ( root )
547+ || ( property instanceof Backref || property instanceof IndexBackref )
548+ && property .getName ().equals ( propertyName ) ) {
549+ return property ;
547550 }
548551 }
549552 throw new MappingException ( "property [" + propertyName + "] not found on entity [" + getEntityName () + "]" );
550553 }
551554
552555 public Property getProperty (String propertyName ) throws MappingException {
553- Property identifierProperty = getIdentifierProperty ();
556+ final Property identifierProperty = getIdentifierProperty ();
554557 if ( identifierProperty != null
555558 && identifierProperty .getName ().equals ( root ( propertyName ) ) ) {
556559 return identifierProperty ;
557560 }
558561 else {
559562 List <Property > closure = getPropertyClosure ();
560- Component identifierMapper = getIdentifierMapper ();
563+ final Component identifierMapper = getIdentifierMapper ();
561564 if ( identifierMapper != null ) {
562565 closure = new JoinedList <>( identifierMapper .getProperties (), closure );
563566 }
@@ -577,14 +580,14 @@ public boolean hasProperty(String name) {
577580 if ( identifierProperty != null && identifierProperty .getName ().equals ( name ) ) {
578581 return true ;
579582 }
580-
581- for ( Property property : getPropertyClosure () ) {
582- if ( property .getName ().equals (name ) ) {
583- return true ;
583+ else {
584+ for ( Property property : getPropertyClosure () ) {
585+ if ( property .getName ().equals ( name ) ) {
586+ return true ;
587+ }
584588 }
589+ return false ;
585590 }
586-
587- return false ;
588591 }
589592
590593 /**
@@ -644,9 +647,9 @@ public void validate(Metadata mapping) throws MappingException {
644647
645648 private void checkPropertyDuplication () throws MappingException {
646649 final HashSet <String > names = new HashSet <>();
647- for ( Property prop : getProperties () ) {
648- if ( !names .add ( prop .getName () ) ) {
649- throw new MappingException ( "Duplicate property mapping of " + prop .getName () + " found in " + getEntityName () );
650+ for ( Property property : getProperties () ) {
651+ if ( !names .add ( property .getName () ) ) {
652+ throw new MappingException ( "Duplicate property mapping of " + property .getName () + " found in " + getEntityName () );
650653 }
651654 }
652655 }
0 commit comments