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


Java Assert.notNull方法代码示例

本文整理汇总了Java中org.springframework.util.Assert.notNull方法的典型用法代码示例。如果您正苦于以下问题:Java Assert.notNull方法的具体用法?Java Assert.notNull怎么用?Java Assert.notNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.util.Assert的用法示例。


在下文中一共展示了Assert.notNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: copyConfigurationFrom

import org.springframework.util.Assert; //导入方法依赖的package包/类
@Override
public void copyConfigurationFrom(ConfigurableBeanFactory otherFactory) {
	Assert.notNull(otherFactory, "BeanFactory must not be null");
	setBeanClassLoader(otherFactory.getBeanClassLoader());
	setCacheBeanMetadata(otherFactory.isCacheBeanMetadata());
	setBeanExpressionResolver(otherFactory.getBeanExpressionResolver());
	if (otherFactory instanceof AbstractBeanFactory) {
		AbstractBeanFactory otherAbstractFactory = (AbstractBeanFactory) otherFactory;
		this.customEditors.putAll(otherAbstractFactory.customEditors);
		this.propertyEditorRegistrars.addAll(otherAbstractFactory.propertyEditorRegistrars);
		this.beanPostProcessors.addAll(otherAbstractFactory.beanPostProcessors);
		this.hasInstantiationAwareBeanPostProcessors = this.hasInstantiationAwareBeanPostProcessors ||
				otherAbstractFactory.hasInstantiationAwareBeanPostProcessors;
		this.hasDestructionAwareBeanPostProcessors = this.hasDestructionAwareBeanPostProcessors ||
				otherAbstractFactory.hasDestructionAwareBeanPostProcessors;
		this.scopes.putAll(otherAbstractFactory.scopes);
		this.securityContextProvider = otherAbstractFactory.securityContextProvider;
	}
	else {
		setTypeConverter(otherFactory.getTypeConverter());
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:AbstractBeanFactory.java

示例2: await

import org.springframework.util.Assert; //导入方法依赖的package包/类
public EtlEventData await(Long pipelineId) throws InterruptedException {
    Assert.notNull(pipelineId);

    PermitMonitor permitMonitor = ArbitrateFactory.getInstance(pipelineId, PermitMonitor.class);
    permitMonitor.waitForPermit();// 阻塞等待授权

    MemoryStageController stageController = ArbitrateFactory.getInstance(pipelineId, MemoryStageController.class);
    Long processId = stageController.waitForProcess(StageType.EXTRACT); // 符合条件的processId

    ChannelStatus status = permitMonitor.getChannelPermit();
    if (status.isStart()) {// 即时查询一下当前的状态,状态随时可能会变
        return stageController.getLastData(processId);
    } else {
        logger.warn("pipelineId[{}] extract ignore processId[{}] by status[{}]", new Object[] { pipelineId,
                processId, status });
        return await(pipelineId);// 递归调用
    }
}
 
开发者ID:luoyaogui,项目名称:otter-G,代码行数:19,代码来源:ExtractMemoryArbitrateEvent.java

示例3: deleteCursusPostBac

import org.springframework.util.Assert; //导入方法依赖的package包/类
/**Supprime un cursus
 * @param candidat
 * @param cursus
 * @param listener
 */
public void deleteCursusPostBac(Candidat candidat,	CandidatCursusPostBac cursus, CandidatCursusExterneListener listener) {
	Assert.notNull(cursus, applicationContext.getMessage("assert.notNull", null, UI.getCurrent().getLocale()));
	/* Verrou --> normalement le lock est géré en amont mais on vérifie qd même*/
	String lockError = candidatController.getLockError(candidat.getCompteMinima(), ConstanteUtils.LOCK_CURSUS_EXTERNE);
	if (lockError!=null) {
		Notification.show(lockError, Type.ERROR_MESSAGE);
		return;
	}
	
	ConfirmWindow confirmWindow = new ConfirmWindow(applicationContext.getMessage("cursusexterne.confirmDelete", null, UI.getCurrent().getLocale()), applicationContext.getMessage("cursusexterne.confirmDeleteTitle", null, UI.getCurrent().getLocale()));
	confirmWindow.addBtnOuiListener(e -> {
		candidatCursusPostBacRepository.delete(cursus);
		candidat.getCandidatCursusPostBacs().remove(cursus);			
		listener.cursusModified(candidat.getCandidatCursusPostBacs());
	});
	UI.getCurrent().addWindow(confirmWindow);
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:23,代码来源:CandidatParcoursController.java

示例4: runAs

import org.springframework.util.Assert; //导入方法依赖的package包/类
/**
 * Configures the Spring Security {@link SecurityContext} to be authenticated as the user with the given username and
 * password as well as the given granted authorities.
 * 
 * @param username must not be {@literal null} or empty.
 * @param password must not be {@literal null} or empty.
 * @param roles
 */
public static void runAs(String username, String password, String... roles) {

	Assert.notNull(username, "Username must not be null!");
	Assert.notNull(password, "Password must not be null!");

	SecurityContextHolder.getContext().setAuthentication(
			new UsernamePasswordAuthenticationToken(username, password, AuthorityUtils.createAuthorityList(roles)));
}
 
开发者ID:Just-Fun,项目名称:spring-data-examples,代码行数:17,代码来源:SecurityUtils.java

示例5: execute

import org.springframework.util.Assert; //导入方法依赖的package包/类
@Override
public void execute(Runnable task) {
	Assert.notNull(task, "Runnable must not be null");
	if (!runInThread(task)) {
		throw new SchedulingException("Quartz SimpleThreadPool already shut down");
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:SimpleThreadPoolTaskExecutor.java

示例6: loadReferenceGenome

import org.springframework.util.Assert; //导入方法依赖的package包/类
/**
 * Returns {@code Reference} entity associated with the given ID. It also includes all information
 * about all chromosomes associated with a reference genome.
 *
 * @param referenceId {@code Long} specifies ID of a reference genome which metadata should be loaded
 * @return {@code Reference} specifies a reference genome metadata, including the list of chromosome
 * associated with it
 * @throws IllegalArgumentException will be thrown in a case, if no reference with the given ID can be
 *                                  found in the system
 */
@Transactional(propagation = Propagation.REQUIRED)
public Reference loadReferenceGenome(final Long referenceId) {
    final Reference reference = referenceGenomeDao.loadReferenceGenome(referenceId);
    Assert.notNull(reference, getMessage(MessageCode.NO_SUCH_REFERENCE));

    final List<Chromosome> chromosomes = referenceGenomeDao.loadAllChromosomesByReferenceId(referenceId);
    reference.setChromosomes(chromosomes);

    if (reference.getGeneFile() != null) {
        reference.setGeneFile(geneFileDao.loadGeneFile(reference.getGeneFile().getId()));
    }

    return reference;
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:25,代码来源:ReferenceGenomeManager.java

示例7: afterPropertiesSet

import org.springframework.util.Assert; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void afterPropertiesSet() throws Exception {
    if (topics == null && topicPatternString == null) {
        throw new IllegalArgumentException("topic info must not be null");
    }
    Assert.notEmpty(configs, "configs must not be null");
    Assert.notNull(payloadListener, "payloadListener must be null");
    String valueDeserializerKlass = (String) configs.get("value.deserializer");
    configs.put("value.deserializer", "org.apache.kafka.common.serialization.ByteArrayDeserializer");
    Consumer<String, byte[]> consumer = new KafkaConsumer<>(configs);

    Deserializer valueDeserializer = createDeserializer(valueDeserializerKlass);
    valueDeserializer.configure(configs, false);

    if (topics != null) {
        listenableConsumer =
                new ListenableTracingConsumer<>(consumer, Arrays.asList(topics), valueDeserializer);
    } else {
        listenableConsumer =
                new ListenableTracingConsumer<>(consumer, Pattern.compile(topicPatternString), valueDeserializer);
    }
    if (payloadListener != null) {
        listenableConsumer.addListener(payloadListener);
    }
    listenableConsumer.start();
}
 
开发者ID:YanXs,项目名称:nighthawk,代码行数:28,代码来源:ListenableConsumerFactoryBean.java

示例8: getReadsFromUrl

import org.springframework.util.Assert; //导入方法依赖的package包/类
/**
 * Loads reads into the track from the input URL
 * @param track to load reads
 * @param bamUrl {@code BamFile} URL
 * @param bamIndexUrl  {@code BamFile} index URL
 * @param options track options
 * @return {@code BamTrack} filled with reads
 * @throws IOException if {@code BamFile} cannot be read
 */
public BamTrack<Read> getReadsFromUrl(final Track<Read> track, String bamUrl, String bamIndexUrl,
                                      final BamQueryOption options) throws IOException {
    final BamTrack<Read> bamTrack = new BamTrack<>(track);
    Assert.notNull(track.getChromosome().getReferenceId());
    final BamFile bamFile = makeUrlBamFile(bamUrl, bamIndexUrl, track.getChromosome().getReferenceId());

    getReads(bamFile, bamTrack, options);
    return bamTrack;
}
 
开发者ID:react-dev26,项目名称:NGB-master,代码行数:19,代码来源:BamHelper.java

示例9: deleteTypeDecision

import org.springframework.util.Assert; //导入方法依赖的package包/类
/**
 * Supprime une typeDecision
 * @param typeDecision
 */
public void deleteTypeDecision(TypeDecision typeDecision) {
	Assert.notNull(typeDecision, applicationContext.getMessage("assert.notNull", null, UI.getCurrent().getLocale()));

	if (!isAutorizedToDelete(typeDecision)){
		return;
	}
	
	/* Verrou */
	if (!lockController.getLockOrNotify(typeDecision, null)) {
		return;
	}

	ConfirmWindow confirmWindow = new ConfirmWindow(applicationContext.getMessage("typeDec.window.confirmDelete", new Object[]{typeDecision.getCodTypDec()}, UI.getCurrent().getLocale()), applicationContext.getMessage("typeDec.window.confirmDeleteTitle", null, UI.getCurrent().getLocale()));
	confirmWindow.addBtnOuiListener(e -> {
		/* Contrôle que le client courant possède toujours le lock */
		if (lockController.getLockOrNotify(typeDecision, null)) {
			typeDecisionRepository.delete(typeDecision);
			/* Suppression du lock */
			lockController.releaseLock(typeDecision);
		}
	});
	confirmWindow.addCloseListener(e -> {
		/* Suppression du lock */
		lockController.releaseLock(typeDecision);
	});
	UI.getCurrent().addWindow(confirmWindow);
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:32,代码来源:TypeDecisionController.java

示例10: setWrappedInstance

import org.springframework.util.Assert; //导入方法依赖的package包/类
/**
 * Switch the target object, replacing the cached introspection results only
 * if the class of the new object is different to that of the replaced object.
 * @param object the new target object
 * @param nestedPath the nested path of the object
 * @param rootObject the root object at the top of the path
 */
public void setWrappedInstance(Object object, String nestedPath, Object rootObject) {
	Assert.notNull(object, "Bean object must not be null");
	this.object = object;
	this.nestedPath = (nestedPath != null ? nestedPath : "");
	this.rootObject = (!"".equals(this.nestedPath) ? rootObject : object);
	this.nestedBeanWrappers = null;
	this.typeConverterDelegate = new TypeConverterDelegate(this, object);
	setIntrospectionClass(object.getClass());
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:BeanWrapperImpl.java

示例11: change

import org.springframework.util.Assert; //导入方法依赖的package包/类
@Audit(action = "CHANGE_PASSWORD",
        actionResolverName = "CHANGE_PASSWORD_ACTION_RESOLVER",
        resourceResolverName = "CHANGE_PASSWORD_RESOURCE_RESOLVER")
@Override
public boolean change(final Credential credential, final PasswordChangeBean bean) {
    Assert.notNull(credential, "Credential cannot be null");
    Assert.notNull(bean, "PasswordChangeBean cannot be null");
    final UsernamePasswordCredential c = (UsernamePasswordCredential) credential;
    final PasswordEncoder encoder = Beans.newPasswordEncoder(passwordManagementProperties.getJdbc().getPasswordEncoder());
    final String password = encoder.encode(bean.getPassword());
    final int count = this.jdbcTemplate.update(passwordManagementProperties.getJdbc().getSqlChangePassword(), password, c.getId());
    return count > 0;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:14,代码来源:JdbcPasswordManagementService.java

示例12: build

import org.springframework.util.Assert; //导入方法依赖的package包/类
public DoubleDefinition build() {
	Assert.notNull(doubleClass);
	Assert.notNull(name);

	return new DoubleDefinition(doubleClass, doubleConfiguration, new DoubleName(name, aliases));
}
 
开发者ID:pchudzik,项目名称:springmock,代码行数:7,代码来源:DoubleDefinition.java

示例13: setFrom

import org.springframework.util.Assert; //导入方法依赖的package包/类
public void setFrom(InternetAddress from) throws MessagingException {
	Assert.notNull(from, "From address must not be null");
	validateAddress(from);
	this.mimeMessage.setFrom(from);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:MimeMessageHelper.java

示例14: validate

import org.springframework.util.Assert; //导入方法依赖的package包/类
@Override
public <T> Set<ConstraintViolation<T>> validate(T object, Class<?>... groups) {
	Assert.notNull(this.targetValidator, "No target Validator set");
	return this.targetValidator.validate(object, groups);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:SpringValidatorAdapter.java

示例15: flush

import org.springframework.util.Assert; //导入方法依赖的package包/类
/**
 * 刷新实体对象对应的EntityManager
 * @param entity 实体对象
 * @param <T> 领域类(实体类)范型
 */
public static <T> void flush(T entity) {
	Assert.notNull(entity, "entity can not be null.");
	EntityManager em = getEntityManager(entity.getClass());
	em.flush();
}
 
开发者ID:muxiangqiu,项目名称:linq,代码行数:11,代码来源:JpaUtil.java


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