private void appendOptionalElementIDFromHint ( StringBuilder sb ) { String elementID = ( String ) this . hints . get ( SVGHints . KEY_ELEMENT_ID ) ; if ( elementID != null ) { this . hints . put ( SVGHints . KEY_ELEMENT_ID , null ) ; // clear it if ( this . elementIDs . contains ( elementID ) ) { throw new IllegalStateException ( "The element id " + elementID + " is already used." ) ; } else { this . elementIDs . add ( elementID ) ; } this . sb . append ( "id=\"" ) . append ( elementID ) . append ( "\" " ) ; } }
A utility method that appends an optional element id if one is specified via the rendering hints .