com.backendless.PlainHeadersManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-sdk-common Show documentation
Show all versions of java-sdk-common Show documentation
Provides access to Backendless API
The newest version!
package com.backendless;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
abstract class PlainHeadersManager implements IHeadersManager
{
protected final ConcurrentHashMap headers = new ConcurrentHashMap<>();
protected PlainHeadersManager()
{
cleanHeaders();
}
@Override
public void cleanHeaders()
{
headers.clear();
}
@Override
public void addHeader( IHeadersManager.HeadersEnum headersEnum, String value )
{
headers.put( headersEnum.getHeader(), value );
}
@Override
public void addHeader( String name, String value )
{
headers.put( name, value );
}
@Override
public void addHeaders( Map headers )
{
this.headers.putAll( headers );
}
@Override
public void removeHeader( IHeadersManager.HeadersEnum headersEnum )
{
headers.remove( headersEnum.getHeader() );
}
@Override
public void removeHeader( String name )
{
headers.remove( name );
}
@Override
public Map getHeaders()
{
return Collections.unmodifiableMap( headers );
}
@Override
public void setHeaders( Map headers )
{
cleanHeaders();
this.headers.putAll( headers );
}
@Override
public String getHeader( IHeadersManager.HeadersEnum headersEnum )
{
return headers.get( headersEnum.getHeader() );
}
@Override
public String getHeader( String name )
{
return headers.get( name );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy