private synchronized Map loadConfig() { return( BEncoder.cloneMap( COConfigurationManager.getMapParameter( "speed.limit.handler.state", new HashMap()))); }
this.enabledNetworks = toBeCloned.enabledNetworks == null ? null : new HashMap<>(toBeCloned.enabledNetworks); this.initialTags = toBeCloned.initialTags == null ? null : new ArrayList<>(toBeCloned.initialTags); this.initialMetadata = BEncoder.cloneMap(toBeCloned.initialMetadata);
map = BEncoder.cloneMap( map );
protected Map<String,Object> readMapAttribute( TagTypeBase tag_type, TagBase tag, String attr, Map<String,Object> def ) { try{ synchronized( this ){ Map conf = getConf( tag_type, tag, false ); if ( conf == null ){ return( def ); } Map m = (Map)conf.get( attr ); if ( m == null ){ return( def ); } return( BEncoder.cloneMap( m )); } }catch( Throwable e ){ Debug.out( e ); return( def ); } }
public static Object clone( Object obj ) { if ( obj instanceof List ){ return( cloneList((List)obj)); }else if ( obj instanceof Map ){ return( cloneMap((Map)obj)); }else if ( obj instanceof byte[]){ return(((byte[])obj).clone()); }else{ // assume immutable - String,Long etc return( obj ); } }
config = BDecoder.decodeStrings( BEncoder.cloneMap( config ));
@Override public void setMapAttribute( TorrentAttribute attribute, Map value ) { String name = convertAttribute( attribute ); if ( name != null ){ // gotta clone before updating in case user has read values and then just // updated them - setter code optimises out sets of the same values... download_manager.getDownloadState().setMapAttribute( name, BEncoder.cloneMap( value )); } }
active = BEncoder.cloneMap( active );
public void generate( IndentWriter writer, TagTypeBase tag_type, TagBase tag ) { synchronized( this ){ Map conf = getConf( tag_type, tag, false ); if ( conf != null ){ conf = BDecoder.decodeStrings( BEncoder.cloneMap( conf )); writer.println( BEncoder.encodeToJSON( conf )); } } }
other_hashes = BEncoder.cloneMap( other_hashes );
active = BEncoder.cloneMap( active );