at.spardat.enterprise.fmt.ASelectionFmt Maven / Gradle / Ivy
package at.spardat.enterprise.fmt;
/**
* The text is interpreted as number of selected items
*
*/
public class ASelectionFmt extends IFmt{
private static final int MAX_LEN = 10;
public String parse(String external) throws AParseException {
if ("0".equals(external))
throw new FmtParseException ("NotEmpty");
return external;
}
public String format(String internal) {
return internal;
}
public int maxLenOfExternal() {
return MAX_LEN;
}
public boolean isLegalExternalChar(char aChar) {
return '0' <= aChar && aChar <= '9';
}
public boolean isLegalInternal(String internal) {
try {
Integer.parseInt(internal);
return true;
}catch(NumberFormatException e) {
return false;
}
}
public boolean isOneWay() {
return false;
}
public boolean mayBeAppliedTo(byte type) {
return false;
}
}