fiftyone.mobile.detection.entities
Class Property

java.lang.Object
  extended by fiftyone.mobile.detection.entities.BaseEntity
      extended by fiftyone.mobile.detection.entities.Property
All Implemented Interfaces:
Comparable<Property>

public class Property
extends BaseEntity
implements Comparable<Property>

Encapsulates all the information about a property including how it's values should be used and what they mean.

Some properties are not mandatory and may not always contain values. For example; information concerning features of a television may not be applicable to a mobile phone. The IsMandatory property should be checked before assuming a value will be returned.

Properties can return none, one or many values. The IsList property should be referred to to determine the number of values to expect. Properties where IsList is false will only return up to one value.

The property also provides other information about the intended use of the property. The Description can be used by UI developers to provide more information about the intended use of the property and it's values. The Category property can be used to group together related properties in configuration UIs.

Values are returned in the type Values which includes utility methods to easily extract strongly typed values.

For more information see http://51degrees.mobi/Support/Documentation/Java


Nested Class Summary
static class Property.PropertyValueType
          Enumeration of strongly typed property values which could be returned.
 
Field Summary
private  String category
           
private  int categoryOffset
           
private  Component component
           
private  int componentIndex
           
private  Value defaultValue
           
private  int defaultValueIndex
           
private  String description
           
private  int descriptionOffset
           
 byte displayOrder
          The order in which the property should appear in relation to others with a position value set when used to create a display string for the profile it is contained within.
 int FirstMapIndex
           
(package private)  int firstValueIndex
          The index of the first value related to the property.
 boolean isList
          True if the property might have more than one value.
 boolean isMandatory
          True if the property must contain values.
 boolean isObsolete
          True if the property is marked as obsolete and will be removed from a future version of the data set.
private  int lastValueIndex
           
 int MapCount
           
private  String name
           
private  int nameOffset
           
 boolean show
          True if the property is relevant to be shown in a configuration user interface where the property may appear in a list of options.
 boolean showValues
          True if the values the property returns are relevant to configuration user interfaces and are suitable to be selected from a list of table of options.
private  URL url
           
private  int urlOffset
           
private  Values values
           
 Property.PropertyValueType valueType
          The strongly type data type the property returns.
 
Constructor Summary
Property(Dataset dataSet, int index, BinaryReader reader)
          Constructs a new instance of Property
 
Method Summary
 int compareTo(Property other)
          Compares this property to another using the index field if they're in the same list, otherwise the name field.
private  Values doGetValues()
          Returns the values which reference the property by starting at the first value index and moving forward until a new property is found.
 String getCategory()
          The category the property relates to within the data set.
 Component getComponent()
          The component the property relates to.
 Value getDefaultValue()
          The value the property returns if a strongly type value is not available.
 String getDescription()
          A description of the property suitable to be displayed to end users via a user interface.
 String getName()
          The name of the property.
 URL getUrl()
          A URL to more information about the property.
 Values getValues()
          An array of values the property has available.
 void init()
          Initialises the often used lists and references if storing of object references is enabled.
 String toString()
          A string representation of the property.
 
Methods inherited from class fiftyone.mobile.detection.entities.BaseEntity
binarySearch, getDataSet, getIndex, readIntegerArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

isList

public final boolean isList
True if the property might have more than one value.


isMandatory

public final boolean isMandatory
True if the property must contain values.


showValues

public final boolean showValues
True if the values the property returns are relevant to configuration user interfaces and are suitable to be selected from a list of table of options.


show

public final boolean show
True if the property is relevant to be shown in a configuration user interface where the property may appear in a list of options.


isObsolete

public final boolean isObsolete
True if the property is marked as obsolete and will be removed from a future version of the data set.


displayOrder

public final byte displayOrder
The order in which the property should appear in relation to others with a position value set when used to create a display string for the profile it is contained within.


firstValueIndex

final int firstValueIndex
The index of the first value related to the property.


name

private String name

nameOffset

private final int nameOffset

valueType

public final Property.PropertyValueType valueType
The strongly type data type the property returns.


defaultValue

private Value defaultValue

defaultValueIndex

private final int defaultValueIndex

component

private Component component

componentIndex

private final int componentIndex

values

private Values values

description

private String description

descriptionOffset

private final int descriptionOffset

category

private String category

categoryOffset

private final int categoryOffset

url

private URL url

urlOffset

private final int urlOffset

lastValueIndex

private int lastValueIndex

MapCount

public final int MapCount

FirstMapIndex

public final int FirstMapIndex
Constructor Detail

Property

public Property(Dataset dataSet,
                int index,
                BinaryReader reader)
         throws IOException
Constructs a new instance of Property

Parameters:
dataSet -
index -
reader -
Throws:
IOException
Method Detail

getName

public String getName()
               throws IOException
The name of the property.

Throws:
IOException

getDefaultValue

public Value getDefaultValue()
                      throws IOException
The value the property returns if a strongly type value is not available.

Throws:
IOException

getComponent

public Component getComponent()
                       throws IOException
The component the property relates to.

Throws:
IOException

getValues

public Values getValues()
                 throws IOException
An array of values the property has available.

Throws:
IOException

getDescription

public String getDescription()
                      throws IOException
A description of the property suitable to be displayed to end users via a user interface.

Throws:
IOException

getCategory

public String getCategory()
                   throws IOException
The category the property relates to within the data set.

Throws:
IOException

getUrl

public URL getUrl()
           throws IOException
A URL to more information about the property.

Throws:
IOException

init

public void init()
          throws IOException
Initialises the often used lists and references if storing of object references is enabled.

Throws:
IOException

doGetValues

private Values doGetValues()
                    throws IOException
Returns the values which reference the property by starting at the first value index and moving forward until a new property is found.

Returns:
A values list initialised with the property values
Throws:
IOException

compareTo

public int compareTo(Property other)
Compares this property to another using the index field if they're in the same list, otherwise the name field.

Specified by:
compareTo in interface Comparable<Property>
Parameters:
other - The property to be compared against
Returns:
Indication of relative value

toString

public String toString()
A string representation of the property.

Overrides:
toString in class Object
Returns:
the property name as a string