papegaaij commented on code in PR #1595:
URL: https://github.com/apache/wicket/pull/1595#discussion_r3992821312


##########
wicket-core/src/main/java/org/apache/wicket/ComponentState.java:
##########
@@ -0,0 +1,871 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.wicket.behavior.Behavior;
+import org.apache.wicket.behavior.InvalidBehaviorIdException;
+import org.apache.wicket.model.IModel;
+
+/**
+ * This class keeps track of the flexible state of a component: model, 
behaviors and meta data.
+ * These types of state vary per component. Not every component contains these 
elements or their
+ * numbers differ. The state is stored in the {@code data} field in {@link 
Component}. To keep the
+ * size of this state as small as possible, the following cases are identified:
+ * <ul>
+ * <li>No state at all: {@code data} is {@code null}
+ * <li>Only a model: {@code data} contains the model

Review Comment:
   Agreed that it is a real gap. `IModel` has `detach()`, but nothing calls it 
unless the model is the component's default model or is wrapped by something 
that passes the call on, so every extra model a component keeps is a detach you 
have to remember to write yourself.
   
   It is new API rather than a side effect of this rework though, so I would 
rather not fold it into this PR. Could you open a GitHub issue for it? JIRA was 
shut down yesterday, so that is where it would live now.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to