/** * Splits a string on all occurrences of delimiter and returns a list with all parts. Each part will be trimmed from * whitespace. See {@link StringUtils#split(String, String, int)} for further options. If you need regular * expressions, use {@link String#split(String)}. * * @param string * the string to split * @param delimiter * @return a list with all parts */ public static String[] split( String string, String delimiter ) { return split( string, delimiter, 0 ); }
public static String[] splitList( String param ) { return StringUtils.split( param, "," ); }
private static List<String> splitNullSafe( String csv ) { if ( csv == null ) { return emptyList(); } String[] tokens = StringUtils.split( csv, "," ); return asList( tokens ); }
private void initQueryCRS( List<String> queryCRSLists ) { // try { for ( String queryCRS : queryCRSLists ) { String[] querySrs = StringUtils.split( queryCRS, " ", REMOVE_EMPTY_FIELDS | REMOVE_DOUBLE_FIELDS ); for ( String srs : querySrs ) { LOG.debug( "Query CRS: " + srs ); ICRS crs = CRSManager.getCRSRef( srs ); this.queryCRS.add( crs ); } } // } catch ( UnknownCRSException e ) { // String msg = "Invalid QuerySRS parameter: " + e.getMessage(); // throw new ControllerInitException( msg ); // } if ( queryCRS.isEmpty() ) { LOG.info( "No query CRS defined, defaulting to EPSG:4326." ); queryCRS.add( CRSUtils.EPSG_4326 ); } defaultQueryCRS = this.queryCRS.get( 0 ); }
IdAnalysis( FeatureType ft, String idRemainder, FIDMapping fidMapping ) throws IllegalArgumentException { this.ft = ft; if ( fidMapping.getColumns().size() == 1 ) { idKernels = new String[] { idRemainder }; } else { idKernels = StringUtils.split( idRemainder, fidMapping.getDelimiter() ); } }
private List<QName> parseFeatureTypes( OMElement el ) { String returnFtsStr = getRequiredNodeAsString( el, new XPath( "@returnFeatureTypes", nsContext ) ).trim(); if ( "".equals( returnFtsStr ) ) return new ArrayList<QName>(); String[] tokens = StringUtils.split( returnFtsStr, " " ); if ( tokens.length == 1 && "${deegreewfs:ServedFeatureTypes}".equals( tokens[0] ) ) return new ArrayList<QName>(); List<QName> returnFtNames = new ArrayList<QName>( tokens.length ); for ( String token : tokens ) { returnFtNames.add( parseQName( token, el ) ); } return returnFtNames; } }
/** * Returns {@link AliasedRIMType}s for the given qualified name. * * @param name * qualified name of a {@link RIMType} with optional aliases, separated by underscores * @return aliased registry object types, never <code>null</code> and contains at least a single entry * @throws IllegalArgumentException * if the input name does not refer to a known {@link RIMType} */ public static List<AliasedRIMType> valueOf( QName name ) throws IllegalArgumentException { List<AliasedRIMType> values = null; String[] tokens = split( name.getLocalPart(), "_" ); if ( tokens.length > 1 ) { String unaliasedName = tokens [0]; values = new ArrayList<AliasedRIMType>( tokens.length - 1 ); for ( int i = 1; i < tokens.length; i++ ) { String alias = tokens[i]; values.add( new AliasedRIMType( unaliasedName, alias ) ); } } else { String unaliasedName = name.getLocalPart(); values = Collections.singletonList( new AliasedRIMType( unaliasedName, unaliasedName ) ); } return values; }
res.fontFamily.addAll( asList( StringUtils.split( family, "," ) ) );
private final Envelope decodePropValue( String s ) { if ( s == null || s.isEmpty() ) { return null; } String[] parts = StringUtils.split( s, "," ); String srsName = parts[0]; CRSRef crs; try { crs = CRSManager.getCRSRef( srsName ); crs.getReferencedObject(); } catch ( ReferenceResolvingException e ) { throw new IllegalArgumentException( e.getMessage() ); } double[] coords = new double[parts.length - 1]; for ( int i = 0; i < parts.length - 1; i++ ) { coords[i] = Double.parseDouble( parts[i + 1].trim() ); } if ( coords.length % 2 != 0 ) { throw new IllegalArgumentException(); } double[] min = new double[coords.length / 2]; double[] max = new double[coords.length / 2]; for ( int i = 0, dim = coords.length / 2; i < dim; i++ ) { min[i] = coords[i]; max[i] = coords[i + dim]; } return new GeometryFactory().createEnvelope( min, max, crs ); }
/** * Parses a normalized KVP-map as a WFS {@link DescribeStoredQueries} request. * * @param kvpParams * normalized KVP-map; keys must be uppercase, each key only has one associated value * @return parsed {@link DescribeStoredQueries} request * @throws MissingParameterException * if the request version is unsupported * @throws InvalidParameterValueException * if a parameter contains a syntax error */ public static DescribeStoredQueries parse( Map<String, String> kvpParams ) throws MissingParameterException, InvalidParameterValueException { Version version = Version.parseVersion( KVPUtils.getRequired( kvpParams, "VERSION" ) ); if ( !( VERSION_200.equals( version ) ) ) { String msg = Messages.get( "UNSUPPORTED_VERSION", version, Version.getVersionsString( VERSION_200 ) ); throw new InvalidParameterValueException( msg ); } String[] storedQueryIds = null; if ( kvpParams.get( "STOREDQUERY_ID" ) != null ) { storedQueryIds = StringUtils.split( kvpParams.get( "STOREDQUERY_ID" ), "," ); } return new DescribeStoredQueries( version, null, storedQueryIds ); } }
String[] queryTypeNamesString = StringUtils.split( typeQuery, " " ); QName[] queryTypeNames = new QName[queryTypeNamesString.length]; int counterQName = 0; String[] elementSetNameTypeNamesString = StringUtils.split( typeElementSetName, " " ); returnTypeNames = new QName[elementSetNameTypeNamesString.length]; for ( int i = 0; i < elementSetNameTypeNamesString.length; i++ ) {
String typeElementSetName = getNodeAsString( elSetNameEl, new XPath( "@typeNames", nsContext ), "" ).trim(); if ( typeElementSetName != null && !typeElementSetName.isEmpty() ) { String[] elementSetNameTypeNamesString = StringUtils.split( typeElementSetName, " " ); typeNames = new QName[elementSetNameTypeNamesString.length]; for ( int i = 0; i < elementSetNameTypeNamesString.length; i++ ) {
String aliasesStr = getNodeAsString( queryEl, new XPath( "@aliases", nsContext ), null ); if ( aliasesStr != null ) { aliases = StringUtils.split( aliasesStr, " " ); String[] tokens = StringUtils.split( typeNameStr, " " ); if ( aliases != null && aliases.length != tokens.length ) { String msg = "Number of entries in 'aliases' and 'typeNames' attributes does not match.";
String aliasesStr = getNodeAsString( queryEl, new XPath( "@aliases", nsContext ), null ); if ( aliasesStr != null ) { aliases = StringUtils.split( aliasesStr, " " ); String[] tokens = StringUtils.split( typeNameStr, " " ); if ( aliases != null && aliases.length != tokens.length ) { String msg = "Number of entries in 'aliases' and 'typeNames' attributes does not match.";