org.apache.tuscany.samples.sdo.specExampleSection
Class UsingTypeAndPropertyWithDataObjects

java.lang.Object
  extended by org.apache.tuscany.samples.sdo.specExampleSection.UsingTypeAndPropertyWithDataObjects

public class UsingTypeAndPropertyWithDataObjects
extends java.lang.Object

Demonstrates the use of Type and Property to display and the META-DATA for and access Properties of a DataObject.
The following sample is from the Apache Tuscany project. It was written to help users understand and experiement with SDO. It is based upon example code contained within, and is meant for use with, and reference to the SDO Specification. In general this sample attempts to use the code and comments contained within the specification, exceptions to this are noted in comments.

The following sample is based upon the 'Using Type and Property with DataObjects' example from the Examples section of the SDO specification.

The Type interface provides access to the metadata for DataObjects. The methods on Type and Property provide information that describes the properties of a DataObject. To obtain the Type for a DataObject use the getType() method. This example prints out the contents of a DataObject, each property has it's meta-data displayed, accessed dynamically using Type and Property.


Usage:
This sample can easily be run from within Eclipse as a Java Application if tuscany or the sample-sdo project is imported into Eclipse as an existing project.

If executing as a standalone application please do the following:

Author:
Robbie Minshall
See Also:
PrintPropertiesOfDataObject

Constructor Summary
UsingTypeAndPropertyWithDataObjects()
           
 
Method Summary
static void main(java.lang.String[] args)
          Execute this method in order to run the sample.
static void printDataObject(commonj.sdo.DataObject dataObject, int indent)
          Prints out the contents of a DataObject, each property has it's meta-data displayed, accessed dynamically using Type and Property.
static void printValue(java.lang.Object value, commonj.sdo.Property property, int indent)
          Prints the value of a property
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UsingTypeAndPropertyWithDataObjects

public UsingTypeAndPropertyWithDataObjects()
Method Detail

main

public static void main(java.lang.String[] args)
Execute this method in order to run the sample.

Parameters:
args -

printDataObject

public static void printDataObject(commonj.sdo.DataObject dataObject,
                                   int indent)
Prints out the contents of a DataObject, each property has it's meta-data displayed, accessed dynamically using Type and Property.

Parameters:
dataObject. - DataObject to be printed.
indent. - For formatting

printValue

public static void printValue(java.lang.Object value,
                              commonj.sdo.Property property,
                              int indent)
Prints the value of a property

Parameters:
value. - Value of Property to be printed
property. - Property to be printed
indent. - For formatting


Copyright © 2007 Apache Software Foundation. All Rights Reserved.