Class SourcePrefHelper
- java.lang.Object
-
- org.openstreetmap.josm.data.preferences.sources.SourcePrefHelper
-
- Direct Known Subclasses:
MapPaintPrefHelper
,PresetPrefHelper
,ValidatorPrefHelper
public abstract class SourcePrefHelper extends java.lang.Object
Helper class for specialized extensions preferences.- Since:
- 12649 (extracted from gui.preferences package)
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
pref
protected SourceType
type
-
Constructor Summary
Constructors Modifier Constructor Description protected
SourcePrefHelper(java.lang.String pref, SourceType type)
Constructs a newSourcePrefHelper
for the given preference key.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description SourceEntry
deserialize(java.util.Map<java.lang.String,java.lang.String> entryStr)
Deserializes the given map as a source entry.java.util.List<SourceEntry>
get()
Returns the list of sources.java.util.Set<java.lang.String>
getActiveUrls()
Returns the set of active source URLs.abstract java.util.Collection<ExtendedSourceEntry>
getDefault()
Returns the default sources provided by JOSM core.boolean
put(java.util.Collection<? extends SourceEntry> entries)
Saves a list of sources to JOSM preferences.java.util.Map<java.lang.String,java.lang.String>
serialize(SourceEntry entry)
Serializes the given source entry as a map.private java.util.List<java.util.Map<java.lang.String,java.lang.String>>
serializeList(java.util.Collection<? extends SourceEntry> entries)
-
-
-
Field Detail
-
pref
private final java.lang.String pref
-
type
protected final SourceType type
-
-
Constructor Detail
-
SourcePrefHelper
protected SourcePrefHelper(java.lang.String pref, SourceType type)
Constructs a newSourcePrefHelper
for the given preference key.- Parameters:
pref
- The preference keytype
- The source type- Since:
- 12825
-
-
Method Detail
-
getDefault
public abstract java.util.Collection<ExtendedSourceEntry> getDefault()
Returns the default sources provided by JOSM core.- Returns:
- the default sources provided by JOSM core
-
serialize
public java.util.Map<java.lang.String,java.lang.String> serialize(SourceEntry entry)
Serializes the given source entry as a map.- Parameters:
entry
- source entry to serialize- Returns:
- map (key=value)
-
deserialize
public SourceEntry deserialize(java.util.Map<java.lang.String,java.lang.String> entryStr)
Deserializes the given map as a source entry.- Parameters:
entryStr
- map (key=value)- Returns:
- source entry
-
get
public java.util.List<SourceEntry> get()
Returns the list of sources.- Returns:
- The list of sources
-
put
public boolean put(java.util.Collection<? extends SourceEntry> entries)
Saves a list of sources to JOSM preferences.- Parameters:
entries
- list of sources- Returns:
true
, if something has changed (i.e. value is different than before)
-
serializeList
private java.util.List<java.util.Map<java.lang.String,java.lang.String>> serializeList(java.util.Collection<? extends SourceEntry> entries)
-
getActiveUrls
public final java.util.Set<java.lang.String> getActiveUrls()
Returns the set of active source URLs.- Returns:
- The set of active source URLs.
-
-