protected Element adapt(Element source,ElementMetadata<?,?> sourceMeta,String kind){
  ElementKey<?,?> adaptorKey=sourceMeta.adapt(kind);
  if (adaptorKey != null) {
    try {
      return adapt(adaptorKey,source);
    }
 catch (    ContentCreationException e) {
      LOGGER.log(Level.SEVERE,"Unable to adapt " + source.getClass() + " to "+ adaptorKey.getElementType(),e);
    }
  }
  return source;
}

protected Element adapt ( Element source , ElementMetadata < ? , ? > sourceMeta , String kind ) { ElementKey < ? , ? > adaptorKey = sourceMeta . adapt ( kind ) ; if ( adaptorKey != null ) { try { return adapt ( adaptorKey , source ) ; } catch ( ContentCreationException e ) { LOGGER . log ( Level . SEVERE , "Unable to adapt " + source . getClass ( ) + " to " + adaptorKey . getElementType ( ) , e ) ; } } return source ; }
adapts an element based on a key . this will find an adaptation in the metadata and adapt to that metadata type ( and element type ) . if no adaptation is found this will return the source element .
