diff --git a/third_party/docfx-doclet-143274/src/main/java/com/microsoft/build/YmlFilesBuilder.java b/third_party/docfx-doclet-143274/src/main/java/com/microsoft/build/YmlFilesBuilder.java index 96de0ab7..957a5adb 100644 --- a/third_party/docfx-doclet-143274/src/main/java/com/microsoft/build/YmlFilesBuilder.java +++ b/third_party/docfx-doclet-143274/src/main/java/com/microsoft/build/YmlFilesBuilder.java @@ -13,10 +13,7 @@ import org.apache.commons.lang3.RegExUtils; import org.apache.commons.lang3.StringUtils; -import javax.lang.model.element.Element; -import javax.lang.model.element.ExecutableElement; -import javax.lang.model.element.PackageElement; -import javax.lang.model.element.TypeElement; +import javax.lang.model.element.*; import javax.lang.model.util.ElementFilter; import java.util.*; import java.util.function.Function; @@ -72,7 +69,11 @@ public boolean build() { TocItem packageTocItem = new TocItem(uid, uid, status); packageMetadataFiles.add(buildPackageMetadataFile(packageElement)); packageTocItem.getItems().add(new TocItem(uid, "Package summary")); - buildFilesForInnerClasses(packageElement, packageTocItem.getItems(), classMetadataFiles); + + TocTypeMap typeMap = new TocTypeMap(); + buildFilesForInnerClasses(packageElement,typeMap, classMetadataFiles); + packageTocItem.getItems().addAll(joinTocTypeItems(typeMap)); + tocFile.addTocItem(packageTocItem); } @@ -98,16 +99,33 @@ public boolean build() { return true; } - void buildFilesForInnerClasses(Element element, List listToAddItems, List container) { + List joinTocTypeItems(TocTypeMap tocTypeMap){ + return tocTypeMap.getTitleList().stream() + .filter(kindTitle -> tocTypeMap.get(kindTitle.getElementKind()).size() > 0) + .flatMap(kindTitle -> { + tocTypeMap.get(kindTitle.getElementKind()).add(0, new TocItem(kindTitle.getTitle())); + return tocTypeMap.get(kindTitle.getElementKind()).stream(); + }).collect(Collectors.toList()); + } + + void buildFilesForInnerClasses(Element element, TocTypeMap tocTypeMap, List container) { for (TypeElement classElement : elementUtil.extractSortedElements(element)) { String uid = classLookup.extractUid(classElement); String name = classLookup.extractTocName(classElement); String status = classLookup.extractStatus(classElement); - listToAddItems.add(new TocItem(uid, name, status)); + if (tocTypeMap.get(classElement.getKind().name()) != null) { + if (classElement.getKind().name().equals(ElementKind.CLASS.name()) && name.contains("Exception")) { + tocTypeMap.get("EXCEPTION").add(new TocItem(uid, name, status)); + } else { + tocTypeMap.get(classElement.getKind().name()).add(new TocItem(uid, name, status)); + } + } else { + tocTypeMap.get(ElementKind.CLASS.name()).add(new TocItem(uid, name, status)); + } container.add(buildClassYmlFile(classElement)); - buildFilesForInnerClasses(classElement, listToAddItems, container); + buildFilesForInnerClasses(classElement, tocTypeMap, container); } } diff --git a/third_party/docfx-doclet-143274/src/main/java/com/microsoft/model/KindTitle.java b/third_party/docfx-doclet-143274/src/main/java/com/microsoft/model/KindTitle.java new file mode 100644 index 00000000..b098336c --- /dev/null +++ b/third_party/docfx-doclet-143274/src/main/java/com/microsoft/model/KindTitle.java @@ -0,0 +1,28 @@ +/* + * Copyright 2021 Google LLC + * + * 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 + * + * https://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.microsoft.model; + +public class KindTitle { + private final String elementKind; + private final String title; + + public KindTitle(String elementKind, String title) { + this.elementKind = elementKind; + this.title = title; + } + public String getElementKind() { return elementKind; } + public String getTitle() { return title; } +} diff --git a/third_party/docfx-doclet-143274/src/main/java/com/microsoft/model/TocItem.java b/third_party/docfx-doclet-143274/src/main/java/com/microsoft/model/TocItem.java index 0137d796..bdbd3b43 100644 --- a/third_party/docfx-doclet-143274/src/main/java/com/microsoft/model/TocItem.java +++ b/third_party/docfx-doclet-143274/src/main/java/com/microsoft/model/TocItem.java @@ -5,11 +5,13 @@ public class TocItem { - private final String uid; - private final String name; + private String uid; + private String name; private String status; + private String heading; private List items = new ArrayList<>(); + public TocItem(String uid, String name) { this.uid = uid; this.name = name; @@ -21,6 +23,10 @@ public TocItem(String uid, String name, String status) { this.status = status; } + public TocItem(String heading) { + this.heading = heading; + } + public String getUid() { return uid; } @@ -34,4 +40,6 @@ public List getItems() { } public String getStatus() { return status; } + + public String getHeading() { return heading; } } diff --git a/third_party/docfx-doclet-143274/src/main/java/com/microsoft/model/TocTypeMap.java b/third_party/docfx-doclet-143274/src/main/java/com/microsoft/model/TocTypeMap.java new file mode 100644 index 00000000..55c470d6 --- /dev/null +++ b/third_party/docfx-doclet-143274/src/main/java/com/microsoft/model/TocTypeMap.java @@ -0,0 +1,43 @@ +/* + * Copyright 2021 Google LLC + * + * 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 + * + * https://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.microsoft.model; + +import org.apache.commons.lang3.tuple.Pair; + +import javax.lang.model.element.ElementKind; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +public class TocTypeMap extends HashMap> { + + public TocTypeMap() { + this.put(ElementKind.CLASS.name(), new ArrayList<>()); + this.put(ElementKind.INTERFACE.name(), new ArrayList<>()); + this.put(ElementKind.ENUM.name(), new ArrayList<>()); + this.put(ElementKind.ANNOTATION_TYPE.name(), new ArrayList<>()); + this.put("EXCEPTION", new ArrayList<>()); + } + + public List getTitleList() { + return List.of( + new KindTitle(ElementKind.INTERFACE.name(), "Interfaces"), + new KindTitle(ElementKind.CLASS.name(), "Classes"), + new KindTitle(ElementKind.ENUM.name(), "Enums"), + new KindTitle(ElementKind.ANNOTATION_TYPE.name(),"Annotation Types"), + new KindTitle("EXCEPTION", "Exceptions")); + } +} diff --git a/third_party/docfx-doclet-143274/src/test/java/com/microsoft/build/YmlFilesBuilderTest.java b/third_party/docfx-doclet-143274/src/test/java/com/microsoft/build/YmlFilesBuilderTest.java index ed5bea1b..bd0aa3a3 100644 --- a/third_party/docfx-doclet-143274/src/test/java/com/microsoft/build/YmlFilesBuilderTest.java +++ b/third_party/docfx-doclet-143274/src/test/java/com/microsoft/build/YmlFilesBuilderTest.java @@ -1,10 +1,7 @@ package com.microsoft.build; import com.google.testing.compile.CompilationRule; -import com.microsoft.model.MetadataFile; -import com.microsoft.model.MetadataFileItem; -import com.microsoft.model.MethodParameter; -import com.microsoft.model.Syntax; +import com.microsoft.model.*; import com.sun.source.util.DocTrees; import jdk.javadoc.doclet.DocletEnvironment; import org.apache.commons.lang3.RegExUtils; @@ -15,6 +12,7 @@ import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; +import javax.lang.model.element.ElementKind; import javax.lang.model.element.TypeElement; import javax.lang.model.util.Elements; import java.io.File; @@ -217,4 +215,38 @@ public void getJavaReferenceHref(){ assertEquals(baseURL, result12); assertEquals(baseURL, result13); } + + @Test + public void joinTocTypeItems(){ + TocTypeMap typeMap = new TocTypeMap(); + TocItem classToc = new TocItem("uid1", "name1"); + TocItem interfaceToc = new TocItem("uid2", "name2"); + TocItem enumToc = new TocItem("uid3", "name3"); + TocItem annotationToc = new TocItem("uid4", "name4"); + TocItem exceptionToc = new TocItem("uid5", "name5"); + + typeMap.get(ElementKind.CLASS.name()).add(classToc); + typeMap.get(ElementKind.INTERFACE.name()).add(interfaceToc); + typeMap.get(ElementKind.ENUM.name()).add(enumToc); + typeMap.get(ElementKind.ANNOTATION_TYPE.name()).add(annotationToc); + typeMap.get("EXCEPTION").add(exceptionToc); + + List tocItems = ymlFilesBuilder.joinTocTypeItems(typeMap); + + assertEquals("Interfaces", tocItems.get(0).getHeading()); + assertEquals(interfaceToc, tocItems.get(1)); + + assertEquals("Classes", tocItems.get(2).getHeading()); + assertEquals(classToc, tocItems.get(3)); + + assertEquals("Enums", tocItems.get(4).getHeading()); + assertEquals(enumToc, tocItems.get(5)); + + assertEquals("Annotation Types", tocItems.get(6).getHeading()); + assertEquals(annotationToc, tocItems.get(7)); + + assertEquals("Exceptions", tocItems.get(8).getHeading()); + assertEquals(exceptionToc, tocItems.get(9)); + } + } diff --git a/third_party/docfx-doclet-143274/src/test/java/com/microsoft/model/TocTypeMapTest.java b/third_party/docfx-doclet-143274/src/test/java/com/microsoft/model/TocTypeMapTest.java new file mode 100644 index 00000000..77593e8c --- /dev/null +++ b/third_party/docfx-doclet-143274/src/test/java/com/microsoft/model/TocTypeMapTest.java @@ -0,0 +1,40 @@ +/* + * Copyright 2021 Google LLC + * + * 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 + * + * https://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.microsoft.model; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.junit.MockitoJUnitRunner; + +import java.util.List; + +import static org.junit.Assert.*; + +@RunWith(MockitoJUnitRunner.class) +public class TocTypeMapTest { + @Test + public void elementKindsExistInMap() { + TocTypeMap tocTypeMap = new TocTypeMap(); + List titleList = tocTypeMap.getTitleList(); + + assertEquals("Should include 5 items in list", 5, titleList.size()); + + titleList.stream().forEach(kindtitle -> assertNotNull("Element kind should exist in map", + tocTypeMap.get(kindtitle.getElementKind()))); + + assertNull("Should not include provided key", tocTypeMap.get("FAKE_VALUE")); + } +} diff --git a/third_party/docfx-doclet-143274/src/test/java/com/microsoft/samples/google/BetaApi.java b/third_party/docfx-doclet-143274/src/test/java/com/microsoft/samples/google/BetaApi.java new file mode 100644 index 00000000..ca32def1 --- /dev/null +++ b/third_party/docfx-doclet-143274/src/test/java/com/microsoft/samples/google/BetaApi.java @@ -0,0 +1,70 @@ +/* + * Copyright 2017, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package com.microsoft.samples.google; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Indicates a public API that can change at any time, and has no guarantee of API stability and + * backward-compatibility. + * + *

+ * Usage guidelines: + *

    + *
  1. This annotation is used only on APIs with public visibility. Internal interfaces should not + * use it.
  2. + *
  3. This annotation should only be added to new APIs. Adding it to an existing API is considered + * API-breaking.
  4. + *
  5. Removing this annotation from an API gives it stable status, assuming the API doesn't have + * other annotations denoting instability. + *
+ */ +@BetaApi +@Retention(RetentionPolicy.RUNTIME) +@Target({ + ElementType.ANNOTATION_TYPE, + ElementType.CONSTRUCTOR, + ElementType.FIELD, + ElementType.METHOD, + ElementType.PACKAGE, + ElementType.TYPE +}) +@Documented +public @interface BetaApi { + /** + * Context information such as links to a discussion thread, tracking issue, etc. + */ + String value() default ""; +} diff --git a/third_party/docfx-doclet-143274/src/test/java/com/microsoft/samples/google/ValidationException.java b/third_party/docfx-doclet-143274/src/test/java/com/microsoft/samples/google/ValidationException.java new file mode 100644 index 00000000..5e7805e2 --- /dev/null +++ b/third_party/docfx-doclet-143274/src/test/java/com/microsoft/samples/google/ValidationException.java @@ -0,0 +1,99 @@ +/* + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package com.microsoft.samples.google; + +import java.util.Stack; + +/** + * Exception thrown if there is a validation problem with a path template, http config, or related + * framework methods. Comes as an illegal argument exception subclass. Allows to globally set a + * thread-local validation context description which each exception inherits. + */ +public class ValidationException extends IllegalArgumentException { + + public interface Supplier { + T get(); + } + + private static ThreadLocal>> contextLocal = new ThreadLocal<>(); + + /** + * Sets the validation context description. Each thread has its own description, so this is thread + * safe. + */ + public static void pushCurrentThreadValidationContext(Supplier supplier) { + Stack> stack = contextLocal.get(); + if (stack == null) { + stack = new Stack<>(); + contextLocal.set(stack); + } + stack.push(supplier); + } + + public static void pushCurrentThreadValidationContext(final String context) { + pushCurrentThreadValidationContext( + new Supplier() { + @Override + public String get() { + return context; + } + }); + } + + /** + * Clears the validation context. + */ + public static void popCurrentThreadValidationContext() { + Stack stack = contextLocal.get(); + if (stack != null) { + stack.pop(); + } + } + + /** + * Construct validation exception with implicit context. + */ + public ValidationException(String format, Object... args) { + super(message(contextLocal.get(), format, args)); + } + + private static String message(Stack> context, String format, Object... args) { + if (context == null || context.isEmpty()) { + return String.format(format, args); + } + StringBuilder result = new StringBuilder(); + for (Supplier supplier : context) { + result.append(supplier.get() + ": "); + } + return result.toString() + String.format(format, args); + } +} diff --git a/third_party/docfx-doclet-143274/src/test/resources/expected-generated-files/com.microsoft.samples.google.BetaApi.yml b/third_party/docfx-doclet-143274/src/test/resources/expected-generated-files/com.microsoft.samples.google.BetaApi.yml new file mode 100644 index 00000000..3aa7bc05 --- /dev/null +++ b/third_party/docfx-doclet-143274/src/test/resources/expected-generated-files/com.microsoft.samples.google.BetaApi.yml @@ -0,0 +1,54 @@ +### YamlMime:ManagedReference +items: +- uid: "com.microsoft.samples.google.BetaApi" + id: "BetaApi" + parent: "com.microsoft.samples.google" + children: + - "com.microsoft.samples.google.BetaApi.value()" + langs: + - "java" + name: "BetaApi" + nameWithType: "BetaApi" + fullName: "com.microsoft.samples.google.BetaApi" + type: "Interface" + package: "com.microsoft.samples.google" + summary: "Indicates a public API that can change at any time, and has no guarantee of API stability and backward-compatibility.\n\nUsage guidelines:\n\n1. This annotation is used only on APIs with public visibility. Internal interfaces should not use it.\n2. This annotation should only be added to new APIs. Adding it to an existing API is considered API-breaking.\n3. Removing this annotation from an API gives it stable status, assuming the API doesn't have other annotations denoting instability." + syntax: + content: "public interface BetaApi implements Annotation" + implements: + - "java.lang.annotation.Annotation" +- uid: "com.microsoft.samples.google.BetaApi.value()" + id: "value()" + parent: "com.microsoft.samples.google.BetaApi" + langs: + - "java" + name: "value()" + nameWithType: "BetaApi.value()" + fullName: "com.microsoft.samples.google.BetaApi.value()" + overload: "com.microsoft.samples.google.BetaApi.value*" + type: "Method" + package: "com.microsoft.samples.google" + summary: "Context information such as links to a discussion thread, tracking issue, etc." + syntax: + content: "public abstract String value()" + return: + type: "java.lang.String" +references: +- uid: "java.lang.String" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" + spec.java: + - uid: "java.lang.String" + name: "String" + fullName: "java.lang.String" + isExternal: false + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" +- uid: "com.microsoft.samples.google.BetaApi.value*" + name: "value" + nameWithType: "BetaApi.value" + fullName: "com.microsoft.samples.google.BetaApi.value" + package: "com.microsoft.samples.google" +- uid: "java.lang.annotation.Annotation" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/annotation/Annotation.html" + name: "Annotation" + nameWithType: "Annotation" + fullName: "java.lang.annotation.Annotation" diff --git a/third_party/docfx-doclet-143274/src/test/resources/expected-generated-files/com.microsoft.samples.google.ValidationException.Supplier.yml b/third_party/docfx-doclet-143274/src/test/resources/expected-generated-files/com.microsoft.samples.google.ValidationException.Supplier.yml new file mode 100644 index 00000000..4d836d60 --- /dev/null +++ b/third_party/docfx-doclet-143274/src/test/resources/expected-generated-files/com.microsoft.samples.google.ValidationException.Supplier.yml @@ -0,0 +1,45 @@ +### YamlMime:ManagedReference +items: +- uid: "com.microsoft.samples.google.ValidationException.Supplier" + id: "Supplier" + parent: "com.microsoft.samples.google" + children: + - "com.microsoft.samples.google.ValidationException.Supplier.get()" + langs: + - "java" + name: "ValidationException.Supplier" + nameWithType: "ValidationException.Supplier" + fullName: "com.microsoft.samples.google.ValidationException.Supplier" + type: "Interface" + package: "com.microsoft.samples.google" + syntax: + content: "public static interface ValidationException.Supplier" + typeParameters: + - id: "T" +- uid: "com.microsoft.samples.google.ValidationException.Supplier.get()" + id: "get()" + parent: "com.microsoft.samples.google.ValidationException.Supplier" + langs: + - "java" + name: "get()" + nameWithType: "ValidationException.Supplier.get()" + fullName: "com.microsoft.samples.google.ValidationException.Supplier.get()" + overload: "com.microsoft.samples.google.ValidationException.Supplier.get*" + type: "Method" + package: "com.microsoft.samples.google" + syntax: + content: "public abstract T get()" + return: + type: "T" +references: +- uid: "T" + spec.java: + - uid: "T" + name: "T" + fullName: "T" + isExternal: false +- uid: "com.microsoft.samples.google.ValidationException.Supplier.get*" + name: "get" + nameWithType: "ValidationException.Supplier.get" + fullName: "com.microsoft.samples.google.ValidationException.Supplier.get" + package: "com.microsoft.samples.google" diff --git a/third_party/docfx-doclet-143274/src/test/resources/expected-generated-files/com.microsoft.samples.google.ValidationException.yml b/third_party/docfx-doclet-143274/src/test/resources/expected-generated-files/com.microsoft.samples.google.ValidationException.yml new file mode 100644 index 00000000..8abc87c5 --- /dev/null +++ b/third_party/docfx-doclet-143274/src/test/resources/expected-generated-files/com.microsoft.samples.google.ValidationException.yml @@ -0,0 +1,293 @@ +### YamlMime:ManagedReference +items: +- uid: "com.microsoft.samples.google.ValidationException" + id: "ValidationException" + parent: "com.microsoft.samples.google" + children: + - "com.microsoft.samples.google.ValidationException.Supplier" + - "com.microsoft.samples.google.ValidationException.ValidationException(java.lang.String,java.lang.Object...)" + - "com.microsoft.samples.google.ValidationException.popCurrentThreadValidationContext()" + - "com.microsoft.samples.google.ValidationException.pushCurrentThreadValidationContext(com.microsoft.samples.google.ValidationException.Supplier)" + - "com.microsoft.samples.google.ValidationException.pushCurrentThreadValidationContext(java.lang.String)" + langs: + - "java" + name: "ValidationException" + nameWithType: "ValidationException" + fullName: "com.microsoft.samples.google.ValidationException" + type: "Class" + package: "com.microsoft.samples.google" + summary: "Exception thrown if there is a validation problem with a path template, http config, or related framework methods. Comes as an illegal argument exception subclass. Allows to globally set a thread-local validation context description which each exception inherits." + syntax: + content: "public class ValidationException extends IllegalArgumentException" + inheritance: + - "java.lang.Object" + - "java.lang.Throwable" + - "java.lang.Exception" + - "java.lang.RuntimeException" + - "java.lang.IllegalArgumentException" + inheritedMembers: + - "java.lang.Object.clone()" + - "java.lang.Object.equals(java.lang.Object)" + - "java.lang.Object.finalize()" + - "java.lang.Object.getClass()" + - "java.lang.Object.hashCode()" + - "java.lang.Object.notify()" + - "java.lang.Object.notifyAll()" + - "java.lang.Object.wait()" + - "java.lang.Object.wait(long)" + - "java.lang.Object.wait(long,int)" + - "java.lang.Throwable.addSuppressed(java.lang.Throwable)" + - "java.lang.Throwable.fillInStackTrace()" + - "java.lang.Throwable.getCause()" + - "java.lang.Throwable.getLocalizedMessage()" + - "java.lang.Throwable.getMessage()" + - "java.lang.Throwable.getStackTrace()" + - "java.lang.Throwable.getSuppressed()" + - "java.lang.Throwable.initCause(java.lang.Throwable)" + - "java.lang.Throwable.printStackTrace()" + - "java.lang.Throwable.printStackTrace(java.io.PrintStream)" + - "java.lang.Throwable.printStackTrace(java.io.PrintWriter)" + - "java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[])" + - "java.lang.Throwable.toString()" +- uid: "com.microsoft.samples.google.ValidationException.ValidationException(java.lang.String,java.lang.Object...)" + id: "ValidationException(java.lang.String,java.lang.Object...)" + parent: "com.microsoft.samples.google.ValidationException" + langs: + - "java" + name: "ValidationException(String format, Object[] args)" + nameWithType: "ValidationException.ValidationException(String format, Object[] args)" + fullName: "com.microsoft.samples.google.ValidationException.ValidationException(String format, Object[] args)" + overload: "com.microsoft.samples.google.ValidationException.ValidationException*" + type: "Constructor" + package: "com.microsoft.samples.google" + summary: "Construct validation exception with implicit context." + syntax: + content: "public ValidationException(String format, Object[] args)" + parameters: + - id: "format" + type: "java.lang.String" + - id: "args" + type: "java.lang.Object[]" +- uid: "com.microsoft.samples.google.ValidationException.popCurrentThreadValidationContext()" + id: "popCurrentThreadValidationContext()" + parent: "com.microsoft.samples.google.ValidationException" + langs: + - "java" + name: "popCurrentThreadValidationContext()" + nameWithType: "ValidationException.popCurrentThreadValidationContext()" + fullName: "com.microsoft.samples.google.ValidationException.popCurrentThreadValidationContext()" + overload: "com.microsoft.samples.google.ValidationException.popCurrentThreadValidationContext*" + type: "Method" + package: "com.microsoft.samples.google" + summary: "Clears the validation context." + syntax: + content: "public static void popCurrentThreadValidationContext()" +- uid: "com.microsoft.samples.google.ValidationException.pushCurrentThreadValidationContext(com.microsoft.samples.google.ValidationException.Supplier)" + id: "pushCurrentThreadValidationContext(com.microsoft.samples.google.ValidationException.Supplier)" + parent: "com.microsoft.samples.google.ValidationException" + langs: + - "java" + name: "pushCurrentThreadValidationContext(ValidationException.Supplier supplier)" + nameWithType: "ValidationException.pushCurrentThreadValidationContext(ValidationException.Supplier supplier)" + fullName: "com.microsoft.samples.google.ValidationException.pushCurrentThreadValidationContext(ValidationException.Supplier supplier)" + overload: "com.microsoft.samples.google.ValidationException.pushCurrentThreadValidationContext*" + type: "Method" + package: "com.microsoft.samples.google" + summary: "Sets the validation context description. Each thread has its own description, so this is thread safe." + syntax: + content: "public static void pushCurrentThreadValidationContext(ValidationException.Supplier supplier)" + parameters: + - id: "supplier" + type: "com.microsoft.samples.google.ValidationException.Supplier" +- uid: "com.microsoft.samples.google.ValidationException.pushCurrentThreadValidationContext(java.lang.String)" + id: "pushCurrentThreadValidationContext(java.lang.String)" + parent: "com.microsoft.samples.google.ValidationException" + langs: + - "java" + name: "pushCurrentThreadValidationContext(String context)" + nameWithType: "ValidationException.pushCurrentThreadValidationContext(String context)" + fullName: "com.microsoft.samples.google.ValidationException.pushCurrentThreadValidationContext(String context)" + overload: "com.microsoft.samples.google.ValidationException.pushCurrentThreadValidationContext*" + type: "Method" + package: "com.microsoft.samples.google" + syntax: + content: "public static void pushCurrentThreadValidationContext(String context)" + parameters: + - id: "context" + type: "java.lang.String" +references: +- uid: "java.lang.String" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" + spec.java: + - uid: "java.lang.String" + name: "String" + fullName: "java.lang.String" + isExternal: false + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" +- uid: "java.lang.Object[]" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Object[].html" + spec.java: + - uid: "java.lang.Object" + name: "Object" + fullName: "java.lang.Object" + isExternal: false + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" + - name: "[]" + fullName: "[]" + isExternal: false +- uid: "com.microsoft.samples.google.ValidationException.ValidationException*" + name: "ValidationException" + nameWithType: "ValidationException.ValidationException" + fullName: "com.microsoft.samples.google.ValidationException.ValidationException" + package: "com.microsoft.samples.google" +- uid: "com.microsoft.samples.google.ValidationException.Supplier" + spec.java: + - uid: "com.microsoft.samples.google.ValidationException.Supplier" + name: "Supplier" + fullName: "com.microsoft.samples.google.ValidationException.Supplier" + isExternal: false + - name: "<" + fullName: "<" + isExternal: false + - uid: "java.lang.String" + name: "String" + fullName: "java.lang.String" + isExternal: false + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" + - name: ">" + fullName: ">" + isExternal: false +- uid: "com.microsoft.samples.google.ValidationException.pushCurrentThreadValidationContext*" + name: "pushCurrentThreadValidationContext" + nameWithType: "ValidationException.pushCurrentThreadValidationContext" + fullName: "com.microsoft.samples.google.ValidationException.pushCurrentThreadValidationContext" + package: "com.microsoft.samples.google" +- uid: "com.microsoft.samples.google.ValidationException.popCurrentThreadValidationContext*" + name: "popCurrentThreadValidationContext" + nameWithType: "ValidationException.popCurrentThreadValidationContext" + fullName: "com.microsoft.samples.google.ValidationException.popCurrentThreadValidationContext" + package: "com.microsoft.samples.google" +- uid: "java.lang.IllegalArgumentException" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html" + name: "IllegalArgumentException" + nameWithType: "IllegalArgumentException" + fullName: "java.lang.IllegalArgumentException" +- uid: "java.lang.Object.notify()" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--" + name: "Object.notify()" + nameWithType: "Object.notify()" + fullName: "java.lang.Object.notify()" +- uid: "java.lang.Object.wait()" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--" + name: "Object.wait()" + nameWithType: "Object.wait()" + fullName: "java.lang.Object.wait()" +- uid: "java.lang.Throwable.printStackTrace(java.io.PrintWriter)" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#printStackTrace-java.io.PrintWriter-" + name: "Throwable.printStackTrace(PrintWriter)" + nameWithType: "Throwable.printStackTrace(PrintWriter)" + fullName: "java.lang.Throwable.printStackTrace(java.io.PrintWriter)" +- uid: "java.lang.Throwable.getCause()" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getCause--" + name: "Throwable.getCause()" + nameWithType: "Throwable.getCause()" + fullName: "java.lang.Throwable.getCause()" +- uid: "java.lang.Object.finalize()" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--" + name: "Object.finalize()" + nameWithType: "Object.finalize()" + fullName: "java.lang.Object.finalize()" +- uid: "java.lang.Throwable.addSuppressed(java.lang.Throwable)" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#addSuppressed-java.lang.Throwable-" + name: "Throwable.addSuppressed(Throwable)" + nameWithType: "Throwable.addSuppressed(Throwable)" + fullName: "java.lang.Throwable.addSuppressed(java.lang.Throwable)" +- uid: "java.lang.Throwable.fillInStackTrace()" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#fillInStackTrace--" + name: "Throwable.fillInStackTrace()" + nameWithType: "Throwable.fillInStackTrace()" + fullName: "java.lang.Throwable.fillInStackTrace()" +- uid: "java.lang.Object.notifyAll()" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--" + name: "Object.notifyAll()" + nameWithType: "Object.notifyAll()" + fullName: "java.lang.Object.notifyAll()" +- uid: "java.lang.Object.clone()" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--" + name: "Object.clone()" + nameWithType: "Object.clone()" + fullName: "java.lang.Object.clone()" +- uid: "java.lang.Throwable.initCause(java.lang.Throwable)" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#initCause-java.lang.Throwable-" + name: "Throwable.initCause(Throwable)" + nameWithType: "Throwable.initCause(Throwable)" + fullName: "java.lang.Throwable.initCause(java.lang.Throwable)" +- uid: "java.lang.Object.equals(java.lang.Object)" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-" + name: "Object.equals(Object)" + nameWithType: "Object.equals(Object)" + fullName: "java.lang.Object.equals(java.lang.Object)" +- uid: "java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[])" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#setStackTrace-java.lang.StackTraceElement[]-" + name: "Throwable.setStackTrace(StackTraceElement[])" + nameWithType: "Throwable.setStackTrace(StackTraceElement[])" + fullName: "java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[])" +- uid: "java.lang.Throwable.toString()" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#toString--" + name: "Throwable.toString()" + nameWithType: "Throwable.toString()" + fullName: "java.lang.Throwable.toString()" +- uid: "java.lang.Throwable.printStackTrace(java.io.PrintStream)" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#printStackTrace-java.io.PrintStream-" + name: "Throwable.printStackTrace(PrintStream)" + nameWithType: "Throwable.printStackTrace(PrintStream)" + fullName: "java.lang.Throwable.printStackTrace(java.io.PrintStream)" +- uid: "java.lang.Throwable.getMessage()" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getMessage--" + name: "Throwable.getMessage()" + nameWithType: "Throwable.getMessage()" + fullName: "java.lang.Throwable.getMessage()" +- uid: "java.lang.Throwable.getSuppressed()" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getSuppressed--" + name: "Throwable.getSuppressed()" + nameWithType: "Throwable.getSuppressed()" + fullName: "java.lang.Throwable.getSuppressed()" +- uid: "java.lang.Object.getClass()" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--" + name: "Object.getClass()" + nameWithType: "Object.getClass()" + fullName: "java.lang.Object.getClass()" +- uid: "java.lang.Object.wait(long)" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-" + name: "Object.wait(long)" + nameWithType: "Object.wait(long)" + fullName: "java.lang.Object.wait(long)" +- uid: "java.lang.Object.hashCode()" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--" + name: "Object.hashCode()" + nameWithType: "Object.hashCode()" + fullName: "java.lang.Object.hashCode()" +- uid: "java.lang.Throwable.getStackTrace()" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getStackTrace--" + name: "Throwable.getStackTrace()" + nameWithType: "Throwable.getStackTrace()" + fullName: "java.lang.Throwable.getStackTrace()" +- uid: "java.lang.Object.wait(long,int)" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-" + name: "Object.wait(long,int)" + nameWithType: "Object.wait(long,int)" + fullName: "java.lang.Object.wait(long,int)" +- uid: "java.lang.Throwable.getLocalizedMessage()" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#getLocalizedMessage--" + name: "Throwable.getLocalizedMessage()" + nameWithType: "Throwable.getLocalizedMessage()" + fullName: "java.lang.Throwable.getLocalizedMessage()" +- uid: "java.lang.Throwable.printStackTrace()" + href: "https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html#printStackTrace--" + name: "Throwable.printStackTrace()" + nameWithType: "Throwable.printStackTrace()" + fullName: "java.lang.Throwable.printStackTrace()" +- uid: "com.microsoft.samples.google.ValidationException.Supplier" + name: "ValidationException.Supplier" + nameWithType: "ValidationException.Supplier" + fullName: "com.microsoft.samples.google.ValidationException.Supplier" diff --git a/third_party/docfx-doclet-143274/src/test/resources/expected-generated-files/com.microsoft.samples.google.yml b/third_party/docfx-doclet-143274/src/test/resources/expected-generated-files/com.microsoft.samples.google.yml index 36079340..88353eca 100644 --- a/third_party/docfx-doclet-143274/src/test/resources/expected-generated-files/com.microsoft.samples.google.yml +++ b/third_party/docfx-doclet-143274/src/test/resources/expected-generated-files/com.microsoft.samples.google.yml @@ -3,6 +3,7 @@ items: - uid: "com.microsoft.samples.google" id: "google" children: + - "com.microsoft.samples.google.BetaApi" - "com.microsoft.samples.google.ProductSearchSettings" - "com.microsoft.samples.google.ProductSearchSettings.Builder" - "com.microsoft.samples.google.RecognitionAudio" @@ -10,6 +11,8 @@ items: - "com.microsoft.samples.google.SpeechClient" - "com.microsoft.samples.google.SpeechSettings" - "com.microsoft.samples.google.SpeechSettings.Builder" + - "com.microsoft.samples.google.ValidationException" + - "com.microsoft.samples.google.ValidationException.Supplier" langs: - "java" name: "com.microsoft.samples.google" @@ -19,6 +22,10 @@ items: syntax: content: "package com.microsoft.samples.google" references: +- uid: "com.microsoft.samples.google.BetaApi" + name: "BetaApi" + nameWithType: "BetaApi" + fullName: "com.microsoft.samples.google.BetaApi" - uid: "com.microsoft.samples.google.ProductSearchSettings" name: "ProductSearchSettings" nameWithType: "ProductSearchSettings" @@ -47,3 +54,11 @@ references: name: "SpeechSettings.Builder" nameWithType: "SpeechSettings.Builder" fullName: "com.microsoft.samples.google.SpeechSettings.Builder" +- uid: "com.microsoft.samples.google.ValidationException" + name: "ValidationException" + nameWithType: "ValidationException" + fullName: "com.microsoft.samples.google.ValidationException" +- uid: "com.microsoft.samples.google.ValidationException.Supplier" + name: "ValidationException.Supplier" + nameWithType: "ValidationException.Supplier" + fullName: "com.microsoft.samples.google.ValidationException.Supplier" diff --git a/third_party/docfx-doclet-143274/src/test/resources/expected-generated-files/toc.yml b/third_party/docfx-doclet-143274/src/test/resources/expected-generated-files/toc.yml index 7b310cdb..c460a0f6 100644 --- a/third_party/docfx-doclet-143274/src/test/resources/expected-generated-files/toc.yml +++ b/third_party/docfx-doclet-143274/src/test/resources/expected-generated-files/toc.yml @@ -8,12 +8,14 @@ items: - uid: "com.microsoft.samples" name: "Package summary" + - heading: "Interfaces" + - uid: "com.microsoft.samples.IPartner" + name: "IPartner" + - heading: "Classes" - uid: "com.microsoft.samples.BasePartnerComponent" name: "BasePartnerComponent" - uid: "com.microsoft.samples.BasePartnerComponentString" name: "BasePartnerComponentString" - - uid: "com.microsoft.samples.IPartner" - name: "IPartner" - uid: "com.microsoft.samples.KeyValuePair" name: "KeyValuePair" - uid: "com.microsoft.samples.Link" @@ -27,14 +29,16 @@ items: - uid: "com.microsoft.samples.agreements" name: "Package summary" + - heading: "Interfaces" + - uid: "com.microsoft.samples.agreements.IAgreementDetailsCollection" + name: "IAgreementDetailsCollection" + status: "deprecated" + - heading: "Classes" - uid: "com.microsoft.samples.agreements.AgreementDetailsCollectionOperations" name: "AgreementDetailsCollectionOperations" status: "deprecated" - uid: "com.microsoft.samples.agreements.AgreementMetaData" name: "AgreementMetaData" - - uid: "com.microsoft.samples.agreements.IAgreementDetailsCollection" - name: "IAgreementDetailsCollection" - status: "deprecated" - uid: "com.microsoft.samples.agreements.ResourceCollection" name: "ResourceCollection" - uid: "com.microsoft.samples.commentinheritance" @@ -42,49 +46,63 @@ items: - uid: "com.microsoft.samples.commentinheritance" name: "Package summary" - - uid: "com.microsoft.samples.commentinheritance.Animal" - name: "Animal" + - heading: "Interfaces" - uid: "com.microsoft.samples.commentinheritance.Carnivorous" name: "Carnivorous" - - uid: "com.microsoft.samples.commentinheritance.Dog" - name: "Dog" - uid: "com.microsoft.samples.commentinheritance.Herbivorous" name: "Herbivorous" - - uid: "com.microsoft.samples.commentinheritance.Herbivorous.Plant" - name: "Herbivorous.Plant" - - uid: "com.microsoft.samples.commentinheritance.Mammal" - name: "Mammal" - uid: "com.microsoft.samples.commentinheritance.Omnivorous" name: "Omnivorous" - uid: "com.microsoft.samples.commentinheritance.Organism" name: "Organism" - uid: "com.microsoft.samples.commentinheritance.Viviparous" name: "Viviparous" + - heading: "Classes" + - uid: "com.microsoft.samples.commentinheritance.Animal" + name: "Animal" + - uid: "com.microsoft.samples.commentinheritance.Dog" + name: "Dog" + - uid: "com.microsoft.samples.commentinheritance.Herbivorous.Plant" + name: "Herbivorous.Plant" + - uid: "com.microsoft.samples.commentinheritance.Mammal" + name: "Mammal" - uid: "com.microsoft.samples.google" name: "com.microsoft.samples.google" items: - uid: "com.microsoft.samples.google" name: "Package summary" + - heading: "Interfaces" + - uid: "com.microsoft.samples.google.ValidationException.Supplier" + name: "ValidationException.Supplier" + - heading: "Classes" - uid: "com.microsoft.samples.google.ProductSearchSettings" name: "ProductSearchSettings" - uid: "com.microsoft.samples.google.ProductSearchSettings.Builder" name: "ProductSearchSettings.Builder" - uid: "com.microsoft.samples.google.RecognitionAudio" name: "RecognitionAudio" - - uid: "com.microsoft.samples.google.RecognitionAudio.AudioSourceCase" - name: "RecognitionAudio.AudioSourceCase" - uid: "com.microsoft.samples.google.SpeechClient" name: "SpeechClient" - uid: "com.microsoft.samples.google.SpeechSettings" name: "SpeechSettings" - uid: "com.microsoft.samples.google.SpeechSettings.Builder" name: "SpeechSettings.Builder" + - heading: "Enums" + - uid: "com.microsoft.samples.google.RecognitionAudio.AudioSourceCase" + name: "RecognitionAudio.AudioSourceCase" + - heading: "Annotation Types" + - uid: "com.microsoft.samples.google.BetaApi" + name: "BetaApi" + - heading: "Exceptions" + - uid: "com.microsoft.samples.google.ValidationException" + name: "ValidationException" - uid: "com.microsoft.samples.google.v1beta" name: "com.microsoft.samples.google.v1beta" status: "beta" items: - uid: "com.microsoft.samples.google.v1beta" name: "Package summary" + - heading: "Classes" - uid: "com.microsoft.samples.google.v1beta.SpeechClient" name: "SpeechClient" - uid: "com.microsoft.samples.google.v1p1alpha" @@ -93,6 +111,7 @@ items: - uid: "com.microsoft.samples.google.v1p1alpha" name: "Package summary" + - heading: "Classes" - uid: "com.microsoft.samples.google.v1p1alpha.SpeechClient" name: "SpeechClient" - uid: "com.microsoft.samples.offers" @@ -100,6 +119,7 @@ items: - uid: "com.microsoft.samples.offers" name: "Package summary" + - heading: "Classes" - uid: "com.microsoft.samples.offers.Offer" name: "Offer" - uid: "com.microsoft.samples.subpackage" @@ -107,15 +127,19 @@ items: - uid: "com.microsoft.samples.subpackage" name: "Package summary" - - uid: "com.microsoft.samples.subpackage.CustomException" - name: "CustomException" + - heading: "Interfaces" - uid: "com.microsoft.samples.subpackage.Display" name: "Display" + - heading: "Classes" - uid: "com.microsoft.samples.subpackage.Person" name: "Person" - uid: "com.microsoft.samples.subpackage.Person.IdentificationInfo" name: "Person.IdentificationInfo" - - uid: "com.microsoft.samples.subpackage.Person.IdentificationInfo.Gender" - name: "Person.IdentificationInfo.Gender" - uid: "com.microsoft.samples.subpackage.Tuple" name: "Tuple" + - heading: "Enums" + - uid: "com.microsoft.samples.subpackage.Person.IdentificationInfo.Gender" + name: "Person.IdentificationInfo.Gender" + - heading: "Exceptions" + - uid: "com.microsoft.samples.subpackage.CustomException" + name: "CustomException"