@Test public void testGetProfile() { Profiler profiler = new Profiler(); profiler.start(String.class); profiler.end(String.class); Profiler another = new Profiler(); another.start(Object.class); another.end(Object.class); ProfileSummary summary = new ProfileSummary(profiler, another); assertThat(summary.getProfile(String.class), is(profiler.getProfile(String.class))); assertThat(summary.getProfile(Object.class), is(another.getProfile(Object.class))); }
@Override public Profile getProfile(Class<?> clazz) { return Arrays.stream(profilers) .filter(profiler -> profiler.contains(clazz)) .map(profiler -> profiler.getProfile(clazz)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Specified class " + clazz + " is not analyzed")); }
ProfileSummary implements IProfiler, XMLWriteable { @Override public Profile getProfile(Class<?> clazz) { return Arrays.stream(profilers) .filter(profiler -> profiler.contains(clazz)) .map(profiler -> profiler.getProfile(clazz)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Specified class " + clazz + " is not analyzed")); } }
ProfileSummary implements IProfiler, XMLWriteable { @Override public Profile getProfile(Class<?> clazz) { return Arrays.stream(profilers) .filter(profiler -> profiler.contains(clazz)) .map(profiler -> profiler.getProfile(clazz)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Specified class " + clazz + " is not analyzed")); } ProfileSummary(@NonNull Profiler... profilers); }
ProfileSummary implements IProfiler, XMLWriteable { @Override public Profile getProfile(Class<?> clazz) { return Arrays.stream(profilers) .filter(profiler -> profiler.contains(clazz)) .map(profiler -> profiler.getProfile(clazz)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Specified class " + clazz + " is not analyzed")); } ProfileSummary(@NonNull Profiler... profilers); void report(Comparator<Class<?>> reportComparator, Predicate<Profile> filter, PrintStream stream); @Override void writeXML(@NonNull XMLOutput xmlOutput); @Override Profile getProfile(Class<?> clazz); }
ProfileSummary implements IProfiler, XMLWriteable { @Override public Profile getProfile(Class<?> clazz) { return Arrays.stream(profilers) .filter(profiler -> profiler.contains(clazz)) .map(profiler -> profiler.getProfile(clazz)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("Specified class " + clazz + " is not analyzed")); } ProfileSummary(@NonNull Profiler... profilers); void report(Comparator<Class<?>> reportComparator, Predicate<Profile> filter, PrintStream stream); @Override void writeXML(@NonNull XMLOutput xmlOutput); @Override Profile getProfile(Class<?> clazz);  }