How to access metadata
What is metadata?
Metadata is essentially description for properties and property values. This could come in handy in a number of situations such as providing meaningful description when outputting detection results and building user interfaces that allow users to make choices.
Metadata with Java API
The following code accesses the dataset object and retrieves the list of properties contained in your data set. Each property has an associated list of possible values and a description for each value if available. In the following code newProvider is a Provider object.
for ( int abc = 0 ; abc < newProvider . dataSet . getProperties (). size (); abc ++) { //Get individual property, print name and description. Property tp = newProvider . dataSet . getProperties (). get ( abc ); System . out . println ( "----- Property " + abc + " -----" ); System . out . println ( "Property: " + tp . getName ()); System . out . println ( "Description: " + tp . getDescription ()); //For each property there is a set of possible values. //Print each value and description. for ( int abbc = 0 ; abbc < tp . getValues (). size (); abbc ++) { System . out . println ( "\t Value: " + tp . getValues (). get ( abbc ). getName ()); if ( tp . getValues (). get ( abbc ). getDescription () != null ) System . out . println ( "\t -Description: " + tp . getValues (). get ( abbc ). getDescription ()); } }
The above code will print a list of properties, property descriptions and a list of values. Eample:
Property: IsEmulatingDesktop Description: Indicates if the device is in a desktop emulation mode. Value: False -Description: Indicates that the device is not in a desktop emulation mode. Value: N/A -Description: Indicates that the device is not capable of emulating desktop. Value: True -Description: Indicates that the device is in a desktop emulation mode. Value: Unknown -Description: Indicates it is not possible to determine if the devices is emulating a desktop.