public static Pair<String, List<Pair<String, TypeName>>> extractParametersFromString(String value, SQLiteModelMethod method, SQLiteEntity entity) {
		String whereStatement = value;
		Pair<String, List<Pair<String, TypeName>>> result = new Pair<String, List<Pair<String, TypeName>>>();
		result.value1 = new ArrayList<Pair<String, TypeName>>();

		// replace placeholder :{ } with ?
		{
			Matcher matcher = PARAMETER.matcher(whereStatement);

			String paramName;
			StringBuffer buffer = new StringBuffer();
			TypeName paramType;			
			while (matcher.find()) {
				matcher.appendReplacement(buffer, "?");
												
				paramName = SqlAnalyzer.extractParamName(matcher);
				paramType = method.findParameterTypeByAliasOrName(paramName);

				if (paramType == null) {
					throw (new MethodParameterNotFoundException(method, paramName));
				}
				result.value1.add(new Pair<String, TypeName>(paramName, paramType));
			}
			matcher.appendTail(buffer);

			whereStatement = buffer.toString();
		}

		// replace fields
		{
			Matcher matcher = WORD.matcher(whereStatement);

			StringBuffer buffer = new StringBuffer();
			while (matcher.find()) {
				ModelProperty property = entity.findPropertyByName(matcher.group(1));
				if (property != null) {
					matcher.appendReplacement(buffer, entity.findPropertyByName(matcher.group(1)).columnName);
				}

			}
			matcher.appendTail(buffer);
			whereStatement = buffer.toString();
		}

		result.value0 = whereStatement;

		return result;
	}
public static Pair < String , List < Pair < String , TypeName > > > extractParametersFromString ( String value , SQLiteModelMethod method , SQLiteEntity entity ) { String whereStatement = value ; Pair < String , List < Pair < String , TypeName > > > result = new Pair < String , List < Pair < String , TypeName > > > ( ) ; result . value1 = new ArrayList < Pair < String , TypeName > > ( ) ; { Matcher matcher = PARAMETER . matcher ( whereStatement ) ; String paramName ; StringBuffer buffer = new StringBuffer ( ) ; TypeName paramType ; while ( matcher . find ( ) ) { matcher . appendReplacement ( buffer , "?" ) ; paramName = SqlAnalyzer . extractParamName ( matcher ) ; paramType = method . findParameterTypeByAliasOrName ( paramName ) ; if ( paramType == null ) { throw ( new MethodParameterNotFoundException ( method , paramName ) ) ; } result . value1 . add ( new Pair < String , TypeName > ( paramName , paramType ) ) ; } matcher . appendTail ( buffer ) ; whereStatement = buffer . toString ( ) ; } { Matcher matcher = WORD . matcher ( whereStatement ) ; StringBuffer buffer = new StringBuffer ( ) ; while ( matcher . find ( ) ) { ModelProperty property = entity . findPropertyByName ( matcher . group ( 1 ) ) ; if ( property != null ) { matcher . appendReplacement ( buffer , entity . findPropertyByName ( matcher . group ( 1 ) ) . columnName ) ; } } matcher . appendTail ( buffer ) ; whereStatement = buffer . toString ( ) ; } result . value0 = whereStatement ; return result ; }
Extract from value string every placeholder :{}, replace it with ? and
then convert every field typeName with column typeName. The result is a
pair: the first value is the elaborated string. The second is the list of
parameters associated to ?. This second parameter is the list of
parameters and replaced with ?.

@param value the value
@param method the method
@param entity the entity
@return Pair