Java Code Examples for org.springframework.util.CollectionUtils#findValueOfType()
The following examples show how to use
org.springframework.util.CollectionUtils#findValueOfType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JmsResourceHolder.java From spring-analysis-note with MIT License | 5 votes |
/** * Return this resource holder's Session of the given type * for the given connection, or {@code null} if none. */ @Nullable public <S extends Session> S getSession(Class<S> sessionType, @Nullable Connection connection) { LinkedList<Session> sessions = (connection != null ? this.sessionsPerConnection.get(connection) : this.sessions); return CollectionUtils.findValueOfType(sessions, sessionType); }
Example 2
Source File: JmsResourceHolder.java From spring4-understanding with Apache License 2.0 | 5 votes |
public Session getSession(Class<? extends Session> sessionType, Connection connection) { List<Session> sessions = this.sessions; if (connection != null) { sessions = this.sessionsPerConnection.get(connection); } return CollectionUtils.findValueOfType(sessions, sessionType); }
Example 3
Source File: JmsResourceHolder.java From spring-analysis-note with MIT License | 4 votes |
/** * Return this resource holder's Connection of the given type, * or {@code null} if none. */ @Nullable public <C extends Connection> C getConnection(Class<C> connectionType) { return CollectionUtils.findValueOfType(this.connections, connectionType); }
Example 4
Source File: JmsResourceHolder.java From java-technology-stack with MIT License | 4 votes |
@Nullable public Connection getConnection(Class<? extends Connection> connectionType) { return CollectionUtils.findValueOfType(this.connections, connectionType); }
Example 5
Source File: JmsResourceHolder.java From java-technology-stack with MIT License | 4 votes |
@Nullable public Session getSession(Class<? extends Session> sessionType, @Nullable Connection connection) { List<Session> sessions = (connection != null ? this.sessionsPerConnection.get(connection) : this.sessions); return CollectionUtils.findValueOfType(sessions, sessionType); }
Example 6
Source File: JmsResourceHolder.java From spring4-understanding with Apache License 2.0 | 4 votes |
public Connection getConnection(Class<? extends Connection> connectionType) { return CollectionUtils.findValueOfType(this.connections, connectionType); }
Example 7
Source File: XsltView.java From spring-analysis-note with MIT License | 3 votes |
/** * <p>Locate the {@link Source} object in the supplied model, * converting objects as required. * The default implementation first attempts to look under the configured * {@link #setSourceKey source key}, if any, before attempting to locate * an object of {@link #getSourceTypes() supported type}. * @param model the merged model Map * @return the XSLT Source object (or {@code null} if none found) * @throws Exception if an error occurred during locating the source * @see #setSourceKey * @see #convertSource */ @Nullable protected Source locateSource(Map<String, Object> model) throws Exception { if (this.sourceKey != null) { return convertSource(model.get(this.sourceKey)); } Object source = CollectionUtils.findValueOfType(model.values(), getSourceTypes()); return (source != null ? convertSource(source) : null); }
Example 8
Source File: XsltView.java From java-technology-stack with MIT License | 3 votes |
/** * <p>Locate the {@link Source} object in the supplied model, * converting objects as required. * The default implementation first attempts to look under the configured * {@link #setSourceKey source key}, if any, before attempting to locate * an object of {@link #getSourceTypes() supported type}. * @param model the merged model Map * @return the XSLT Source object (or {@code null} if none found) * @throws Exception if an error occurred during locating the source * @see #setSourceKey * @see #convertSource */ @Nullable protected Source locateSource(Map<String, Object> model) throws Exception { if (this.sourceKey != null) { return convertSource(model.get(this.sourceKey)); } Object source = CollectionUtils.findValueOfType(model.values(), getSourceTypes()); return (source != null ? convertSource(source) : null); }
Example 9
Source File: XsltView.java From lams with GNU General Public License v2.0 | 3 votes |
/** * <p>Locate the {@link Source} object in the supplied model, * converting objects as required. * The default implementation first attempts to look under the configured * {@link #setSourceKey source key}, if any, before attempting to locate * an object of {@link #getSourceTypes() supported type}. * @param model the merged model Map * @return the XSLT Source object (or {@code null} if none found) * @throws Exception if an error occurred during locating the source * @see #setSourceKey * @see #convertSource */ protected Source locateSource(Map<String, Object> model) throws Exception { if (this.sourceKey != null) { return convertSource(model.get(this.sourceKey)); } Object source = CollectionUtils.findValueOfType(model.values(), getSourceTypes()); return (source != null ? convertSource(source) : null); }
Example 10
Source File: XsltView.java From spring4-understanding with Apache License 2.0 | 3 votes |
/** * <p>Locate the {@link Source} object in the supplied model, * converting objects as required. * The default implementation first attempts to look under the configured * {@link #setSourceKey source key}, if any, before attempting to locate * an object of {@link #getSourceTypes() supported type}. * @param model the merged model Map * @return the XSLT Source object (or {@code null} if none found) * @throws Exception if an error occurred during locating the source * @see #setSourceKey * @see #convertSource */ protected Source locateSource(Map<String, Object> model) throws Exception { if (this.sourceKey != null) { return convertSource(model.get(this.sourceKey)); } Object source = CollectionUtils.findValueOfType(model.values(), getSourceTypes()); return (source != null ? convertSource(source) : null); }
Example 11
Source File: AbstractJasperReportsView.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Create an appropriate {@code JRDataSource} for passed-in report data. * Called by {@link #fillReport} when its own lookup steps were not successful. * <p>The default implementation looks for a value of type {@code java.util.Collection} * or object array (in that order). Can be overridden in subclasses. * @param model the model map, as passed in for view rendering * @return the {@code JRDataSource} or {@code null} if the data source is not found * @see #getReportDataTypes * @see #convertReportData */ protected JRDataSource getReportData(Map<String, Object> model) { // Try to find matching attribute, of given prioritized types. Object value = CollectionUtils.findValueOfType(model.values(), getReportDataTypes()); return (value != null ? convertReportData(value) : null); }
Example 12
Source File: AbstractJasperReportsView.java From spring4-understanding with Apache License 2.0 | 2 votes |
/** * Create an appropriate {@code JRDataSource} for passed-in report data. * Called by {@link #fillReport} when its own lookup steps were not successful. * <p>The default implementation looks for a value of type {@code java.util.Collection} * or object array (in that order). Can be overridden in subclasses. * @param model the model map, as passed in for view rendering * @return the {@code JRDataSource} or {@code null} if the data source is not found * @see #getReportDataTypes * @see #convertReportData */ protected JRDataSource getReportData(Map<String, Object> model) { // Try to find matching attribute, of given prioritized types. Object value = CollectionUtils.findValueOfType(model.values(), getReportDataTypes()); return (value != null ? convertReportData(value) : null); }