public static String convertToFunction ( final String wkt , final String srid , final Database database , final WktInsertOrUpdateGenerator generator ) { if ( wkt == null || wkt . equals ( "" ) ) { throw new IllegalArgumentException ( "The Well-Known Text cannot be null or empty" ) ; } if ( generator == null ) { throw new IllegalArgumentException ( "The generator cannot be null or empty" ) ; } final String geomFromTextFunction = generator . getGeomFromWktFunction ( ) ; String function = geomFromTextFunction + "('" + wkt + "'" ; if ( srid != null && ! srid . equals ( "" ) ) { function += ", " + srid ; } else if ( generator . isSridRequiredInFunction ( database ) ) { throw new IllegalArgumentException ( "An SRID was not provided with '" + wkt + "' but is required in call to '" + geomFromTextFunction + "'" ) ; } function += ")" ; return function ; }
Converts the given Well - Known Text and SRID to the appropriate function call for the database .