本文整理汇总了Java中org.springframework.util.Assert.notEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java Assert.notEmpty方法的具体用法?Java Assert.notEmpty怎么用?Java Assert.notEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.util.Assert
的用法示例。
在下文中一共展示了Assert.notEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStringObjectMap
import org.springframework.util.Assert; //导入方法依赖的package包/类
private Map<String, Object> getStringObjectMap(Map jsonMap) {
Assert.notNull(jsonMap, "Failed to parse the Tweet json!");
String tweetText = (String) jsonMap.get(TWEET_TEXT_TAG);
if (isEmpty(tweetText)) {
logger.warn("Tweet with out text: " + jsonMap.get(TWEET_ID_TAG));
tweetText = "";
}
int[][] tweetVector = wordVocabulary.vectorizeSentence(tweetText);
Assert.notEmpty(tweetVector, "Failed to vectorize the tweet text: " + tweetText);
Map<String, Object> response = new HashMap<>();
response.put(DATA_IN, tweetVector);
response.put(DROPOUT_KEEP_PROB, DROPOUT_KEEP_PROB_VALUE);
return response;
}
开发者ID:spring-cloud-stream-app-starters,项目名称:tensorflow,代码行数:21,代码来源:TwitterSentimentTensorflowInputConverter.java
示例2: orContains
import org.springframework.util.Assert; //导入方法依赖的package包/类
/**
* Return a ExpressionList specifying propertyNames contains value.
*
* @param expressionList the ExpressionList to add contains expression
* @param propertyNames the property name of entity bean.
* @param value contains value.
* @param <T> the type of entity.
* @return the ExpressionList specifying propertyNames contains value.
*/
public static <T> ExpressionList<T> orContains(ExpressionList<T> expressionList,
List<String> propertyNames,
String value) {
Assert.notNull(expressionList, "expressionList must not null");
Assert.notEmpty(propertyNames, "propertyNames must not empty");
if (StringUtils.hasText(value)) {
Junction<T> junction = expressionList
.or();
ExpressionList<T> exp = null;
for (String propertyName : propertyNames) {
if (exp == null) {
exp = junction.contains(propertyName, value);
} else {
exp = exp.contains(propertyName, value);
}
}
if (exp != null) {
exp.endOr();
return exp;
}
}
return expressionList;
}
示例3: initRocketMQPushConsumer
import org.springframework.util.Assert; //导入方法依赖的package包/类
private void initRocketMQPushConsumer() throws MQClientException {
Assert.notNull(getConsumerGroup(), "Property 'consumerGroup' is required");
Assert.notEmpty(subscribeTopicTags(), "subscribeTopicTags method can't be empty");
consumer = new DefaultMQPushConsumer(getConsumerGroup());
if (consumeThreadMax != null) {
consumer.setConsumeThreadMax(consumeThreadMax);
}
if (consumeThreadMax != null && consumeThreadMax < consumer.getConsumeThreadMin()) {
consumer.setConsumeThreadMin(consumeThreadMax);
}
consumer.setConsumeFromWhere(consumeFromWhere);
consumer.setMessageModel(messageModel);
switch (consumeMode) {
case Orderly:
consumer.setMessageListener(new DefaultMessageListenerOrderly());
break;
case CONCURRENTLY:
consumer.setMessageListener(new DefaultMessageListenerConcurrently());
break;
default:
throw new IllegalArgumentException("Property 'consumeMode' was wrong.");
}
}
示例4: initApplicationContext
import org.springframework.util.Assert; //导入方法依赖的package包/类
@Override
public void initApplicationContext() throws BeansException {
Collection<ValidatorController> validatorControllers = getApplicationContext()
.getBeansOfType(ValidatorController.class).values();
Assert.notEmpty(validatorControllers, "No Validator Controller bean definition found.");
ValidatorController validatorController = validatorControllers.iterator().next();
validatorController.setupUrlMapping(this);
super.initApplicationContext();
}
示例5: AnnotationTransactionAttributeSource
import org.springframework.util.Assert; //导入方法依赖的package包/类
/**
* Create a custom AnnotationTransactionAttributeSource.
* @param annotationParsers the TransactionAnnotationParsers to use
*/
public AnnotationTransactionAttributeSource(TransactionAnnotationParser... annotationParsers) {
this.publicMethodsOnly = true;
Assert.notEmpty(annotationParsers, "At least one TransactionAnnotationParser needs to be specified");
Set<TransactionAnnotationParser> parsers = new LinkedHashSet<TransactionAnnotationParser>(annotationParsers.length);
Collections.addAll(parsers, annotationParsers);
this.annotationParsers = parsers;
}
示例6: setCacheNames
import org.springframework.util.Assert; //导入方法依赖的package包/类
public void setCacheNames(String[] cacheNames) {
Assert.notEmpty(cacheNames);
this.cacheNames = new LinkedHashSet<String>(cacheNames.length);
for (String string : cacheNames) {
this.cacheNames.add(string);
}
}
示例7: insert
import org.springframework.util.Assert; //导入方法依赖的package包/类
/**
* 新增
*/
public void insert() {
Assert.notEmpty(columns, "没有可以插入的行数据");
Map<String, String[]> mapping = getColumnsMapping();
String sql = new SQL()
.INSERT_INTO(table)
.INTO_COLUMNS(mapping.get("columns"))
.INTO_VALUES(mapping.get("values"))
.toString();
executeUpdate(sql, values);
}
示例8: ContentNegotiationManager
import org.springframework.util.Assert; //导入方法依赖的package包/类
/**
* Create an instance with the given ContentNegotiationStrategy instances.
* <p>Each instance is checked to see if it is also an implementation of
* MediaTypeFileExtensionResolver, and if so it is registered as such.
* @param strategies one more more ContentNegotiationStrategy instances
*/
public ContentNegotiationManager(ContentNegotiationStrategy... strategies) {
Assert.notEmpty(strategies, "At least one ContentNegotiationStrategy is expected");
this.contentNegotiationStrategies.addAll(Arrays.asList(strategies));
for (ContentNegotiationStrategy strategy : this.contentNegotiationStrategies) {
if (strategy instanceof MediaTypeFileExtensionResolver) {
this.fileExtensionResolvers.add((MediaTypeFileExtensionResolver) strategy);
}
}
}
示例9: RequestConfigMapping
import org.springframework.util.Assert; //导入方法依赖的package包/类
public RequestConfigMapping(RequestMatcher matcher, Collection<ConfigAttribute> attributes) {
if (matcher == null) {
throw new IllegalArgumentException("matcher cannot be null");
}
Assert.notEmpty(attributes, "attributes cannot be null or emtpy");
this.matcher = matcher;
this.attributes = attributes;
}
示例10: registerAnnotationClasses
import org.springframework.util.Assert; //导入方法依赖的package包/类
public void registerAnnotationClasses(Class<?>... annotatedClasses) {
Assert.notEmpty(annotatedClasses, "At least one annotated class must be specified");
this.annotatedBeanReader.register(annotatedClasses);
}
示例11: AnnotationCacheOperationSource
import org.springframework.util.Assert; //导入方法依赖的package包/类
/**
* Create a custom AnnotationCacheOperationSource.
* @param annotationParsers the CacheAnnotationParser to use
*/
public AnnotationCacheOperationSource(Set<CacheAnnotationParser> annotationParsers) {
this.publicMethodsOnly = true;
Assert.notEmpty(annotationParsers, "At least one CacheAnnotationParser needs to be specified");
this.annotationParsers = annotationParsers;
}
示例12: PropertyBatchUpdateException
import org.springframework.util.Assert; //导入方法依赖的package包/类
/**
* Create a new PropertyBatchUpdateException.
* @param propertyAccessExceptions the List of PropertyAccessExceptions
*/
public PropertyBatchUpdateException(PropertyAccessException[] propertyAccessExceptions) {
super(null);
Assert.notEmpty(propertyAccessExceptions, "At least 1 PropertyAccessException required");
this.propertyAccessExceptions = propertyAccessExceptions;
}
示例13: CompositeCacheOperationSource
import org.springframework.util.Assert; //导入方法依赖的package包/类
/**
* Create a new CompositeCacheOperationSource for the given sources.
* @param cacheOperationSources the CacheOperationSource instances to combine
*/
public CompositeCacheOperationSource(CacheOperationSource... cacheOperationSources) {
Assert.notEmpty(cacheOperationSources, "cacheOperationSources array must not be empty");
this.cacheOperationSources = cacheOperationSources;
}
示例14: OpPlus
import org.springframework.util.Assert; //导入方法依赖的package包/类
public OpPlus(int pos, SpelNodeImpl... operands) {
super("+", pos, operands);
Assert.notEmpty(operands);
}
示例15: CompositeGraphMetadataDaoImpl
import org.springframework.util.Assert; //导入方法依赖的package包/类
public CompositeGraphMetadataDaoImpl(List<IWayGraphVersionMetadataDao> writeDaos) {
Assert.notEmpty(writeDaos, "no write daos set!");
Assert.isTrue(writeDaos.size() < 2, "at least 2 write daos expected");
this.writeDaos = writeDaos;
log.info("using first write dao (" + writeDaos.get(0).getClass() + ") as primary dao for reads ");
}