package greenfoot.core;
import bluej.utility.Debug;
import java.util.HashMap;
import java.util.Map;
| A class which resides on the debug VM. Its job is to hold copies of the project
| properties, mirrored across from the server VM. It implements ReadOnlyProjectProperties
| because it is passed to other classes as if it is read-only, with changes only being
| possible via the propertyChangedOnServerVM method in this class; no debug VM code
| other than this can change a property.
|
public class ShadowProjectProperties
implements ReadOnlyProjectProperties{
private final Map<String, String> properties = new HashMap<>();
| Called when a property has changed on the server VM, and the change needs
| to be inserted into our shadow copy of the properties
|
public void propertyChangedOnServerVM(String key, String value)
{
if (value == null)
{
properties.remove(key);
}
else
{
properties.put(key, value);
}
}
@Override
public String getString(String key, String defaultValue)
{
return properties.getOrDefault(key, defaultValue);
}
}
top,
use,
map,
class ShadowProjectProperties
. propertyChangedOnServerVM
. getString
35 neLoCode
+ 7 LoComm