/*
 * 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;

/** Whether the LayoutSpec component will perform measurement while computing its layout tree. */
@Retention(RetentionPolicy.SOURCE)
public @interface OnCreateLayoutWithSizeSpec {}

@@ -731,99 +731,2359 @@
 %0A/**
- Whether the LayoutSpec component will perform measurement while computing its layout tree.
+%0A * %7B@code OnCreateLayoutWithSizeSpec%7D is the same as %7B@link OnCreateLayout%7D but the layout can be%0A * resolved with a specified width and height. Use this instead of %7B@code OnCreateLayout%7D if the%0A * %7B@link LayoutSpec%7D returns a layout tree that depends on its own and/or its children's size.%0A *%0A * %3Cp%3EFor example, a spec might use Component %7B@code A%7D if that fits within the specified width or%0A * use Component %7B@code B%7D instead.%0A *%0A * %3Cp%3EThe annotated method must return a Component and can receive the following arguments.%0A *%0A * %3Cp%3E%3Cem%3ERequired:%3C/em%3E%3Cbr%3E%0A *%0A * %3Col%3E%0A *   %3Cli%3EComponentContext%0A *   %3Cli%3Eint (width spec)%0A *   %3Cli%3Eint (height spec)%0A * %3C/ol%3E%0A *%0A * %3Cp%3E%3Cem%3EOptional and annotated arguments:%3C/em%3E%3Cbr%3E%0A *%0A * %3Cul%3E%0A *   %3Cli%3E%7B@link Prop%7D%0A *   %3Cli%3E%7B@link TreeProp%7D%0A *   %3Cli%3E%7B@link InjectProp%7D%0A *   %3Cli%3E%7B@link State%7D%0A *   %3Cli%3E%7B@code Output%7D%0A * %3C/ul%3E%0A *%0A * %3Cp%3EThe annotation processor will validate this and other invariants in the API at build time. The%0A * optional and annotated arguments are inputs which should be used to create the layout of the%0A * spec.%0A *%0A * %3Cp%3EFor example: %3Cbr%3E%0A *%0A * %3Cpre%3E%3Ccode%3E%7B@literal @LayoutSpec%7D%0A * class MyComponentSpec %7B%0A *%0A *  %7B@literal @OnCreateLayoutWithSizeSpec%7D%0A *   static Component onCreateLayoutWithSizeSpec(%0A *       ComponentContext c,%0A *       int widthSpec,%0A *       int heightSpec) %7B%0A *%0A *     final Component textComponent =%0A *         Text.create(c).textSizeSp(16).text(%22Some text to measure.%22).build();%0A *%0A *     // UNSPECIFIED sizeSpecs will measure the text as being one line only,%0A *     // having unlimited width.%0A *     final Size textOutputSize = new Size();%0A *     textComponent.measure(%0A *         c,%0A *         SizeSpec.makeSizeSpec(0, UNSPECIFIED),%0A *         SizeSpec.makeSizeSpec(0, UNSPECIFIED),%0A *         textOutputSize);%0A *%0A *     // Small component to use in case textComponent does not fit within the current layout.%0A *     final Component imageComponent = Image.create(c).drawableRes(R.drawable.ic_launcher).build();%0A *%0A *     // Assuming SizeSpec.getMode(widthSpec) == EXACTLY or AT_MOST.%0A *     final int layoutWidth = SizeSpec.getSize(widthSpec);%0A *     final boolean textFits = (textOutputSize.width &lt;= layoutWidth);%0A *%0A *     return textFits ? textComponent : imageComponent;%0A *   %7D%0A * %7D%3C/code%3E%3C/pre%3E%0A *%0A * @see OnCreateLayout%0A * @see OnShouldCreateLayoutWithNewSizeSpec%0A
  */%0A

Update JavaDoc for OnCreateLayoutWithSizeSpec