|title||Native prism representation (Java)|
"employeeType": [ "Captain", "Pirate" ],
Prism objects are more or less ordinary data structures in Java. They can be accessed using a native Prism interface (API), but the same data can also be accessed by variety of other interfaces (JAXB, DOM, ...). The unique feature of prism is that the data are not transformed to these formats but real live data are presented. For example if a bean property is set by invoking JAXB setter the change is immediately reflected to the underlying prism data model. The next call to DOM interface will return the new value of the property.
|title||Live data example|
// Set the "fullName" property using a JAXB interface
UserType userType = ....
// Invoking native Prism interface to read fullName, returns "Jack Sparrow"
PrismObject<UserType> userPrism = ....
String fullName = userPrism.findProperty(new QName(NS_C, "fullName").getValue().getValue();
// Invoking DOM interface to read the fullName, returns "Jack Sparrow"
Element fullnameElement = ....
String fullName = fullnameElement.getTextContent()
Each prism object has a pre-defined optional
extension container. This container is supposed to hold custom extensions to each object. The
extension container is expected to be dynamic by default therefore allowing any item to be stored there. However, there are mechanisms in prism to provide a (run-time) schema for this container. This constraints the possibilities of which items may be stored there and therefore creates a solid schema for the entire object.
|title||Object with extension (XML representation)|
Prism object can be switched from one interface to the other. Methods to do that start with prefix
asObjectable(). Such method return the same object represented by the mechanism of the other interface. The two objects still refer to the same data, therefore changing the content of one object is immediately reflected to the other.
|title||Interface switching example|
PrismObject<UserType> userPrism = ....; // Native Prism API
UserType userType = userPrism.asObjectable(); // Switch to JAXB generated class
userType.setFullName("Jack Sparrow"); // Sets the "fullName" property
String fullName =
userPrism.findProperty(new QName(NS_C, "fullName").getValue().getValue(); // Returns "Jack Sparrow"