new Function<PropertyDescriptor, Object>()
{
@Override
public Object map( PropertyDescriptor propertyDescriptor )
{
Parameter param = queryAsForm.getFirst( propertyDescriptor.qualifiedName().name() );
if( param == null )
{
param = entityAsForm.getFirst( propertyDescriptor.qualifiedName().name() );
}
if( param != null )
{
String value = param.getValue();
if( value != null )
{
try
{
return valueDeserializer.deserialize( propertyDescriptor.valueType(), value );
}
catch( ValueSerializationException e )
{
throw new IllegalArgumentException( "Query parameter has invalid JSON format", e );
}
}
}
return null;
}
},
new Function<AssociationDescriptor, EntityReference>()
{
@Override
public EntityReference map( AssociationDescriptor associationDescriptor )
{
Parameter param = queryAsForm.getFirst( associationDescriptor.qualifiedName().name() );
if( param == null )
{
param = entityAsForm.getFirst( associationDescriptor.qualifiedName().name() );
}
if( param != null )
{
return EntityReference.parseEntityReference( param.getValue() );
}
else
{
return null;
}