@InitBinder
public void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(
Long.class,
new CustomNumberEditor(Long.class, true));
binder.registerCustomEditor(
Double.class,
new CustomNumberEditor(Double.class, true));
binder.registerCustomEditor(
BigDecimal.class,
new CustomNumberEditor(
BigDecimal.class,
new DecimalFormat("#,##0.00"),
true));
binder.registerCustomEditor(
Boolean.class,
new CustomBooleanEditor(true));
binder.registerCustomEditor(
Date.class,
new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
binder.registerCustomEditor(
Object.class,
new ObjectTypeEditorHelper());
}
java类org.springframework.web.bind.annotation.InitBinder的实例源码
TascaTramitacioController.java 文件源码
项目:helium
阅读 39
收藏 0
点赞 0
评论 0
FormController.java 文件源码
项目:Spring-5.0-Cookbook
阅读 42
收藏 0
点赞 0
评论 0
@InitBinder("employeeForm")
public void initBinder(WebDataBinder binder){
binder.setValidator(employeeValidator);
binder.registerCustomEditor(Date.class, new DateEditor());
binder.registerCustomEditor(Integer.class, "age", new AgeEditor());
}
FormController.java 文件源码
项目:Spring-5.0-Cookbook
阅读 39
收藏 0
点赞 0
评论 0
@InitBinder("employeeForm")
public void initBinder(WebDataBinder binder){
binder.setValidator(employeeValidator);
binder.registerCustomEditor(Date.class, new DateEditor());
binder.registerCustomEditor(Integer.class, "age", new AgeEditor());
}
ExpedientTokenV3Controller.java 文件源码
项目:helium
阅读 38
收藏 0
点赞 0
评论 0
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(
Long.class,
new CustomNumberEditor(Long.class, true));
binder.registerCustomEditor(
Double.class,
new CustomNumberEditor(Double.class, true));
binder.registerCustomEditor(
BigDecimal.class,
new CustomNumberEditor(
BigDecimal.class,
new DecimalFormat("#,##0.00"),
true));
binder.registerCustomEditor(
Boolean.class,
new CustomBooleanEditor(true));
binder.registerCustomEditor(
Date.class,
new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
binder.registerCustomEditor(
Object.class,
new ObjectTypeEditorHelper());
}
ExpedientConsultaLlistatController.java 文件源码
项目:helium
阅读 39
收藏 0
点赞 0
评论 0
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.setAutoGrowNestedPaths(false);
binder.registerCustomEditor(
Long.class,
new CustomNumberEditor(Long.class, true));
binder.registerCustomEditor(
Double.class,
new CustomNumberEditor(Double.class, true));
binder.registerCustomEditor(
BigDecimal.class,
new CustomNumberEditor(
BigDecimal.class,
new DecimalFormat("#,##0.00"),
true));
binder.registerCustomEditor(
Boolean.class,
new CustomBooleanEditor(true));
binder.registerCustomEditor(
Date.class,
new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
binder.registerCustomEditor(
Object.class,
new ObjectTypeEditorHelper());
}
ExpedientMassivaController.java 文件源码
项目:helium
阅读 76
收藏 0
点赞 0
评论 0
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(
byte[].class,
new ByteArrayMultipartFileEditor());
binder.registerCustomEditor(
Date.class,
new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
binder.registerCustomEditor(
Long.class,
new CustomNumberEditor(Long.class, true));
binder.registerCustomEditor(
Double.class,
new CustomNumberEditor(Double.class, true));
binder.registerCustomEditor(
BigDecimal.class,
new CustomNumberEditor(
BigDecimal.class,
new DecimalFormat("#,##0.00"),
true));
binder.registerCustomEditor(
Boolean.class,
new CustomBooleanEditor(false));
}
ExpedientIniciarPasFormController.java 文件源码
项目:helium
阅读 44
收藏 0
点赞 0
评论 0
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(
Long.class,
new CustomNumberEditor(Long.class, true));
binder.registerCustomEditor(
Double.class,
new CustomNumberEditor(Double.class, true));
binder.registerCustomEditor(
BigDecimal.class,
new CustomNumberEditor(
BigDecimal.class,
new DecimalFormat("#,##0.00"),
true));
binder.registerCustomEditor(
Boolean.class,
new CustomBooleanEditor(false));
binder.registerCustomEditor(
Date.class,
new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
}
ExpedientConsultaDissenyController.java 文件源码
项目:helium
阅读 42
收藏 0
点赞 0
评论 0
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.setAutoGrowNestedPaths(false);
binder.registerCustomEditor(
Long.class,
new CustomNumberEditor(Long.class, true));
binder.registerCustomEditor(
Double.class,
new CustomNumberEditor(Double.class, true));
binder.registerCustomEditor(
BigDecimal.class,
new CustomNumberEditor(
BigDecimal.class,
new DecimalFormat("#,##0.00"),
true));
binder.registerCustomEditor(
Boolean.class,
new CustomBooleanEditor(true));
binder.registerCustomEditor(
Date.class,
new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
binder.registerCustomEditor(
Object.class,
new ObjectTypeEditorHelper());
}
CommonRegistreController.java 文件源码
项目:helium
阅读 36
收藏 0
点赞 0
评论 0
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(
Long.class,
new CustomNumberEditor(Long.class, true));
binder.registerCustomEditor(
Double.class,
new CustomNumberEditor(Double.class, true));
binder.registerCustomEditor(
BigDecimal.class,
new CustomNumberEditor(
BigDecimal.class,
new DecimalFormat("#,##0.00"),
true));
binder.registerCustomEditor(
Boolean.class,
new CustomBooleanEditor(false));
binder.registerCustomEditor(
Date.class,
new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
}
ExpedientDadaModificarController.java 文件源码
项目:helium
阅读 44
收藏 0
点赞 0
评论 0
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(
Long.class,
new CustomNumberEditor(Long.class, true));
binder.registerCustomEditor(
Double.class,
new CustomNumberEditor(Double.class, true));
binder.registerCustomEditor(
BigDecimal.class,
new CustomNumberEditor(
BigDecimal.class,
new DecimalFormat("#,##0.00"),
true));
binder.registerCustomEditor(
Boolean.class,
new CustomBooleanEditor(false));
binder.registerCustomEditor(
Date.class,
new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
}
GlobalControllerAdvice.java 文件源码
项目:spring-boot
阅读 44
收藏 0
点赞 0
评论 0
/***
* @param binder
* @InitBinder 用来配置全局 Controller ,设置 WebDataBinder,WebDataBinder 用来自动绑定前台请求参数到 Model 中。
*/
@InitBinder
public void initBinder(WebDataBinder binder) {
//忽略 request 中的参数 dis ,更多关于 WebDataBinder ,可参考文档。
//binder.setDisallowedFields("dis");
// binder.registerCustomEditor(LocalDate.class, new PropertyEditorSupport() {
// @Override
// public void setAsText(String text) throws IllegalArgumentException {
// LocalDate.parse(text, DateTimeFormatter.ISO_DATE);
// }
// }); //自动绑定 LocalDate
//
// @GetMapping
// public ResponseEntity<List<Order>> getOrdersByDate(
// @RequestParam(name = "date")LocalDate date) {
// // retrieve and return orders by date
// }
}
SignatureMultipleDocumentsController.java 文件源码
项目:dss-demonstrations
阅读 28
收藏 0
点赞 0
评论 0
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(SignatureForm.class, new EnumPropertyEditor(SignatureForm.class));
binder.registerCustomEditor(ASiCContainerType.class, new EnumPropertyEditor(ASiCContainerType.class));
binder.registerCustomEditor(SignatureLevel.class, new EnumPropertyEditor(SignatureLevel.class));
binder.registerCustomEditor(DigestAlgorithm.class, new EnumPropertyEditor(DigestAlgorithm.class));
binder.registerCustomEditor(EncryptionAlgorithm.class, new EnumPropertyEditor(EncryptionAlgorithm.class));
}
SignatureController.java 文件源码
项目:dss-demonstrations
阅读 36
收藏 0
点赞 0
评论 0
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(SignatureForm.class, new EnumPropertyEditor(SignatureForm.class));
binder.registerCustomEditor(ASiCContainerType.class, new EnumPropertyEditor(ASiCContainerType.class));
binder.registerCustomEditor(SignaturePackaging.class, new EnumPropertyEditor(SignaturePackaging.class));
binder.registerCustomEditor(SignatureLevel.class, new EnumPropertyEditor(SignatureLevel.class));
binder.registerCustomEditor(DigestAlgorithm.class, new EnumPropertyEditor(DigestAlgorithm.class));
binder.registerCustomEditor(EncryptionAlgorithm.class, new EnumPropertyEditor(EncryptionAlgorithm.class));
}
ExtensionController.java 文件源码
项目:dss-demonstrations
阅读 39
收藏 0
点赞 0
评论 0
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(ASiCContainerType.class, new EnumPropertyEditor(ASiCContainerType.class));
binder.registerCustomEditor(SignatureForm.class, new EnumPropertyEditor(SignatureForm.class));
binder.registerCustomEditor(SignaturePackaging.class, new EnumPropertyEditor(SignaturePackaging.class));
binder.registerCustomEditor(SignatureLevel.class, new EnumPropertyEditor(SignatureLevel.class));
}
AdministrationInformationController.java 文件源码
项目:profile-manager
阅读 46
收藏 0
点赞 0
评论 0
@InitBinder
protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
binder.registerCustomEditor(Category.class, "categorySet", new PropertyEditorSupport() {
@Override
public void setAsText(String text) {
Category category = categoryService.findByPK(Long.parseLong(text));
setValue(category);
}
});
}
AdministrationUserController.java 文件源码
项目:profile-manager
阅读 35
收藏 0
点赞 0
评论 0
@InitBinder
protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
binder.registerCustomEditor(Role.class, "roles", new PropertyEditorSupport() {
@Override
public void setAsText(String text) {
Role role = roleService.findByPK(Long.parseLong(text));
setValue(role);
}
});
}
HandlerMethodInvoker.java 文件源码
项目:lams
阅读 44
收藏 0
点赞 0
评论 0
protected void initBinder(Object handler, String attrName, WebDataBinder binder, NativeWebRequest webRequest)
throws Exception {
if (this.bindingInitializer != null) {
this.bindingInitializer.initBinder(binder, webRequest);
}
if (handler != null) {
Set<Method> initBinderMethods = this.methodResolver.getInitBinderMethods();
if (!initBinderMethods.isEmpty()) {
boolean debug = logger.isDebugEnabled();
for (Method initBinderMethod : initBinderMethods) {
Method methodToInvoke = BridgeMethodResolver.findBridgedMethod(initBinderMethod);
String[] targetNames = AnnotationUtils.findAnnotation(initBinderMethod, InitBinder.class).value();
if (targetNames.length == 0 || Arrays.asList(targetNames).contains(attrName)) {
Object[] initBinderArgs =
resolveInitBinderArguments(handler, methodToInvoke, binder, webRequest);
if (debug) {
logger.debug("Invoking init-binder method: " + methodToInvoke);
}
ReflectionUtils.makeAccessible(methodToInvoke);
Object returnValue = methodToInvoke.invoke(handler, initBinderArgs);
if (returnValue != null) {
throw new IllegalStateException(
"InitBinder methods must not have a return value: " + methodToInvoke);
}
}
}
}
}
}
AdministrationUserController.java 文件源码
项目:spring-grow
阅读 42
收藏 0
点赞 0
评论 0
@InitBinder
protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) {
binder.registerCustomEditor(Role.class, "roles", new PropertyEditorSupport() {
@Override
public void setAsText(String text) {
Role role = roleService.findByPK(Long.parseLong(text));
setValue(role);
}
});
}
BaseController.java 文件源码
项目:xmanager
阅读 33
收藏 0
点赞 0
评论 0
@InitBinder
public void initBinder(ServletRequestDataBinder binder) {
/**
* 自动转换日期类型的字段格式
*/
binder.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"), true));
/**
* 防止XSS攻击
*/
binder.registerCustomEditor(String.class, new StringEscapeEditor());
}
BaseController.java 文件源码
项目:xmanager
阅读 43
收藏 0
点赞 0
评论 0
@InitBinder
public void initBinder(ServletRequestDataBinder binder) {
/**
* 自动转换日期类型的字段格式
*/
binder.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"), true));
/**
* 防止XSS攻击
*/
binder.registerCustomEditor(String.class, new StringEscapeEditor());
}
TodoController.java 文件源码
项目:https-github.com-in28minutes-SpringIn28Minutes
阅读 41
收藏 0
点赞 0
评论 0
@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat(
TodoListUtils.DATE_FORMAT);
binder.registerCustomEditor(Date.class, new CustomDateEditor(
dateFormat, false));
binder.registerCustomEditor(Priority.class,
new TodoPriorityPropertyEditor());
}
ExpedientTerminiV3Controller.java 文件源码
项目:helium
阅读 38
收藏 0
点赞 0
评论 0
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(
byte[].class,
new ByteArrayMultipartFileEditor());
binder.registerCustomEditor(
Date.class,
new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
binder.registerCustomEditor(
Long.class,
new CustomNumberEditor(Long.class, true));
binder.registerCustomEditor(
Double.class,
new CustomNumberEditor(Double.class, true));
binder.registerCustomEditor(
BigDecimal.class,
new CustomNumberEditor(
BigDecimal.class,
new DecimalFormat("#,##0.00"),
true));
binder.registerCustomEditor(
Boolean.class,
new CustomBooleanEditor(false));
binder.registerCustomEditor(
Object.class,
new ObjectTypeEditorHelper());
}
StringTrimmerAdvice.java 文件源码
项目:springlets
阅读 31
收藏 0
点赞 0
评论 0
/**
* Registers the {@link StringTrimmerEditor}
*
* @param webDataBinder
*/
@InitBinder
public void initBinder(WebDataBinder webDataBinder) {
StringTrimmerEditor trimmer =
new StringTrimmerEditor(this.getCharsToDelete(), this.isEmptyAsNull());
webDataBinder.registerCustomEditor(String.class, trimmer);
}
MassivaExpedientController.java 文件源码
项目:helium
阅读 43
收藏 0
点赞 0
评论 0
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(
byte[].class,
new ByteArrayMultipartFileEditor());
binder.registerCustomEditor(
Date.class,
new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
binder.registerCustomEditor(
Long.class,
new CustomNumberEditor(Long.class, true));
binder.registerCustomEditor(
Double.class,
new CustomNumberEditor(Double.class, true));
binder.registerCustomEditor(
BigDecimal.class,
new CustomNumberEditor(
BigDecimal.class,
new DecimalFormat("#,##0.00"),
true));
binder.registerCustomEditor(
Boolean.class,
new CustomBooleanEditor(false));
binder.registerCustomEditor(
Object.class,
new ObjectTypeEditorHelper());
}
ExpedientTipusController.java 文件源码
项目:helium
阅读 38
收藏 0
点赞 0
评论 0
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
TascaLlistatV3Controller.java 文件源码
项目:helium
阅读 36
收藏 0
点赞 0
评论 0
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
binder.registerCustomEditor(
Object.class,
new ObjectTypeEditorHelper());
}
BaseController.java 文件源码
项目:ams
阅读 38
收藏 0
点赞 0
评论 0
@InitBinder
public void initBinder(WebDataBinder binder, WebRequest request) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
dateFormat.setLenient(false);
binder.registerCustomEditor(java.util.Date.class, new CustomDateEditor(
dateFormat, true));
}
ExpedientLlistatController.java 文件源码
项目:helium
阅读 35
收藏 0
点赞 0
评论 0
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
PerfilController.java 文件源码
项目:helium
阅读 41
收藏 0
点赞 0
评论 0
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(
boolean.class,
new CustomBooleanEditor(false));
binder.registerCustomEditor(
Date.class,
new CustomDateEditor(new SimpleDateFormat("dd/MM/yyyy"), true));
}
ServletAnnotationControllerHandlerMethodTests.java 文件源码
项目:spring4-understanding
阅读 45
收藏 0
点赞 0
评论 0
@SuppressWarnings("unused")
@InitBinder({"myCommand", "date"})
private void initBinder(WebDataBinder binder, String date, @RequestParam("date") String[] date2) {
LocalValidatorFactoryBean vf = new LocalValidatorFactoryBean();
vf.afterPropertiesSet();
binder.setValidator(vf);
assertEquals("2007-10-02", date);
assertEquals(1, date2.length);
assertEquals("2007-10-02", date2[0]);
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
}