当前位置: 首页>>代码示例>>Java>>正文


Java Assert.isInstanceOf方法代码示例

本文整理汇总了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;
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:23,代码来源:JpaMutableAclService.java

示例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();
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:16,代码来源:WebUtils.java

示例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();
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:16,代码来源:WebUtils.java

示例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;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:ServletServerHttpRequest.java

示例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();
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:10,代码来源:WebUtils.java

示例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()));
}
 
开发者ID:simplymequeeny,项目名称:dynamodb-client-web-gui,代码行数:8,代码来源:AwsConfigTest.java

示例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();
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:10,代码来源:CollectionImporterTest.java

示例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");
		}
	}

}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:39,代码来源:ExtenderConfiguration.java

示例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;
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:10,代码来源:DefaultFrameworkTemplate.java

示例10: getObject

import org.springframework.util.Assert; //导入方法依赖的package包/类
@Override
public SessionFactory getObject() {
	EntityManagerFactory emf = getEntityManagerFactory();
	Assert.isInstanceOf(HibernateEntityManagerFactory.class, emf);
	return ((HibernateEntityManagerFactory) emf).getSessionFactory();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:7,代码来源:HibernateJpaSessionFactoryBean.java

示例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()));
}
 
开发者ID:simplymequeeny,项目名称:dynamodb-client-web-gui,代码行数:7,代码来源:AwsConfigTest.java

示例12: setBeanFactory

import org.springframework.util.Assert; //导入方法依赖的package包/类
@Override
public void setBeanFactory(BeanFactory beanFactory) {
	Assert.isInstanceOf(ConfigurableListableBeanFactory.class, beanFactory);
	this.beanFactory = (ConfigurableListableBeanFactory) beanFactory;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:DefaultLifecycleProcessor.java

示例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;
  }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:HttpComponentsClientHttpRequestFactory.java

示例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!");

}
 
开发者ID:yanghao0518,项目名称:cstruct-parser,代码行数:7,代码来源:AbstractOptManager.java


注:本文中的org.springframework.util.Assert.isInstanceOf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。