本文整理汇总了Java中org.springframework.util.Assert.isInstanceOf方法的典型用法代码示例。如果您正苦于以下问题:Java Assert.isInstanceOf方法的具体用法?Java Assert.isInstanceOf怎么用?Java Assert.isInstanceOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.util.Assert
的用法示例。
在下文中一共展示了Assert.isInstanceOf方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAcl
import org.springframework.util.Assert; //导入方法依赖的package包/类
@Override
public MutableAcl createAcl(ObjectIdentity objectIdentity) throws AlreadyExistsException {
Assert.notNull(objectIdentity, "Object Identity required");
// Check this object identity hasn't already been persisted
if (retrieveObjectIdentityPrimaryKey(objectIdentity) != null) {
throw new AlreadyExistsException("Object identity '" + objectIdentity + "' already exists");
}
// Need to retrieve the current principal, in order to know who "owns" this ACL (can be changed later on)
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
PrincipalSid sid = new PrincipalSid(auth);
// Create the acl_object_identity row
createObjectIdentity(objectIdentity, sid);
// Retrieve the ACL via superclass (ensures cache registration, proper retrieval etc)
Acl acl = readAclById(objectIdentity);
Assert.isInstanceOf(MutableAcl.class, acl, "MutableAcl should be been returned");
return (MutableAcl) acl;
}
示例2: getHttpServletRequest
import org.springframework.util.Assert; //导入方法依赖的package包/类
/**
* Gets the http servlet request from the context.
*
* @param context the context
* @return the http servlet request
*/
public static HttpServletRequest getHttpServletRequest(
final RequestContext context) {
Assert.isInstanceOf(ServletExternalContext.class, context
.getExternalContext(),
"Cannot obtain HttpServletRequest from event of type: "
+ context.getExternalContext().getClass().getName());
return (HttpServletRequest) context.getExternalContext().getNativeRequest();
}
示例3: getHttpServletResponse
import org.springframework.util.Assert; //导入方法依赖的package包/类
/**
* Gets the http servlet response from the context.
*
* @param context the context
* @return the http servlet response
*/
public static HttpServletResponse getHttpServletResponse(
final RequestContext context) {
Assert.isInstanceOf(ServletExternalContext.class, context
.getExternalContext(),
"Cannot obtain HttpServletResponse from event of type: "
+ context.getExternalContext().getClass().getName());
return (HttpServletResponse) context.getExternalContext()
.getNativeResponse();
}
示例4: getAsyncRequestControl
import org.springframework.util.Assert; //导入方法依赖的package包/类
@Override
public ServerHttpAsyncRequestControl getAsyncRequestControl(ServerHttpResponse response) {
if (this.asyncRequestControl == null) {
Assert.isInstanceOf(ServletServerHttpResponse.class, response);
ServletServerHttpResponse servletServerResponse = (ServletServerHttpResponse) response;
this.asyncRequestControl = new ServletServerHttpAsyncRequestControl(this, servletServerResponse);
}
return this.asyncRequestControl;
}
示例5: getHttpServletRequest
import org.springframework.util.Assert; //导入方法依赖的package包/类
public static HttpServletRequest getHttpServletRequest(
final RequestContext context) {
Assert.isInstanceOf(ServletExternalContext.class, context
.getExternalContext(),
"Cannot obtain HttpServletRequest from event of type: "
+ context.getExternalContext().getClass().getName());
return (HttpServletRequest) context.getExternalContext().getNativeRequest();
}
示例6: shouldHaveAwsCredentialsIntanceWhenEndpointUrlIsNotProvidedAndProfileIsProvided
import org.springframework.util.Assert; //导入方法依赖的package包/类
@Test
public void shouldHaveAwsCredentialsIntanceWhenEndpointUrlIsNotProvidedAndProfileIsProvided() {
ReflectionTestUtils.setField(config, "ENDPOINT_URL", "");
ReflectionTestUtils.setField(config, "PROFILE", "default");
Assert.isInstanceOf(AWSCredentials.class,
config.awsCredentials(new StubProfileCredentialsProvider()));
}
示例7: checkAndTakeDownService
import org.springframework.util.Assert; //导入方法依赖的package包/类
private void checkAndTakeDownService(String beanName, Class<?> type, String bundleSymName) throws Exception {
ServiceReference ref = bundleContext.getServiceReference(type.getName());
Object service = bundleContext.getService(ref);
Assert.isInstanceOf(type, service);
Bundle dependency = OsgiBundleUtils.findBundleBySymbolicName(bundleContext, bundleSymName);
// stop dependency bundle -> no importer -> exporter goes down
dependency.stop();
}
示例8: addDefaultDependencyFactories
import org.springframework.util.Assert; //导入方法依赖的package包/类
protected void addDefaultDependencyFactories() {
boolean debug = log.isDebugEnabled();
// default JDK 1.4 processor
dependencyFactories.add(0, new MandatoryImporterDependencyFactory());
// load through reflection the dependency and injection processors if running on JDK 1.5 and annotation
// processing is enabled
if (processAnnotation) {
// dependency processor
Class<?> annotationProcessor = null;
try {
annotationProcessor =
Class.forName(ANNOTATION_DEPENDENCY_FACTORY, false, ExtenderConfiguration.class
.getClassLoader());
} catch (ClassNotFoundException cnfe) {
log.warn("Gemini Blueprint extensions bundle not present, annotation processing disabled.");
log.debug("Gemini Blueprint extensions bundle not present, annotation processing disabled.", cnfe);
return;
}
Object processor = BeanUtils.instantiateClass(annotationProcessor);
Assert.isInstanceOf(OsgiServiceDependencyFactory.class, processor);
dependencyFactories.add(1, (OsgiServiceDependencyFactory) processor);
if (debug)
log.debug("Succesfully loaded annotation dependency processor [" + ANNOTATION_DEPENDENCY_FACTORY + "]");
// add injection processor (first in line)
postProcessors.add(0, new OsgiAnnotationPostProcessor());
log.info("Gemini Blueprint extensions annotation processing enabled");
} else {
if (debug) {
log.debug("Gemini Blueprint extensions annotation processing disabled; [" + ANNOTATION_DEPENDENCY_FACTORY
+ "] not loaded");
}
}
}
示例9: DefaultFrameworkTemplate
import org.springframework.util.Assert; //导入方法依赖的package包/类
public DefaultFrameworkTemplate(Object target, Log log) {
if (OsgiPlatformDetector.isR42()) {
Assert.isInstanceOf(Framework.class, target);
fwk = (Framework) target;
} else {
throw new IllegalStateException("Cannot use OSGi 4.2 Framework API in an OSGi 4.1 environment");
}
this.log = log;
}
示例10: getObject
import org.springframework.util.Assert; //导入方法依赖的package包/类
@Override
public SessionFactory getObject() {
EntityManagerFactory emf = getEntityManagerFactory();
Assert.isInstanceOf(HibernateEntityManagerFactory.class, emf);
return ((HibernateEntityManagerFactory) emf).getSessionFactory();
}
示例11: shouldHaveBasicCredentialsIntanceIsProvided
import org.springframework.util.Assert; //导入方法依赖的package包/类
@Test
public void shouldHaveBasicCredentialsIntanceIsProvided() {
ReflectionTestUtils.setField(config, "ENDPOINT_URL", "localhost");
Assert.isInstanceOf(BasicAWSCredentials.class,
config.awsCredentials(new StubProfileCredentialsProvider()));
}
示例12: setBeanFactory
import org.springframework.util.Assert; //导入方法依赖的package包/类
@Override
public void setBeanFactory(BeanFactory beanFactory) {
Assert.isInstanceOf(ConfigurableListableBeanFactory.class, beanFactory);
this.beanFactory = (ConfigurableListableBeanFactory) beanFactory;
}
示例13: setHttpClient
import org.springframework.util.Assert; //导入方法依赖的package包/类
/**
* Set the {@code HttpClient} used for
* <p>As of Spring Framework 4.0, the given client is expected to be of type
* {@link CloseableHttpClient} (requiring HttpClient 4.3+).
*/
public void setHttpClient(HttpClient httpClient) {
Assert.isInstanceOf(CloseableHttpClient.class, httpClient, "'httpClient' is not of type CloseableHttpClient");
this.httpClient = (CloseableHttpClient) httpClient;
}
示例14: checkValue
import org.springframework.util.Assert; //导入方法依赖的package包/类
private void checkValue(Object obj) throws ClassNotFoundException
{
Assert.isInstanceOf(JFieldOpt.class, obj, "this current value ref is not implement JFieldOpt!");
}