com.cloudesire.platform.apiclient.query.BaseQuery Maven / Gradle / Ivy
The newest version!
package com.cloudesire.platform.apiclient.query;
import java.util.HashMap;
import java.util.Map;
abstract class BaseQuery extends HashMap
{
protected BaseQuery( Map m )
{
super( m );
}
protected BaseQuery()
{
}
@Override
public Object put( String key, Object value )
{
if ( value == null ) return super.remove( key );
return super.put( key, value );
}
void putMap( String parameter, Map map )
{
map.forEach( ( key, value ) -> {
if ( value == null ) value = "";
put( String.format( "%s[%s]", parameter, key ), value );
} );
}
}