@@ -158,14 +158,17 @@ public void setProxyInterfaceName(String proxyInterfaceName) {
158
158
this .proxyInterface = null ;
159
159
}
160
160
161
+ private Class <?> getClassForName (String className ) {
162
+ return classForName ( className , metadataBuildingContext .getBootstrapContext () );
163
+ }
164
+
161
165
public Class <?> getMappedClass () throws MappingException {
162
166
if ( className == null ) {
163
167
return null ;
164
168
}
165
-
166
169
try {
167
170
if ( mappedClass == null ) {
168
- mappedClass = classForName ( className , metadataBuildingContext . getBootstrapContext () );
171
+ mappedClass = getClassForName ( className );
169
172
}
170
173
return mappedClass ;
171
174
}
@@ -180,7 +183,7 @@ public Class<?> getProxyInterface() {
180
183
}
181
184
try {
182
185
if ( proxyInterface == null ) {
183
- proxyInterface = classForName ( proxyInterfaceName , metadataBuildingContext . getBootstrapContext () );
186
+ proxyInterface = getClassForName ( proxyInterfaceName );
184
187
}
185
188
return proxyInterface ;
186
189
}
@@ -538,26 +541,26 @@ else if ( identifierProperty == null && getIdentifierMapper() != null ) {
538
541
}
539
542
540
543
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 ;
547
550
}
548
551
}
549
552
throw new MappingException ( "property [" + propertyName + "] not found on entity [" + getEntityName () + "]" );
550
553
}
551
554
552
555
public Property getProperty (String propertyName ) throws MappingException {
553
- Property identifierProperty = getIdentifierProperty ();
556
+ final Property identifierProperty = getIdentifierProperty ();
554
557
if ( identifierProperty != null
555
558
&& identifierProperty .getName ().equals ( root ( propertyName ) ) ) {
556
559
return identifierProperty ;
557
560
}
558
561
else {
559
562
List <Property > closure = getPropertyClosure ();
560
- Component identifierMapper = getIdentifierMapper ();
563
+ final Component identifierMapper = getIdentifierMapper ();
561
564
if ( identifierMapper != null ) {
562
565
closure = new JoinedList <>( identifierMapper .getProperties (), closure );
563
566
}
@@ -577,14 +580,14 @@ public boolean hasProperty(String name) {
577
580
if ( identifierProperty != null && identifierProperty .getName ().equals ( name ) ) {
578
581
return true ;
579
582
}
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
+ }
584
588
}
589
+ return false ;
585
590
}
586
-
587
- return false ;
588
591
}
589
592
590
593
/**
@@ -644,9 +647,9 @@ public void validate(Metadata mapping) throws MappingException {
644
647
645
648
private void checkPropertyDuplication () throws MappingException {
646
649
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 () );
650
653
}
651
654
}
652
655
}
0 commit comments