1 16 17 package org.springframework.beans.propertyeditors; 18 19 import java.beans.PropertyEditorSupport ; 20 import java.util.regex.Pattern ; 21 22 34 public class PatternEditor extends PropertyEditorSupport { 35 36 public void setAsText(String text) { 37 setValue(text != null ? Pattern.compile(text) : null); 38 } 39 40 public String getAsText() { 41 Pattern value = (Pattern ) getValue(); 42 return (value != null ? value.pattern() : ""); 43 } 44 45 } 46 | Popular Tags |