public static enum SubjectType {
//case Insensitive pattern ?i:
MICRO_CENTRIFUGE("(?i:MIX)","max"),
FATHER("(?i:F[C2BV])", "F");
final String _suffix;
final String _lowercase;
//this contractor execute two times.
SubjectType(String suffix,String lowercase) {
_suffix = suffix;
_lowercase=lowercase;
}
//suffix : any String .."fc"
public static SubjectType parse(String suffix) {
for (SubjectType s : values()) {
//know matches()works as case Insensitive..for 'fc' also it return true.
if (suffix.matches(s._suffix)) return s;
}
return null;
}
}
No comments:
Post a Comment