/** * Get the SemanticMarkup associated with an object in this DataThing. If * there is no such metadata available the behavious depends upon the value * of the supplyDefaults parameter. If false, then a * NoMetadataFoundException is thrown, if true a new SemanticMarkup object * is created, stored in the dictionary and returned to the caller. */ public SemanticMarkup getMetadataForObject(Object theObject, boolean supplyDefault) throws NoMetadataFoundException { WeakReference<SemanticMarkup> ref = metadataMap.get(theObject); if (ref != null && ref.get() != null) { return ref.get(); } if (supplyDefault == false) { throw new NoMetadataFoundException("No metadata available"); } // Create a new markup object and store // it bound to the object specified SemanticMarkup theMarkup = new SemanticMarkup(theObject); metadataMap.put(theObject, new WeakReference<SemanticMarkup>(theMarkup)); return theMarkup; }