code: private Number setFeatureField( SimpleFeature pipe, String key ) {
          Number field = ((Number) pipe.getAttribute(key));
          if (field == null) {
              pm.errorMessage(msg.message("trentoP.error.number") + key);
              throw new IllegalArgumentException(msg.message("trentoP.error.number") + key);
          }
  
          // return the Number
          return field;
      }
docs: Check if there is the field in a SimpleFeature and if it's a Number.
  
  @param pipe
  the feature.
  @param key
  the key string of the field.
  @return the Number associated at this key.