本文整理汇总了Java中org.springframework.binding.convert.ConversionExecutor类的典型用法代码示例。如果您正苦于以下问题:Java ConversionExecutor类的具体用法?Java ConversionExecutor怎么用?Java ConversionExecutor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConversionExecutor类属于org.springframework.binding.convert包,在下文中一共展示了ConversionExecutor类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createMappingToSubflowState
import org.springframework.binding.convert.ConversionExecutor; //导入依赖的package包/类
/**
* Create mapping to subflow state.
*
* @param name the name
* @param value the value
* @param required the required
* @param type the type
* @return the default mapping
*/
protected DefaultMapping createMappingToSubflowState(final String name, final String value,
final boolean required, final Class type) {
final ExpressionParser parser = this.flowBuilderServices.getExpressionParser();
final Expression source = parser.parseExpression(value, new FluentParserContext());
final Expression target = parser.parseExpression(name, new FluentParserContext());
final DefaultMapping mapping = new DefaultMapping(source, target);
mapping.setRequired(required);
final ConversionExecutor typeConverter =
new RuntimeBindingConversionExecutor(type, this.flowBuilderServices.getConversionService());
mapping.setTypeConverter(typeConverter);
return mapping;
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:26,代码来源:AbstractCasWebflowConfigurer.java
示例2: createMappingToSubflowState
import org.springframework.binding.convert.ConversionExecutor; //导入依赖的package包/类
/**
* Create mapping to subflow state.
*
* @param name the name
* @param value the value
* @param required the required
* @param type the type
* @return the default mapping
*/
protected DefaultMapping createMappingToSubflowState(final String name, final String value,
final boolean required, final Class type) {
final ExpressionParser parser = this.flowBuilderServices.getExpressionParser();
final Expression source = parser.parseExpression(value, new FluentParserContext());
final Expression target = parser.parseExpression(name, new FluentParserContext());
final DefaultMapping mapping = new DefaultMapping(source, target);
mapping.setRequired(required);
final ConversionExecutor typeConverter =
new RuntimeBindingConversionExecutor(type, this.flowBuilderServices.getConversionService());
mapping.setTypeConverter(typeConverter);
return mapping;
}
开发者ID:Unicon,项目名称:cas-mfa,代码行数:26,代码来源:CasMultiFactorWebflowConfigurer.java
示例3: createMappingToSubflowState
import org.springframework.binding.convert.ConversionExecutor; //导入依赖的package包/类
/**
* Create mapping to subflow state.
*
* @param name the name
* @param value the value
* @param required the required
* @param type the type
* @return the default mapping
*/
protected DefaultMapping createMappingToSubflowState(final String name, final String value, final boolean required, final Class type) {
final ExpressionParser parser = this.flowBuilderServices.getExpressionParser();
final Expression source = parser.parseExpression(value, new FluentParserContext());
final Expression target = parser.parseExpression(name, new FluentParserContext());
final DefaultMapping mapping = new DefaultMapping(source, target);
mapping.setRequired(required);
final ConversionExecutor typeConverter =
new RuntimeBindingConversionExecutor(type, this.flowBuilderServices.getConversionService());
mapping.setTypeConverter(typeConverter);
return mapping;
}
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:24,代码来源:AbstractCasWebflowConfigurer.java
示例4: testConvertingValueModels
import org.springframework.binding.convert.ConversionExecutor; //导入依赖的package包/类
public void testConvertingValueModels() {
AbstractFormModel fm = getFormModel(new TestBean());
TestConversionService cs = new TestConversionService();
fm.setConversionService(cs);
ValueModel vm = fm.getValueModel("simpleProperty", String.class);
assertEquals(fm.getValueModel("simpleProperty"), vm);
assertEquals(0, cs.calls);
try {
fm.getValueModel("simpleProperty", Integer.class);
fail("should have throw IllegalArgumentException");
}
catch (IllegalArgumentException e) {
// expected
}
assertEquals(1, cs.calls);
assertEquals(String.class, cs.lastSource);
assertEquals(Integer.class, cs.lastTarget);
cs.executer = new ConversionExecutor(String.class, Integer.class, new CopiedPublicNoOpConverter(String.class,
Integer.class));
ValueModel cvm = fm.getValueModel("simpleProperty", Integer.class);
assertEquals(3, cs.calls);
assertEquals(Integer.class, cs.lastSource);
assertEquals(String.class, cs.lastTarget);
assertEquals(fm.getValueModel("simpleProperty", Integer.class), cvm);
assertEquals(3, cs.calls);
}
开发者ID:shevek,项目名称:spring-rich-client,代码行数:31,代码来源:AbstractFormModelTests.java
示例5: getConversionExecutor
import org.springframework.binding.convert.ConversionExecutor; //导入依赖的package包/类
public ConversionExecutor getConversionExecutor(Class source, Class target) {
calls++;
lastSource = source;
lastTarget = target;
if (executer != null) {
return executer;
}
throw new IllegalArgumentException("no converter found");
}
开发者ID:shevek,项目名称:spring-rich-client,代码行数:10,代码来源:AbstractFormModelTests.java
示例6: testPropertyChangeCausesValidation
import org.springframework.binding.convert.ConversionExecutor; //导入依赖的package包/类
public void testPropertyChangeCausesValidation() {
DefaultFormModel fm = (DefaultFormModel) getFormModel(new TestBean());
TestValidator v = new TestValidator();
fm.setValidator(v);
TestConversionService cs = new TestConversionService();
cs.executer = new ConversionExecutor(String.class, String.class, new CopiedPublicNoOpConverter(String.class, String.class));
fm.setConversionService(cs);
ValueModel vm = fm.getValueModel("simpleProperty");
// starting at 2: constructing a formmodel + creating valueModel
int expectedCount = 2;
assertEquals(expectedCount++, v.count);
vm.setValue("1");
assertEquals(expectedCount, v.count);
// no change in value, no validation triggered.
vm.setValue("1");
assertEquals(expectedCount++, v.count);
vm.setValue(null);
assertEquals(expectedCount++, v.count);
vm = fm.getValueModel("simpleProperty", Integer.class);
vm.setValue("1");
assertEquals(expectedCount++, v.count);
vm.setValue("2");
assertEquals(expectedCount++, v.count);
}
开发者ID:shevek,项目名称:spring-rich-client,代码行数:30,代码来源:DefaultFormModelTests.java
示例7: testTypeConversionThrowsExceptionRaisesValidationMessage
import org.springframework.binding.convert.ConversionExecutor; //导入依赖的package包/类
public void testTypeConversionThrowsExceptionRaisesValidationMessage() {
DefaultFormModel fm = (DefaultFormModel) getFormModel(new TestBean());
TestConversionService cs = new TestConversionService();
cs.executer = new ConversionExecutor(String.class, Integer.class, new ExceptionConverter(String.class,
Integer.class));
fm.setConversionService(cs);
final ValueModel vm = fm.getValueModel("simpleProperty", Integer.class);
vm.setValue("test");
assertEquals(1, fm.getValidationResults().getMessageCount());
}
开发者ID:shevek,项目名称:spring-rich-client,代码行数:12,代码来源:DefaultFormModelTests.java
示例8: getPropertyConversionExecutor
import org.springframework.binding.convert.ConversionExecutor; //导入依赖的package包/类
/**
* Returns a conversion executor which converts a value of the given
* sourceType into the fieldType
*
* @see #getPropertyType()
*/
protected ConversionExecutor getPropertyConversionExecutor() {
if (conversionExecutor == null) {
conversionExecutor = getConversionService().getConversionExecutor(
Object[].class, getPropertyType());
}
return conversionExecutor;
}
开发者ID:shevek,项目名称:spring-rich-client,代码行数:14,代码来源:CheckBoxListSelectableBinding.java
示例9: createConvertingValueModel
import org.springframework.binding.convert.ConversionExecutor; //导入依赖的package包/类
protected ValueModel createConvertingValueModel(String formProperty, Class targetClass) {
if (logger.isDebugEnabled()) {
logger.debug("Creating converting value model for form property '" + formProperty
+ "' converting to type '" + targetClass + "'.");
}
final ValueModel sourceValueModel = getValueModel(formProperty);
Assert.notNull(sourceValueModel, "Form does not have a property called '" + formProperty + "'.");
final Class sourceClass = ClassUtils
.convertPrimitiveToWrapper(getFieldMetadata(formProperty).getPropertyType());
// sourceClass can be null when using eg Map, assume that given
// targetClass is the correct one
if ((sourceClass == null) || (sourceClass == targetClass)) {
return sourceValueModel;
}
final ConversionService conversionService = getConversionService();
ConversionExecutor convertTo = null;
ConversionExecutor convertFrom = null;
// Check for locally registered property converters
if (propertyConversionServices.containsKey(formProperty)) {
// TODO - extract ConfigurableConversionService interface...
final GenericConversionService propertyConversionService = (GenericConversionService) propertyConversionServices
.get(formProperty);
if (propertyConversionService != null) {
convertTo = propertyConversionService.getConversionExecutor(sourceClass, targetClass);
convertFrom = propertyConversionService.getConversionExecutor(targetClass, sourceClass);
}
}
// If we have nothing from the property level, then try the conversion
// service
if (convertTo == null) {
convertTo = conversionService.getConversionExecutor(sourceClass, targetClass);
}
Assert.notNull(convertTo, "conversionService returned null ConversionExecutor");
if (convertFrom == null) {
convertFrom = conversionService.getConversionExecutor(targetClass, sourceClass);
}
Assert.notNull(convertFrom, "conversionService returned null ConversionExecutor");
ValueModel convertingValueModel = preProcessNewConvertingValueModel(formProperty, targetClass,
new TypeConverter(sourceValueModel, convertTo, convertFrom));
preProcessNewConvertingValueModel(formProperty, targetClass, convertingValueModel);
return convertingValueModel;
}
开发者ID:shevek,项目名称:spring-rich-client,代码行数:49,代码来源:AbstractFormModel.java
示例10: ConversionExecutorClosure
import org.springframework.binding.convert.ConversionExecutor; //导入依赖的package包/类
public ConversionExecutorClosure(ConversionExecutor conversionExecutor) {
this.conversionExecutor = conversionExecutor;
}
开发者ID:shevek,项目名称:spring-rich-client,代码行数:4,代码来源:TypeConverter.java
示例11: getConversionExecutorByTargetAlias
import org.springframework.binding.convert.ConversionExecutor; //导入依赖的package包/类
public ConversionExecutor getConversionExecutorByTargetAlias(Class arg0, String arg1)
throws IllegalArgumentException {
fail("this method should never be called");
return null;
}
开发者ID:shevek,项目名称:spring-rich-client,代码行数:6,代码来源:AbstractFormModelTests.java
示例12: getConversionExecutorsForSource
import org.springframework.binding.convert.ConversionExecutor; //导入依赖的package包/类
public ConversionExecutor[] getConversionExecutorsForSource(Class sourceClass) throws ConversionException {
fail("this method should never be called");
return null;
}
开发者ID:shevek,项目名称:spring-rich-client,代码行数:5,代码来源:AbstractFormModelTests.java
示例13: getPropertyConversionExecutor
import org.springframework.binding.convert.ConversionExecutor; //导入依赖的package包/类
/**
* Returns a conversion executor which converts a value of the given sourceType into the fieldType
*
* @param sourceType
* the sourceType
* @return true if a converter is available, otherwise false
*
* @see #getPropertyType()
*/
protected ConversionExecutor getPropertyConversionExecutor() {
if (conversionExecutor == null) {
conversionExecutor = getConversionService().getConversionExecutor(Object[].class, getPropertyType());
}
return conversionExecutor;
}
开发者ID:shevek,项目名称:spring-rich-client,代码行数:16,代码来源:ListBinding.java
示例14: fromStringTo
import org.springframework.binding.convert.ConversionExecutor; //导入依赖的package包/类
/**
* From string to class type, based on the flow conversion service.
*
* @param targetType the target type
* @return the conversion executor
*/
protected ConversionExecutor fromStringTo(final Class targetType) {
return this.flowBuilderServices.getConversionService().getConversionExecutor(String.class, targetType);
}
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:10,代码来源:AbstractCasWebflowConfigurer.java
示例15: TypeConverter
import org.springframework.binding.convert.ConversionExecutor; //导入依赖的package包/类
/**
* Convenience constructor using conversionExecutors.
*
* @param wrappedModel the inner valueModel
* @param convertTo conversion to use when setting a value.
* @param convertFrom conversion to use when getting a value.
*
* @see #TypeConverter(ValueModel, Closure, Closure)
*/
public TypeConverter(ValueModel wrappedModel, ConversionExecutor convertTo, ConversionExecutor convertFrom) {
this(wrappedModel, new ConversionExecutorClosure(convertTo), new ConversionExecutorClosure(convertFrom));
}
开发者ID:shevek,项目名称:spring-rich-client,代码行数:13,代码来源:TypeConverter.java
示例16: fromStringTo
import org.springframework.binding.convert.ConversionExecutor; //导入依赖的package包/类
/**
* From string to class type, based on the flow conversion service.
*
* @param targetType the target type
* @return the conversion executor
*/
private ConversionExecutor fromStringTo(final Class targetType) {
return this.flowBuilderServices.getConversionService().getConversionExecutor(String.class, targetType);
}
开发者ID:Unicon,项目名称:cas-mfa,代码行数:10,代码来源:CasMultiFactorWebflowConfigurer.java
注:本文中的org.springframework.binding.convert.ConversionExecutor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论