Refine search
/** * Expose the singleton instance (for access through the 'early singleton' proxy). * @return the singleton instance that this FactoryBean holds * @throws IllegalStateException if the singleton instance is not initialized */ @Nullable private T getSingletonInstance() throws IllegalStateException { Assert.state(this.initialized, "Singleton instance not initialized yet"); return this.singletonInstance; }
@Override public void setApplicationContext(@Nullable ApplicationContext applicationContext) { this.applicationContext = applicationContext; if (applicationContext != null) { Assert.state(!applicationContext.containsBean("mvcContentNegotiationManager"), "The Java/XML config for Spring MVC and Spring WebFlux cannot both be enabled, " + "e.g. via @EnableWebMvc and @EnableWebFlux, in the same application."); } }
@Override @SuppressWarnings("unchecked") protected RowMapper<T> newRowMapper(@Nullable Object[] parameters, @Nullable Map<?, ?> context) { if (this.rowMapper != null) { return this.rowMapper; } else { Assert.state(this.rowMapperClass != null, "No RowMapper set"); return BeanUtils.instantiateClass(this.rowMapperClass); } }
@Override @SuppressWarnings("unchecked") public void write(EvaluationContext context, @Nullable Object target, String name, @Nullable Object newValue) throws AccessException { Assert.state(target instanceof Map, "Target must be a Map"); Map<Object, Object> map = (Map<Object, Object>) target; map.put(name, newValue); }
@Override public Destination resolveDestinationName(@Nullable Session session, String destinationName, boolean pubSubDomain) throws JMSException { Assert.state(this.beanFactory != null, "BeanFactory is required"); try { return this.beanFactory.getBean(destinationName, Destination.class); } catch (BeansException ex) { throw new DestinationResolutionException( "Failed to look up Destination bean with name '" + destinationName + "'", ex); } }
@Override public void doWork(Work work, long startTimeout, @Nullable ExecutionContext executionContext, @Nullable WorkListener workListener) throws WorkException { Assert.state(this.syncTaskExecutor != null, "No 'syncTaskExecutor' set"); executeWork(this.syncTaskExecutor, work, startTimeout, false, executionContext, workListener); }
/** * Access the given target object by resolving the given property name against the given target * environment. */ @Override public TypedValue read(EvaluationContext context, @Nullable Object target, String name) throws AccessException { Assert.state(target instanceof Environment, "Target must be of type Environment"); return new TypedValue(((Environment) target).getProperty(name)); }
@Override @Nullable public Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer, NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) throws Exception { Assert.state(mavContainer != null, "ModelAndViewContainer is required for model exposure"); return mavContainer.getModel(); }
/** * Return a CallableStatementCreator to perform an operation * with this parameters. * @param inParams parameters. May be {@code null}. */ protected CallableStatementCreator newCallableStatementCreator(@Nullable Map<String, ?> inParams) { Assert.state(this.callableStatementFactory != null, "No CallableStatementFactory available"); return this.callableStatementFactory.newCallableStatementCreator(inParams); }
/** * Return a PreparedStatementCreator to perform an operation * with the given parameters. * @param params the parameter array (may be {@code null}) */ protected final PreparedStatementCreator newPreparedStatementCreator(@Nullable Object[] params) { Assert.state(this.preparedStatementFactory != null, "No PreparedStatementFactory available"); return this.preparedStatementFactory.newPreparedStatementCreator(params); }
/** * Overloaded variant of {@link #send(Object)} that also accepts a MediaType * hint for how to serialize the given Object. * @param object the object to write * @param mediaType a MediaType hint for selecting an HttpMessageConverter * @throws IOException raised when an I/O error occurs * @throws java.lang.IllegalStateException wraps any other errors */ public synchronized void send(Object object, @Nullable MediaType mediaType) throws IOException { Assert.state(!this.complete, "ResponseBodyEmitter is already set complete"); sendInternal(object, mediaType); }