/*
 * Copyright 2014-present Facebook, Inc.
 *
 * Licensed 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 com.facebook.litho.annotations;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@Retention(RetentionPolicy.RUNTIME)
public @interface State {
  boolean canUpdateLazily() default false;
}

@@ -728,69 +728,2478 @@
 y;%0A%0A
-@Retention(RetentionPolicy.RUNTIME)%0Apublic @interface State %7B
+/**%0A * States for a given Component are the union of all arguments annotated with %7B@code State%7D in the%0A * spec. While both %7B@link Prop%7D and %7B@link State%7D hold information that influences the output of%0A * the component, they are different in one important way: props get passed to the component from%0A * it's parent whereas states are managed within the component.%0A *%0A * %3Cp%3EThe initial values of states can be set using the %7B@link OnCreateInitialState%7D method and%0A * states can be updated in %7B@link OnUpdateState%7D methods. Updating states in the %7B@link%0A * OnUpdateState%7D methods will cause the component to invoke its %7B@link OnCreateLayout%7D method.%0A * States %3Cem%3Eshould%3C/em%3E be immutable since the layout can be calculated on multiple threads.%0A * Immutability of the states ensures that no thread safety issues can occur in the component%0A * hierarchy.%0A *%0A * %3Cp%3E%3Cb%3EUsing State:%3C/b%3E %3Cbr%3E%0A *%0A * %3Cpre%3E%3Ccode%3E%7B@literal @LayoutSpec%7D%0A * public class CounterSpec %7B%0A *%0A *  %7B@literal @OnCreateLayout%7D%0A *   static Component onCreateLayout(%0A *     ComponentContext c,%0A *    %7B@literal @State%7D int count) %7B%0A *%0A *     return Row.create(c)%0A *       .backgroundColor(Color.WHITE)%0A *       .heightDip(64)%0A *       .paddingDip(YogaEdge.ALL, 8)%0A *       .child(%0A *         Text.create(c)%0A *           .text(%22 + %22)%0A *           .clickHandler(Counter.onClick(c))%0A *       )%0A *       .child(%0A *         Text.create(c)%0A *           .text(String.valueOf(count))%0A *       )%0A *       .build();%0A *   %7D%0A *%0A *  %7B@literal @OnCreateInitialState%7D%0A *   static void onCreateInitialState(%0A *       ComponentContext c,%0A *       StateValue&lt;Integer&gt; count) %7B%0A *     count.set(0);%0A *   %7D%0A *%0A *  %7B@literal @OnEvent(ClickEvent.class)%7D%0A *   static void onClick(ComponentContext c) %7B%0A *     Counter.increment(c);%0A *   %7D%0A *%0A *  %7B@literal @OnUpdateState%7D%0A *   static void increment(StateValue&lt;Integer&gt; count) %7B%0A *     count.set(count.get() + 1);%0A *   %7D%0A * %7D%3C/code%3E%3C/pre%3E%0A *%0A * @see Param%0A */%0A@Retention(RetentionPolicy.RUNTIME)%0Apublic @interface State %7B%0A%0A  /**%0A   * Declares that this state will not trigger a new layout calculations on update. After a lazy%0A   * state update the component will continue to host the older value until the next layout%0A   * calculation is triggered. This is useful for updating internal Component information and%0A   * persisting it between re-layouts when an immediate layout calculation is not needed.%0A   *%0A   * @return %7B@code true%7D iff this state should update lazily.%0A   */
 %0A  b

Add JavaDoc for State