com.github.datalking.common.convert.editor.PatternEditor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of play-mvc Show documentation
Show all versions of play-mvc Show documentation
simple mvc framework based on java servlet.
The newest version!
package com.github.datalking.common.convert.editor;
import java.beans.PropertyEditorSupport;
import java.util.regex.Pattern;
/**
*/
public class PatternEditor extends PropertyEditorSupport {
private final int flags;
public PatternEditor() {
this.flags = 0;
}
public PatternEditor(int flags) {
this.flags = flags;
}
@Override
public void setAsText(String text) {
setValue(text != null ? Pattern.compile(text, this.flags) : null);
}
@Override
public String getAsText() {
Pattern value = (Pattern) getValue();
return (value != null ? value.pattern() : "");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy