/** * Build a new instance of monitoring statistics. * * @return New instance of {@code MonitoringStatisticsImpl}. */ MonitoringStatisticsImpl build() { final Map<String, ResourceStatistics> uriStats = Collections.unmodifiableMap( Views.mapView(uriStatistics, BUILDING_FUNCTION)); final Map<Class<?>, ResourceStatistics> classStats = Collections.unmodifiableMap( Views.mapView(resourceClassStatistics, BUILDING_FUNCTION)); final ExecutionStatistics requestStats = executionStatisticsBuilder == null ? ExecutionStatisticsImpl.EMPTY : executionStatisticsBuilder.build(); return new MonitoringStatisticsImpl( uriStats, classStats, requestStats, responseStatisticsBuilder.build(), exceptionMapperStatisticsBuilder.build()); } }
/** * Returns string view of list of header values. Any modifications to the underlying list are visible to the view, * the view also supports removal of elements. Does not support other modifications. * * @param headerValues header values. * @param rd RuntimeDelegate instance or {@code null} (in that case {@link RuntimeDelegate#getInstance()} * will be called for before element conversion. * @return String view of header values. */ public static List<String> asStringList(final List<Object> headerValues, final RuntimeDelegate rd) { if (headerValues == null || headerValues.isEmpty()) { return Collections.emptyList(); } final RuntimeDelegate delegate; if (rd == null) { delegate = RuntimeDelegate.getInstance(); } else { delegate = rd; } return Views.listView(headerValues, input -> (input == null) ? "[null]" : HeaderUtils.asString(input, delegate)); }
@Override public <T> Set<Method> getInitializerMethods(Class<T> type) throws MultiException { final Set<Method> originalMethods = defaultAnalyzer.getInitializerMethods(type); final Set<Method> skippedMethods = getMembersToSkip(type, methodsToSkip); return Views.setDiffView(originalMethods, skippedMethods); }
@Override public Set<String> getFields(final String parent) { final Set<String> childFilteringScopes = getFilteringScopes(parent); if (fields == null) { fields = graph.getFields( Views.setUnionView( childFilteringScopes, Collections.singleton(ScopeProvider.DEFAULT_SCOPE))); } return fields; }
@Override public Set<String> getFields(final String parent) { final Set<String> childFilteringScopes = getFilteringScopes(parent); if (fields == null) { fields = graph.getFields( Views.setUnionView( childFilteringScopes, Collections.singleton(ScopeProvider.DEFAULT_SCOPE))); } return fields; }
/** * Build a new instance of monitoring statistics. * * @return New instance of {@code MonitoringStatisticsImpl}. */ MonitoringStatisticsImpl build() { final Map<String, ResourceStatistics> uriStats = Collections.unmodifiableMap( Views.mapView(uriStatistics, BUILDING_FUNCTION)); final Map<Class<?>, ResourceStatistics> classStats = Collections.unmodifiableMap( Views.mapView(resourceClassStatistics, BUILDING_FUNCTION)); final ExecutionStatistics requestStats = executionStatisticsBuilder == null ? ExecutionStatisticsImpl.EMPTY : executionStatisticsBuilder.build(); return new MonitoringStatisticsImpl( uriStats, classStats, requestStats, responseStatisticsBuilder.build(), exceptionMapperStatisticsBuilder.build()); } }
/** * Returns string view of list of header values. Any modifications to the underlying list are visible to the view, * the view also supports removal of elements. Does not support other modifications. * * @param headerValues header values. * @param rd RuntimeDelegate instance or {@code null} (in that case {@link RuntimeDelegate#getInstance()} * will be called for before element conversion. * @return String view of header values. */ public static List<String> asStringList(final List<Object> headerValues, final RuntimeDelegate rd) { if (headerValues == null || headerValues.isEmpty()) { return Collections.emptyList(); } final RuntimeDelegate delegate; if (rd == null) { delegate = RuntimeDelegate.getInstance(); } else { delegate = rd; } return Views.listView(headerValues, input -> (input == null) ? "[null]" : HeaderUtils.asString(input, delegate)); }
@Override public <T> Set<Field> getFields(Class<T> type) throws MultiException { final Set<Field> originalFields = defaultAnalyzer.getFields(type); final Set<Field> skippedFields = getMembersToSkip(type, fieldsToSkip); return Views.setDiffView(originalFields, skippedFields); }
/** * Returns string view of passed headers. Any modifications to the headers are visible to the view, the view also * supports removal of elements. Does not support other modifications. * * @param headers headers. * @return String view of headers or {@code null} if {code headers} input parameter is {@code null}. */ public static MultivaluedMap<String, String> asStringHeaders(final MultivaluedMap<String, Object> headers) { if (headers == null) { return null; } final RuntimeDelegate rd = RuntimeDelegate.getInstance(); return new AbstractMultivaluedMap<String, String>( Views.mapView(headers, input -> HeaderUtils.asStringList(input, rd)) ) { }; }
/** * Returns string view of list of header values. Any modifications to the underlying list are visible to the view, * the view also supports removal of elements. Does not support other modifications. * * @param headerValues header values. * @param rd RuntimeDelegate instance or {@code null} (in that case {@link RuntimeDelegate#getInstance()} * will be called for before element conversion. * @return String view of header values. */ public static List<String> asStringList(final List<Object> headerValues, final RuntimeDelegate rd) { if (headerValues == null || headerValues.isEmpty()) { return Collections.emptyList(); } final RuntimeDelegate delegate; if (rd == null) { delegate = RuntimeDelegate.getInstance(); } else { delegate = rd; } return Views.listView(headerValues, input -> (input == null) ? "[null]" : HeaderUtils.asString(input, delegate)); }
@Override public <T> Set<Field> getFields(Class<T> type) throws MultiException { final Set<Field> originalFields = defaultAnalyzer.getFields(type); final Set<Field> skippedFields = getMembersToSkip(type, fieldsToSkip); return Views.setDiffView(originalFields, skippedFields); }
/** * Returns string view of passed headers. Any modifications to the headers are visible to the view, the view also * supports removal of elements. Does not support other modifications. * * @param headers headers. * @return String view of headers or {@code null} if {code headers} input parameter is {@code null}. */ public static MultivaluedMap<String, String> asStringHeaders(final MultivaluedMap<String, Object> headers) { if (headers == null) { return null; } final RuntimeDelegate rd = RuntimeDelegate.getInstance(); return new AbstractMultivaluedMap<String, String>( Views.mapView(headers, input -> HeaderUtils.asStringList(input, rd)) ) { }; }
/** * Returns string view of list of header values. Any modifications to the underlying list are visible to the view, * the view also supports removal of elements. Does not support other modifications. * * @param headerValues header values. * @param rd RuntimeDelegate instance or {@code null} (in that case {@link RuntimeDelegate#getInstance()} * will be called for before element conversion. * @return String view of header values. */ public static List<String> asStringList(final List<Object> headerValues, final RuntimeDelegate rd) { if (headerValues == null || headerValues.isEmpty()) { return Collections.emptyList(); } final RuntimeDelegate delegate; if (rd == null) { delegate = RuntimeDelegate.getInstance(); } else { delegate = rd; } return Views.listView(headerValues, input -> (input == null) ? "[null]" : HeaderUtils.asString(input, delegate)); }
@Override public <T> Set<Method> getInitializerMethods(Class<T> type) throws MultiException { final Set<Method> originalMethods = defaultAnalyzer.getInitializerMethods(type); final Set<Method> skippedMethods = getMembersToSkip(type, methodsToSkip); return Views.setDiffView(originalMethods, skippedMethods); }
@Override public Map<String, ObjectGraph> getSubgraphs(final String parent) { final Set<String> childFilteringScopes = getFilteringScopes(parent); if (subgraphs == null) { final Map<String, Class<?>> contextSubgraphs = graph.getSubgraphs(childFilteringScopes); contextSubgraphs.putAll(graph.getSubgraphs(ScopeProvider.DEFAULT_SCOPE)); subgraphs = Views.mapView(contextSubgraphs, new Function<Class<?>, ObjectGraph>() { @Override public ObjectGraph apply(final Class<?> clazz) { final EntityGraph entityGraph = classToGraph.get(clazz); return entityGraph == null ? new EmptyObjectGraph(clazz) : new ObjectGraphImpl(classToGraph, entityGraph, filteringScopes); } }); } return subgraphs; }
/** * Build a new instance of monitoring statistics. * * @return New instance of {@code MonitoringStatisticsImpl}. */ MonitoringStatisticsImpl build() { final Map<String, ResourceStatistics> uriStats = Collections.unmodifiableMap( Views.mapView(uriStatistics, BUILDING_FUNCTION)); final Map<Class<?>, ResourceStatistics> classStats = Collections.unmodifiableMap( Views.mapView(resourceClassStatistics, BUILDING_FUNCTION)); final ExecutionStatistics requestStats = executionStatisticsBuilder == null ? ExecutionStatisticsImpl.EMPTY : executionStatisticsBuilder.build(); return new MonitoringStatisticsImpl( uriStats, classStats, requestStats, responseStatisticsBuilder.build(), exceptionMapperStatisticsBuilder.build()); } }
/** * Build a new instance of monitoring statistics. * * @return New instance of {@code MonitoringStatisticsImpl}. */ MonitoringStatisticsImpl build() { final Map<String, ResourceStatistics> uriStats = Collections.unmodifiableMap( Views.mapView(uriStatistics, BUILDING_FUNCTION)); final Map<Class<?>, ResourceStatistics> classStats = Collections.unmodifiableMap( Views.mapView(resourceClassStatistics, BUILDING_FUNCTION)); final ExecutionStatistics requestStats = executionStatisticsBuilder == null ? ExecutionStatisticsImpl.EMPTY : executionStatisticsBuilder.build(); return new MonitoringStatisticsImpl( uriStats, classStats, requestStats, responseStatisticsBuilder.build(), exceptionMapperStatisticsBuilder.build()); } }
/** * Returns string view of passed headers. Any modifications to the headers are visible to the view, the view also * supports removal of elements. Does not support other modifications. * * @param headers headers. * @return String view of headers or {@code null} if {code headers} input parameter is {@code null}. */ public static MultivaluedMap<String, String> asStringHeaders(final MultivaluedMap<String, Object> headers) { if (headers == null) { return null; } final RuntimeDelegate rd = RuntimeDelegate.getInstance(); return new AbstractMultivaluedMap<String, String>( Views.mapView(headers, input -> HeaderUtils.asStringList(input, rd)) ) { }; }
/** * Returns string view of passed headers. Any modifications to the headers are visible to the view, the view also * supports removal of elements. Does not support other modifications. * * @param headers headers. * @return String view of headers or {@code null} if {code headers} input parameter is {@code null}. */ public static MultivaluedMap<String, String> asStringHeaders(final MultivaluedMap<String, Object> headers) { if (headers == null) { return null; } final RuntimeDelegate rd = RuntimeDelegate.getInstance(); return new AbstractMultivaluedMap<String, String>( Views.mapView(headers, input -> HeaderUtils.asStringList(input, rd)) ) { }; }
@Override public Map<String, ObjectGraph> getSubgraphs(final String parent) { final Set<String> childFilteringScopes = getFilteringScopes(parent); if (subgraphs == null) { final Map<String, Class<?>> contextSubgraphs = graph.getSubgraphs(childFilteringScopes); contextSubgraphs.putAll(graph.getSubgraphs(ScopeProvider.DEFAULT_SCOPE)); subgraphs = Views.mapView(contextSubgraphs, new Function<Class<?>, ObjectGraph>() { @Override public ObjectGraph apply(final Class<?> clazz) { final EntityGraph entityGraph = classToGraph.get(clazz); return entityGraph == null ? new EmptyObjectGraph(clazz) : new ObjectGraphImpl(classToGraph, entityGraph, filteringScopes); } }); } return subgraphs; }