@@ -210,9 +210,8 @@ private boolean interceptDataDomainQuery() {
210210 }
211211
212212 private boolean interceptOIDQuery () {
213- if (query instanceof ObjectIdQuery ) {
213+ if (query instanceof ObjectIdQuery oidQuery ) {
214214
215- ObjectIdQuery oidQuery = (ObjectIdQuery ) query ;
216215 ObjectId oid = oidQuery .getObjectId ();
217216
218217 // special handling of temp ids...
@@ -280,9 +279,8 @@ private DataRow polymorphicRowFromCache(EntityInheritanceTree superNode, ObjectI
280279
281280 private boolean interceptRelationshipQuery () {
282281
283- if (query instanceof RelationshipQuery ) {
282+ if (query instanceof RelationshipQuery relationshipQuery ) {
284283
285- RelationshipQuery relationshipQuery = (RelationshipQuery ) query ;
286284 if (relationshipQuery .isRefreshing ()) {
287285 return !DONE ;
288286 }
@@ -296,7 +294,7 @@ private boolean interceptRelationshipQuery() {
296294
297295 // we can assume that there is one and only one DbRelationship as
298296 // we previously checked that "!isSourceIndependentFromTargetChange"
299- DbRelationship dbRelationship = relationship .getDbRelationships ().get ( 0 );
297+ DbRelationship dbRelationship = relationship .getDbRelationships ().getFirst ( );
300298
301299 // FK pointing to a unique field that is a 'fake' PK (CAY-1755)...
302300 // It is not sufficient to generate target ObjectId.
@@ -398,7 +396,7 @@ private boolean interceptRefreshQuery() {
398396 return DONE ;
399397 }
400398
401- // 3. refresh query - this shouldn't normally happen as child datacontext
399+ // 3. refresh query - this shouldn't normally happen as child context
402400 // usually does a cascading refresh
403401 if (refreshQuery .getQuery () != null ) {
404402 Query cachedQuery = refreshQuery .getQuery ();
@@ -582,9 +580,9 @@ private boolean noObjectConversion() {
582580 converter = new SingleObjectConversionStrategy ();
583581 } else {
584582 if (metadata .isSingleResultSetMapping ()) {
585- if (rsMapping .get ( 0 ) instanceof EntityResultSegment ) {
583+ if (rsMapping .getFirst ( ) instanceof EntityResultSegment ) {
586584 converter = new SingleObjectConversionStrategy ();
587- } else if (rsMapping .get ( 0 ) instanceof EmbeddableResultSegment ) {
585+ } else if (rsMapping .getFirst ( ) instanceof EmbeddableResultSegment ) {
588586 converter = new SingleEmbeddableConversionStrategy ();
589587 } else {
590588 converter = new SingleScalarConversionStrategy ();
@@ -669,8 +667,7 @@ public void nextBatchCount(Query query, int[] resultCount) {
669667 @ Override
670668 public void nextRows (Query query , List <?> dataRows ) {
671669 // exclude prefetched rows in the main result
672- if (prefetchResultsByPath != null && query instanceof PrefetchSelectQuery ) {
673- PrefetchSelectQuery <?> prefetchQuery = (PrefetchSelectQuery <?>) query ;
670+ if (prefetchResultsByPath != null && query instanceof PrefetchSelectQuery <?> prefetchQuery ) {
674671 prefetchResultsByPath .put (prefetchQuery .getPrefetchPath (), dataRows );
675672 } else {
676673 fullResponse .addResultList (dataRows );
@@ -680,8 +677,7 @@ public void nextRows(Query query, List<?> dataRows) {
680677 @ Override
681678 public void nextRows (Query q , ResultIterator <?> it ) {
682679 // exclude prefetched rows in the main result
683- if (prefetchResultsByPath != null && query instanceof PrefetchSelectQuery ) {
684- PrefetchSelectQuery <?> prefetchQuery = (PrefetchSelectQuery <?>) query ;
680+ if (prefetchResultsByPath != null && query instanceof PrefetchSelectQuery <?> prefetchQuery ) {
685681 prefetchResultsByPath .put (prefetchQuery .getPrefetchPath (), (List <?>) it );
686682 } else {
687683 this .fullResponse .addResultIterator (it );
@@ -790,7 +786,7 @@ public List<Persistent> convert(List<DataRow> mainRows) {
790786 @ Override
791787 Persistent convert (DataRow dataRow ) {
792788 PrefetchProcessorNode node = getPrefetchProcessorNode (Collections .singletonList (dataRow ));
793- return node .getObjects ().get ( 0 );
789+ return node .getObjects ().getFirst ( );
794790 }
795791
796792 private PrefetchProcessorNode getPrefetchProcessorNode (List <DataRow > mainRows ) {
@@ -799,7 +795,7 @@ private PrefetchProcessorNode getPrefetchProcessorNode(List<DataRow> mainRows) {
799795 List <Object > rsMapping = metadata .getResultSetMapping ();
800796 EntityResultSegment resultSegment = null ;
801797 if (rsMapping != null && !rsMapping .isEmpty ()) {
802- resultSegment = (EntityResultSegment ) rsMapping .get ( 0 );
798+ resultSegment = (EntityResultSegment ) rsMapping .getFirst ( );
803799 }
804800
805801 ClassDescriptor descriptor = resultSegment == null
@@ -829,7 +825,7 @@ class SingleEmbeddableConversionStrategy extends ObjectConversionStrategy<DataRo
829825
830826 @ Override
831827 List <EmbeddableObject > convert (List <DataRow > mainRows ) {
832- EmbeddableResultSegment resultSegment = (EmbeddableResultSegment ) metadata .getResultSetMapping ().get ( 0 );
828+ EmbeddableResultSegment resultSegment = (EmbeddableResultSegment ) metadata .getResultSetMapping ().getFirst ( );
833829 Embeddable embeddable = resultSegment .getEmbeddable ();
834830 Class <? extends EmbeddableObject > embeddableClass = objectFactory .getJavaClass (embeddable .getClassName ());
835831 List <EmbeddableObject > result = new ArrayList <>(mainRows .size ());
@@ -849,7 +845,7 @@ List<EmbeddableObject> convert(List<DataRow> mainRows) {
849845
850846 @ Override
851847 EmbeddableObject convert (DataRow dataRow ) {
852- return convert (Collections .singletonList (dataRow )).get ( 0 );
848+ return convert (Collections .singletonList (dataRow )).getFirst ( );
853849 }
854850 }
855851
@@ -895,7 +891,7 @@ List<Object[]> convert(List<Object[]> mainRows) {
895891 Object [] convert (Object [] objectsArray ) {
896892 List <Object []> objects = new ArrayList <>(1 );
897893 objects .add (objectsArray );
898- return convert (objects ).get ( 0 );
894+ return convert (objects ).getFirst ( );
899895 }
900896
901897 private List <Object []> createResultList (List <Object []> mainRows , boolean needConversion ) {
0 commit comments