Slots are arbitrary attributes that you can create for an object. Use the RegistryObject.getSlots method to retrieve a Collection of the object’s slots. For each slot, you can retrieve its name, values, and type. The name of a Slot object is a String, not an InternationalString, and a slot has a Collection of values. The following fragment retrieves and displays an object’s slots:
Collection slots = object.getSlots(); Iterator slotIter = slots.iterator(); while (slotIter.hasNext()) { Slot slot = (Slot) slotIter.next(); String name = slot.getName(); System.out.println(" Slot name is " + name); Collection values = slot.getValues(); Iterator valIter = values.iterator(); int count = 1; while (valIter.hasNext()) { String value = (String) valIter.next(); System.out.println(" Slot value " + count++ + ": " + value); } String type = slot.getSlotType(); if (type != null) { System.out.println(" Slot type is " + type); }
Some of the examples have a showSlots method that uses this code. See, for example, JAXRSearchByName.java in the directory <INSTALL>/registry/samples/search-name/src.