/* * Copyright (C) 2013 The Dagger Authors. * * 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 dagger.internal.codegen.base; import static com.google.auto.common.MoreElements.asExecutable; import static java.util.stream.Collectors.joining; import javax.inject.Inject; import javax.lang.model.element.Element; import javax.lang.model.element.ElementVisitor; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; import javax.lang.model.util.ElementKindVisitor8; /** * Formats elements into a useful string representation. * *
Elements directly enclosed by a type are preceded by the enclosing type's qualified name. * *
Parameters are given with their enclosing executable, with other parameters elided.
*/
public final class ElementFormatter extends Formatter Elements directly enclosed by a type are preceded by the enclosing type's qualified name.
*
* Parameters are given with their enclosing executable, with other parameters elided.
*/
public static String elementToString(Element element) {
return element.accept(ELEMENT_TO_STRING, null);
}
private static final ElementVisitor