private static String moduleSourceString(ElementSource elementSource) { // if we only have one module (or don't know what they are), then don't bother // reporting it, because the source already is going to report exactly that module. if (elementSource == null) { return ""; } List<String> modules = Lists.newArrayList(elementSource.getModuleClassNames()); // Insert any original element sources w/ module info into the path. while (elementSource.getOriginalElementSource() != null) { elementSource = elementSource.getOriginalElementSource(); modules.addAll(0, elementSource.getModuleClassNames()); } if (modules.size() <= 1) { return ""; } // Ideally we'd do: // return Joiner.on(" -> ") // .appendTo(new StringBuilder(" (via modules: "), Lists.reverse(modules)) // .append(")").toString(); // ... but for some reason we can't find Lists.reverse, so do it the boring way. StringBuilder builder = new StringBuilder(" (via modules: "); for (int i = modules.size() - 1; i >= 0; i--) { builder.append(modules.get(i)); if (i != 0) { builder.append(" -> "); } } builder.append(")"); return builder.toString(); }
/** Returns {@code getDeclaringSource().toString()} value. */ @Override public String toString() { return getDeclaringSource().toString(); } }
if (declaringSource instanceof ElementSource) { originalSource = (ElementSource) declaringSource; declaringSource = originalSource.getDeclaringSource(); return new ElementSource(originalSource, declaringSource, moduleSource, partialCallStack);
/** * @param elements List of elements * @return List all Module classes that were involved in setting up bindings for the list of Elements */ public static List<String> getAllSourceModules(List<Element> elements) { List<String> names = new ArrayList<>(); for (Element element : elements) { if (element.getSource().getClass().isAssignableFrom(ElementSource.class)) { ElementSource source = (ElementSource)element.getSource(); names.addAll(source.getModuleClassNames()); } } return names; }
List<String> names = element.getModuleClassNames(); String name = names.get(0);
@Override protected String visitOther(Element element) { Object source = element.getSource(); ElementSource elementSource = null; while (source instanceof ElementSource) { elementSource = (ElementSource)source; source = elementSource.getOriginalElementSource(); } if (elementSource != null) { return elementSource.getModuleClassNames().toString(); } return null; } }
static void formatSource(Formatter formatter, Object source) { ElementSource elementSource = null; if (source instanceof ElementSource) { elementSource = (ElementSource) source; source = elementSource.getDeclaringSource(); } formatSource(formatter, source, elementSource); }
List<String> names = element.getModuleClassNames(); String name = names.get(0);
if (declaringSource instanceof ElementSource) { originalSource = (ElementSource) declaringSource; declaringSource = originalSource.getDeclaringSource(); return new ElementSource(originalSource, declaringSource, moduleSource, partialCallStack);
private static String moduleSourceString(ElementSource elementSource) { // if we only have one module (or don't know what they are), then don't bother // reporting it, because the source already is going to report exactly that module. if (elementSource == null) { return ""; } List<String> modules = Lists.newArrayList(elementSource.getModuleClassNames()); // Insert any original element sources w/ module info into the path. while (elementSource.getOriginalElementSource() != null) { elementSource = elementSource.getOriginalElementSource(); modules.addAll(0, elementSource.getModuleClassNames()); } if (modules.size() <= 1) { return ""; } // Ideally we'd do: // return Joiner.on(" -> ") // .appendTo(new StringBuilder(" (via modules: "), Lists.reverse(modules)) // .append(")").toString(); // ... but for some reason we can't find Lists.reverse, so do it the boring way. StringBuilder builder = new StringBuilder(" (via modules: "); for (int i = modules.size() - 1; i >= 0; i--) { builder.append(modules.get(i)); if (i != 0) { builder.append(" -> "); } } builder.append(")"); return builder.toString(); }
/** Formats an object in a user friendly way. */ static Object convert(Object o) { ElementSource source = null; if (o instanceof ElementSource) { source = (ElementSource) o; o = source.getDeclaringSource(); } return convert(o, source); }
List<String> names = element.getModuleClassNames(); String name = names.get(0);
if (declaringSource instanceof ElementSource) { originalSource = (ElementSource) declaringSource; declaringSource = originalSource.getDeclaringSource(); return new ElementSource( originalSource, declaringSource, moduleSource, partialCallStack);
private static String moduleSourceString(ElementSource elementSource) { // if we only have one module (or don't know what they are), then don't bother // reporting it, because the source already is going to report exactly that module. if (elementSource == null) { return ""; } List<String> modules = Lists.newArrayList(elementSource.getModuleClassNames()); // Insert any original element sources w/ module info into the path. while (elementSource.getOriginalElementSource() != null) { elementSource = elementSource.getOriginalElementSource(); modules.addAll(0, elementSource.getModuleClassNames()); } if (modules.size() <= 1) { return ""; } // Ideally we'd do: // return Joiner.on(" -> ") // .appendTo(new StringBuilder(" (via modules: "), Lists.reverse(modules)) // .append(")").toString(); // ... but for some reason we can't find Lists.reverse, so do it the boring way. StringBuilder builder = new StringBuilder(" (via modules: "); for (int i = modules.size() - 1; i >= 0; i--) { builder.append(modules.get(i)); if (i != 0) { builder.append(" -> "); } } builder.append(")"); return builder.toString(); }
/** Returns {@code getDeclaringSource().toString()} value. */ @Override public String toString() { return getDeclaringSource().toString(); } }
List<String> names = element.getModuleClassNames(); String name = names.get(0);
if (declaringSource instanceof ElementSource) { originalSource = (ElementSource) declaringSource; declaringSource = originalSource.getDeclaringSource(); return new ElementSource(originalSource, declaringSource, moduleSource, partialCallStack);
private static String moduleSourceString(ElementSource elementSource) { // if we only have one module (or don't know what they are), then don't bother // reporting it, because the source already is going to report exactly that module. if (elementSource == null) { return ""; } List<String> modules = Lists.newArrayList(elementSource.getModuleClassNames()); // Insert any original element sources w/ module info into the path. while (elementSource.getOriginalElementSource() != null) { elementSource = elementSource.getOriginalElementSource(); modules.addAll(0, elementSource.getModuleClassNames()); } if (modules.size() <= 1) { return ""; } // Ideally we'd do: // return Joiner.on(" -> ") // .appendTo(new StringBuilder(" (via modules: "), Lists.reverse(modules)) // .append(")").toString(); // ... but for some reason we can't find Lists.reverse, so do it the boring way. StringBuilder builder = new StringBuilder(" (via modules: "); for (int i = modules.size() - 1; i >= 0; i--) { builder.append(modules.get(i)); if (i != 0) { builder.append(" -> "); } } builder.append(")"); return builder.toString(); }
/** Returns {@code getDeclaringSource().toString()} value. */ @Override public String toString() { return getDeclaringSource().toString(); } }
/** * Returns {@code getDeclaringSource().toString()} value. */ @Override public String toString() { return getDeclaringSource().toString(); } }