@@ -183,30 +183,29 @@ public EntityQueryPageable getAllEntities() {
183183
184184 /**
185185 * Returns an auto-paginating iterable over entity instances matching the specified filter criteria,
186- * with state included for typed access.
186+ * with typed state access.
187187 * <p>
188- * This convenience overload ensures that entity state is fetched, matching the .NET SDK's
189- * {@code GetAllEntitiesAsync<T>()} pattern. Use {@link EntityMetadata#readStateAs(Class)} on
190- * each result to access the typed state .
188+ * This mirrors the .NET SDK's {@code GetAllEntitiesAsync<T>()} pattern. Entity state is always
189+ * included in the results and eagerly deserialized into the specified type. Each item is a
190+ * {@link TypedEntityMetadata} with a {@link TypedEntityMetadata#getState()} accessor .
191191 * <p>
192- * Note: The provided query's {@code includeState} setting is preserved. A copy of the query
193- * is made with {@code includeState} set to {@code true} so the original query is not modified.
192+ * Note: A copy of the query is made with {@code includeState} set to {@code true} so the
193+ * original query is not modified.
194194 *
195195 * <pre>{@code
196196 * EntityQuery query = new EntityQuery().setInstanceIdStartsWith("counter");
197- * for (EntityMetadata entity : client.getEntities().getAllEntities(query, Integer.class)) {
198- * Integer state = entity.readStateAs(Integer.class );
197+ * for (TypedEntityMetadata<Integer> entity : client.getEntities().getAllEntities(query, Integer.class)) {
198+ * Integer state = entity.getState( );
199199 * System.out.println("Counter value: " + state);
200200 * }
201201 * }</pre>
202202 *
203203 * @param query the query filter criteria
204- * @param stateType the expected type of the entity's state, used with
205- * {@link EntityMetadata#readStateAs(Class)} for deserialization
204+ * @param stateType the class to deserialize each entity's state into
206205 * @param <T> the entity state type
207- * @return a pageable iterable over all matching entities with state included
206+ * @return a pageable iterable over all matching entities with typed state
208207 */
209- public <T > EntityQueryPageable getAllEntities (EntityQuery query , Class <T > stateType ) {
208+ public <T > TypedEntityQueryPageable < T > getAllEntities (EntityQuery query , Class <T > stateType ) {
210209 // Create a copy with includeState=true so we don't mutate the caller's query
211210 EntityQuery typedQuery = new EntityQuery ()
212211 .setInstanceIdStartsWith (query .getInstanceIdStartsWith ())
@@ -216,7 +215,8 @@ public <T> EntityQueryPageable getAllEntities(EntityQuery query, Class<T> stateT
216215 .setIncludeTransient (query .isIncludeTransient ())
217216 .setPageSize (query .getPageSize ())
218217 .setContinuationToken (query .getContinuationToken ());
219- return new EntityQueryPageable (typedQuery , this ::queryEntities );
218+ EntityQueryPageable inner = new EntityQueryPageable (typedQuery , this ::queryEntities );
219+ return new TypedEntityQueryPageable <>(inner , stateType );
220220 }
221221
222222 /**
0 commit comments