本文整理汇总了Java中org.springframework.expression.common.LiteralExpression类的典型用法代码示例。如果您正苦于以下问题:Java LiteralExpression类的具体用法?Java LiteralExpression怎么用?Java LiteralExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LiteralExpression类属于org.springframework.expression.common包,在下文中一共展示了LiteralExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testGetValue
import org.springframework.expression.common.LiteralExpression; //导入依赖的package包/类
@Test
public void testGetValue() throws Exception {
LiteralExpression lEx = new LiteralExpression("somevalue");
checkString("somevalue", lEx.getValue());
checkString("somevalue", lEx.getValue(String.class));
EvaluationContext ctx = new StandardEvaluationContext();
checkString("somevalue", lEx.getValue(ctx));
checkString("somevalue", lEx.getValue(ctx, String.class));
checkString("somevalue", lEx.getValue(new Rooty()));
checkString("somevalue", lEx.getValue(new Rooty(), String.class));
checkString("somevalue", lEx.getValue(ctx, new Rooty()));
checkString("somevalue", lEx.getValue(ctx, new Rooty(),String.class));
assertEquals("somevalue", lEx.getExpressionString());
assertFalse(lEx.isWritable(new StandardEvaluationContext()));
assertFalse(lEx.isWritable(new Rooty()));
assertFalse(lEx.isWritable(new StandardEvaluationContext(), new Rooty()));
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:18,代码来源:LiteralExpressionTests.java
示例2: ProducerConfigurationMessageHandler
import org.springframework.expression.common.LiteralExpression; //导入依赖的package包/类
ProducerConfigurationMessageHandler(KafkaTemplate<byte[], byte[]> kafkaTemplate, String topic,
ExtendedProducerProperties<KafkaProducerProperties> producerProperties,
ProducerFactory<byte[], byte[]> producerFactory) {
super(kafkaTemplate);
setTopicExpression(new LiteralExpression(topic));
setMessageKeyExpression(producerProperties.getExtension().getMessageKeyExpression());
setBeanFactory(KafkaMessageChannelBinder.this.getBeanFactory());
if (producerProperties.isPartitioned()) {
SpelExpressionParser parser = new SpelExpressionParser();
setPartitionIdExpression(parser.parseExpression("headers." + BinderHeaders.PARTITION_HEADER));
}
if (producerProperties.getExtension().isSync()) {
setSync(true);
}
this.producerFactory = producerFactory;
}
开发者ID:spring-cloud,项目名称:spring-cloud-stream-binder-kafka,代码行数:17,代码来源:KafkaMessageChannelBinder.java
示例3: createProducerProperties
import org.springframework.expression.common.LiteralExpression; //导入依赖的package包/类
@Override
protected ExtendedProducerProperties<KinesisProducerProperties> createProducerProperties() {
ExtendedProducerProperties<KinesisProducerProperties> producerProperties = new ExtendedProducerProperties<>(
new KinesisProducerProperties());
producerProperties.setPartitionKeyExpression(new LiteralExpression("1"));
producerProperties.getExtension().setSync(true);
return producerProperties;
}
开发者ID:spring-cloud,项目名称:spring-cloud-stream-binder-aws-kinesis,代码行数:9,代码来源:KinesisBinderTests.java
示例4: testGetValueType
import org.springframework.expression.common.LiteralExpression; //导入依赖的package包/类
@Test
public void testGetValueType() throws Exception {
LiteralExpression lEx = new LiteralExpression("somevalue");
assertEquals(String.class, lEx.getValueType());
assertEquals(String.class, lEx.getValueType(new StandardEvaluationContext()));
assertEquals(String.class, lEx.getValueType(new Rooty()));
assertEquals(String.class, lEx.getValueType(new StandardEvaluationContext(), new Rooty()));
assertEquals(String.class, lEx.getValueTypeDescriptor().getType());
assertEquals(String.class, lEx.getValueTypeDescriptor(new StandardEvaluationContext()).getType());
assertEquals(String.class, lEx.getValueTypeDescriptor(new Rooty()).getType());
assertEquals(String.class, lEx.getValueTypeDescriptor(new StandardEvaluationContext(), new Rooty()).getType());
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:13,代码来源:LiteralExpressionTests.java
示例5: testCustomPartitionCountOverridesDefaultIfLarger
import org.springframework.expression.common.LiteralExpression; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testCustomPartitionCountOverridesDefaultIfLarger() throws Exception {
byte[] testPayload = new byte[2048];
Arrays.fill(testPayload, (byte) 65);
KafkaBinderConfigurationProperties binderConfiguration = createConfigurationProperties();
binderConfiguration.setMinPartitionCount(10);
Binder binder = getBinder(binderConfiguration);
QueueChannel moduleInputChannel = new QueueChannel();
ExtendedProducerProperties<KafkaProducerProperties> producerProperties = createProducerProperties();
producerProperties.setPartitionCount(10);
producerProperties.setPartitionKeyExpression(new LiteralExpression("foo"));
DirectChannel moduleOutputChannel = createBindableChannel("output",
createProducerBindingProperties(producerProperties));
ExtendedConsumerProperties<KafkaConsumerProperties> consumerProperties = createConsumerProperties();
long uniqueBindingId = System.currentTimeMillis();
Binding<MessageChannel> producerBinding = binder.bindProducer("foo" + uniqueBindingId + ".0",
moduleOutputChannel, producerProperties);
Binding<MessageChannel> consumerBinding = binder.bindConsumer("foo" + uniqueBindingId + ".0", null,
moduleInputChannel, consumerProperties);
Message<?> message = org.springframework.integration.support.MessageBuilder.withPayload(testPayload)
.build();
// Let the consumer actually bind to the producer before sending a msg
binderBindUnbindLatency();
moduleOutputChannel.send(message);
Message<?> inbound = receive(moduleInputChannel);
assertThat(inbound).isNotNull();
assertThat((byte[]) inbound.getPayload()).containsExactly(testPayload);
assertThat(partitionSize("foo" + uniqueBindingId + ".0")).isEqualTo(10);
producerBinding.unbind();
consumerBinding.unbind();
}
开发者ID:spring-cloud,项目名称:spring-cloud-stream-binder-kafka,代码行数:36,代码来源:KafkaBinderTests.java
示例6: kafkaHandler
import org.springframework.expression.common.LiteralExpression; //导入依赖的package包/类
@ServiceActivator(inputChannel = "toKafka")
@Bean
public MessageHandler kafkaHandler() throws Exception {
KafkaProducerMessageHandler<String, String> handler =
new KafkaProducerMessageHandler<>(kafkaTemplate());
handler.setTopicExpression(new LiteralExpression(KafkaConfig.getTopic()));
handler.setMessageKeyExpression(new LiteralExpression(KafkaConfig.getMessageKey()));
return handler;
}
开发者ID:jkutner,项目名称:heroku-metrics-spring,代码行数:10,代码来源:HerokuReplayApplication.java
示例7: kafkaMessageHandler
import org.springframework.expression.common.LiteralExpression; //导入依赖的package包/类
@Bean
@ServiceActivator(inputChannel = "producingChannel")
public MessageHandler kafkaMessageHandler() {
KafkaProducerMessageHandler<String, String> handler =
new KafkaProducerMessageHandler<>(kafkaTemplate());
handler.setMessageKeyExpression(new LiteralExpression("kafka-integration"));
return handler;
}
开发者ID:code-not-found,项目名称:spring-kafka,代码行数:10,代码来源:ProducingChannelConfig.java
示例8: mongoSource
import org.springframework.expression.common.LiteralExpression; //导入依赖的package包/类
@Bean
protected MessageSource<Object> mongoSource() {
MongoDbMessageSource ms = new MongoDbMessageSource(mongoTemplate, new LiteralExpression(config.getQuery()));
ms.setCollectionNameExpression(new LiteralExpression(config.getCollection()));
ms.setEntityClass(String.class);
return ms;
}
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-starters,代码行数:8,代码来源:MongodbSourceConfiguration.java
示例9: detectExpression
import org.springframework.expression.common.LiteralExpression; //导入依赖的package包/类
private Expression detectExpression(String collectionName) {
Expression expression = EXPRESSION_PARSER.parseExpression(collectionName, ParserContext.TEMPLATE_EXPRESSION);
return expression instanceof LiteralExpression ? null : expression;
}
开发者ID:krraghavan,项目名称:mongodb-aggregate-query-support,代码行数:5,代码来源:AbstractAggregateQueryProvider.java
示例10: getComputedNameExpression
import org.springframework.expression.common.LiteralExpression; //导入依赖的package包/类
public Expression getComputedNameExpression() {
return (nameExpression != null ? nameExpression : new LiteralExpression(getName()));
}
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-starters,代码行数:4,代码来源:FieldValueCounterSinkProperties.java
示例11: getUrlExpression
import org.springframework.expression.common.LiteralExpression; //导入依赖的package包/类
public Expression getUrlExpression() {
return urlExpression != null ? urlExpression
: new LiteralExpression(this.url);
}
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-starters,代码行数:5,代码来源:HttpclientProcessorProperties.java
示例12: keyExpression
import org.springframework.expression.common.LiteralExpression; //导入依赖的package包/类
public Expression keyExpression() {
return key != null ? new LiteralExpression(key) : keyExpression;
}
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-starters,代码行数:4,代码来源:RedisSinkProperties.java
示例13: queueExpression
import org.springframework.expression.common.LiteralExpression; //导入依赖的package包/类
public Expression queueExpression() {
return queue != null ? new LiteralExpression(queue) : queueExpression;
}
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-starters,代码行数:4,代码来源:RedisSinkProperties.java
示例14: topicExpression
import org.springframework.expression.common.LiteralExpression; //导入依赖的package包/类
public Expression topicExpression() {
return topic != null ? new LiteralExpression(topic) : topicExpression;
}
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-starters,代码行数:4,代码来源:RedisSinkProperties.java
示例15: setQueueName
import org.springframework.expression.common.LiteralExpression; //导入依赖的package包/类
public void setQueueName(String value) {
setQueueNameExpression(new LiteralExpression(value));
}
开发者ID:trevershick,项目名称:ironmq-si,代码行数:4,代码来源:IronMqQueueingMessageHandler.java
注:本文中的org.springframework.expression.common.LiteralExpression类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论