Wiki

Clone wiki

javarosa / PropertyModel

Properties Model

This document is just a sandbox for coming up with a complete model of what we want in a robust, reusable property manager.

Properties

In the most Naive model, properties are simple tuples of strings, ("!UseBluetoothConnection","yes"). However, this model means that applications that want to have user configurable properties need to have their own internal states of what set each of the values from these tuples can be a part of("!ViewType","j2me Polish". Where !ViewType can only semantically be "j2me Polish","native", or "textui"), which is pretty much every app we want.

As such, properties need to have some sort of set inclusion, and some kinds of internal meta-properties themselves.

Proposal

A Property is a unique binary relationship between two strings, a Name/Value pair.

Properties can have a Vector of Strings that serve as an Enumeration for the different possibilities for that Name/Value relationship.

Name/Value pairs are never 'created' as such. They are only set. This has the complication that setting an enumeration can't be part of some constructor phase, but this seems mostly reasonable. Unfortunately, this means that Name/Set is also an independent binary relationship.

This has two detriments 1. It introduces the ability to make semantic mistakes like adding a relationship to a non-existent pairing. 1. It gives people the ability to treat the Properties bucket as something that stores something not originally intended to be the datatype (a String/Vector pairing).

There is also the possibility that our values should be vectors as well, to accommodate at-least-one or any-number relationships between a Value and an enumeration. Is there a good example where this fits a Property model?

Updated