Skip to content

Commit 9f51ceb

Browse files
committed
Improve the javadoc for getExistingMapView method
1 parent d525b62 commit 9f51ceb

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

Item Creator/src/main/java/org/broken/arrow/library/itemcreator/meta/MapWrapperMeta.java

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,16 @@ public BuildMapView createMapView(@Nonnull final World world, @Nonnull final Con
7070
}
7171

7272
/**
73-
* Attempts to retrieve an existing map by already set {@link BuildMapView} instance and wraps it in a {@link BuildMapView}.
73+
* Attempts to retrieve and configure an existing {@link BuildMapView} based on the currently assigned instance.
7474
* <p>
75-
* Unlike {@link #createOrRetrieveMapView(World, int, Consumer)} and {@link #createMapView(World, Consumer)},
76-
* the difference is that the first method always creates a new map when one cannot be found, while the second
77-
* always creates a new map regardless. This method, however, does not create a new map if the ID is missing,
78-
* it simply returns {@code null}.
75+
* This method first checks if a {@link BuildMapView} has already been assigned via {@link #getMapViewBuilder()}.
76+
* If found, its ID is used to look up the corresponding map view. Unlike
77+
* {@link #createOrRetrieveMapView(World, int, Consumer)} and {@link #createMapView(World, Consumer)},
78+
* this method does <strong>not</strong> create a new map if none exists—it simply returns {@code null}.
7979
* </p>
8080
*
81-
* @param action a consumer to configure the resulting {@link BuildMapView}, if found.
82-
* @return the retrieved {@link BuildMapView}, or {@code null} if no map exists for the given ID.
81+
* @param action a consumer used to configure the {@link BuildMapView}, if it exists.
82+
* @return the existing {@link BuildMapView}, or {@code null} if none was found or assigned.
8383
*/
8484
@Nullable
8585
public BuildMapView getExistingMapView(@Nonnull final Consumer<BuildMapView> action) {
@@ -92,17 +92,20 @@ public BuildMapView getExistingMapView(@Nonnull final Consumer<BuildMapView> act
9292
}
9393

9494
/**
95-
* Attempts to retrieve an existing map by its ID and wraps it in a {@link BuildMapView}.
95+
* Attempts to retrieve and wrap an existing map view by its ID into a {@link BuildMapView}.
9696
* <p>
97-
* Unlike {@link #createOrRetrieveMapView(World, int, Consumer)} and {@link #createMapView(World, Consumer)},
98-
* the difference is that the first method always creates a new map when one cannot be found, while the second
99-
* always creates a new map regardless. This method, however, does not create a new map if the ID is missing,
100-
* it simply returns {@code null}.
97+
* This method differs from {@link #createOrRetrieveMapView(World, int, Consumer)} and
98+
* {@link #createMapView(World, Consumer)} in that it never creates a new map.
99+
* If no map exists with the provided ID, the method returns {@code null}.
100+
* </p>
101+
* <p>
102+
* If a {@link BuildMapView} is not currently assigned, a new wrapper will be created
103+
* and linked via {@link #assignMapView(BuildMapView)} using the retrieved {@link MapView}.
101104
* </p>
102105
*
103-
* @param id the map ID to retrieve can't be below zero.
104-
* @param action a consumer to configure the resulting {@link BuildMapView}, if found.
105-
* @return the retrieved {@link BuildMapView}, or {@code null} if no map exists for the given ID.
106+
* @param id the map ID to retrieve, must be zero or greater.
107+
* @param action a consumer used to configure the {@link BuildMapView}, if found.
108+
* @return the existing {@link BuildMapView}, or {@code null} if no map exists for the given ID.
106109
*/
107110
@Nullable
108111
public BuildMapView getExistingMapView(final int id, @Nonnull final Consumer<BuildMapView> action) {

0 commit comments

Comments
 (0)