Ejemplo n.º 1
0
 public static void failIfNotRasterDataSource(
     final CustomQuery customQuery, final Metadata metadata, final int argNumber)
     throws SemanticException, DriverException {
   if (!MetadataUtilities.isRaster(metadata)) {
     throw new SemanticException(
         customQuery.getName() + " requires a raster table as argument number " + argNumber);
   }
 }
Ejemplo n.º 2
0
  public static void failIfFieldIsNotOfType(
      final CustomQuery customQuery,
      final String fieldName,
      final int fieldIndex,
      final int typeCodeOfField,
      final Metadata metadata)
      throws DriverException, SemanticException {
    failIfFieldDoesNotExist(customQuery, fieldName, fieldIndex, metadata);

    final Type[] fieldTypes = MetadataUtilities.getFieldTypes(metadata);
    if (typeCodeOfField != fieldTypes[fieldIndex].getTypeCode()) {
      throw new IncompatibleTypesException(
          customQuery.getName()
              + ": "
              + fieldName
              + " is not of type "
              + TypeFactory.getTypeName(typeCodeOfField));
    }
  }