-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KeyValue setting type #11
Comments
is this feature request still open? |
friendly ping. |
Yes, it is. |
I have a created a generic pair class. But here when a new SettingValue is created it is always passed in a string(eg. "X,Y"). How can I get to know about the datatype of X & Y? |
The API was designed without complex settings in mind, so these are currently all strings. For the localized string setting the value contains JSON so I would do the same here. Or if you have the time change the parameter to be a
The idea behind the Key-Value-SettingsType is not just to values but to allow the user to input a something like a |
How will this be different from |
The value of a <select>
<option value="key1">value1</option>
<option value="key2">value2</option>
<option value="key3">value3</option>
</select> |
What I had in my mind was something like, <bean class="org.n52.faroe.settings.KeyValueSettingDefinition">
<property name="key" value="Center" />
<property name="title" value="Possible coordinates for center of circle" />
<property name="order" value="25.0" />
<property name="group" ref="serviceSettingDefintionGroup" />
<property name="value" ref="centreCooridnates" />
</bean>
<bean class="org.n52.faroe.settings.model.Pair" id="centreCooridnates">
<constructor-arg ref = "doubleValue" />
<constructor-arg ref = "doubleValue" />
</bean>
<bean id="doubleValue" class="java.lang.Double">
<constructor-arg index="0" value="3.7"/>
</bean> So for a Pair<A,B> B can be a |
Sorry, but I see no benefit in having a pair as a setting. You could just use two string settings to accomplish the same. And if you want do define a setting with a simple I suggest you start with the following class definition, which pretty much summerizes what is required: class KeyValueSettingSettingDefinition extends AbstractSettingDefinition<Map<String, String>> Or, if you want to be brave: class KeyValueSettingSettingDefinition<V> extends AbstractSettingDefinition<Map<String, V>> The only way you could use your class KeyValueSettingSettingDefinition<V> extends AbstractSettingDefinition<List<Pair<String, V>>> But this version has different semantics, as it allows different values for the same key... |
Implement a new setting type that pairs two values.
See 52North/iceland#31.
The text was updated successfully, but these errors were encountered: