Beispiel #1
0
  private ValueScanner<T> findStandardScanner(String scannerClassOrKeyword) throws T2DBException {
    StandardValueType type = null;
    ValueScanner<T> scanner = null;
    try {
      type = StandardValueType.valueOf(scannerClassOrKeyword);
    } catch (IllegalArgumentException e) {
    }

    if (type == null) {
      keyword = null;
      try {
        @SuppressWarnings("unchecked")
        Class<ValueScanner<T>> scannerClass =
            (Class<ValueScanner<T>>) Class.forName(scannerClassOrKeyword);
        try {
          Constructor<ValueScanner<T>> constructor = scannerClass.getConstructor(ValueType.class);
          scanner = constructor.newInstance(this);
        } catch (NoSuchMethodException e) {
          scanner = scannerClass.newInstance();
        }
      } catch (Exception e) {
        throw T2DBMsg.exception(e, D.D10110, name, scannerClassOrKeyword);
      }
    } else scanner = findStandardScanner(type);
    return scanner;
  }
Beispiel #2
0
 @SuppressWarnings("unchecked")
 private ValueScanner<T> findStandardScanner(StandardValueType type) throws T2DBException {
   ValueScanner<T> sc = null;
   switch (type) {
     case BOOLEAN:
       sc = scanner = (ValueScanner<T>) new BooleanScanner();
       break;
     case DATE:
       sc = scanner = (ValueScanner<T>) new DateScanner();
       break;
     case DATETIME:
       sc = scanner = (ValueScanner<T>) new DateTimeScanner();
       break;
     case NAME:
       sc = scanner = (ValueScanner<T>) new NameScanner();
       break;
     case NUMBER:
       sc = scanner = (ValueScanner<T>) new NumberScanner();
       break;
     case TEXT:
       sc = scanner = (ValueScanner<T>) new TextScanner();
       break;
     case TIMEDOMAIN:
       sc = scanner = (ValueScanner<T>) new TimeDomainScanner();
       break;
     case TYPE:
       sc = scanner = (ValueScanner<T>) new TypeScanner(getSurrogate().getDatabase());
       break;
     default:
       throw new RuntimeException(type.name());
   }
   keyword = type;
   return sc;
 }
Beispiel #3
0
 @Override
 public String getExternalRepresentation() {
   if (keyword == null) return scanner.getClass().getName();
   else return keyword.name();
 }