Exemplo n.º 1
0
 public static GridType byName(String type) {
   try {
     return GridType.valueOf(type);
   } catch (IllegalArgumentException e) {
     return GridType.DEFAULT;
   }
 }
  @Override
  public Object parse(String value) throws Exception {
    GridType type = null;
    for (GridType currType : GridType.values()) {
      if (currType.getXmlConstant().equalsIgnoreCase(value)) {
        type = currType;
        break;
      }
    }

    if (type == null)
      throw new WcsException(
          "Could not understand grid type '" + value + "'", InvalidParameterValue, "GridType");

    if (type == GridType.GT2dGridIn3dCrs)
      throw new WcsException(
          "GeoServer does not support type " + type.name(), InvalidParameterValue, "GridType");

    return type.getXmlConstant();
  }