public class ReadPreferenceEditor extends PropertyEditorSupport
PropertyEditor
for the ReadPreference
class.
The string value must be one of the following tokens or a parsable JSON
document in the form of ReadPreference.asDocument()
.
PRIMARY
SECONDARY
CLOSEST
NEAREST
PREFER_PRIMARY
PREFER_SECONDARY
This editor will also parse a full MongoDB URI to extract the specified
ReadPreference
. See the Connection String URI Format documentation for information on
constructing a MongoDB URI.
Modifier and Type | Field and Description |
---|---|
protected static Log |
LOG
The logger for the
ReadPreferenceEditor . |
static Set<String> |
MONGODB_URI_FIELDS
The set of fields used to determine a Durability from a MongoDB URI.
|
Constructor and Description |
---|
ReadPreferenceEditor()
Creates a new ReadPreferenceEditor.
|
Modifier and Type | Method and Description |
---|---|
void |
setAsText(String readPreferenceString) |
addPropertyChangeListener, firePropertyChange, getAsText, getCustomEditor, getJavaInitializationString, getSource, getTags, getValue, isPaintable, paintValue, removePropertyChangeListener, setSource, setValue, supportsCustomEditor
public static final Set<String> MONGODB_URI_FIELDS
protected static final Log LOG
ReadPreferenceEditor
.public ReadPreferenceEditor()
public void setAsText(String readPreferenceString) throws IllegalArgumentException
Overridden to parse a string to a ReadPreference
.
setAsText
in interface PropertyEditor
setAsText
in class PropertyEditorSupport
IllegalArgumentException
- If the string cannot be parsed into a ReadPreference
.Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.