code: public static List<ExternalGraphic> externalGraphicsFromRule( Rule rule ) {
          List<ExternalGraphic> gList = new ArrayList<ExternalGraphic>();
          List<Symbolizer> symbolizers = rule.symbolizers();
          if (symbolizers.size() != 0) {
              for( Symbolizer symbolizer : symbolizers ) {
                  Graphic[] graphics = new Graphic[2];
                  if (symbolizer instanceof PointSymbolizer) {
                      PointSymbolizer pointSymbolizer = (PointSymbolizer) symbolizer;
                      graphics[0] = pointSymbolizer.getGraphic();
                  } else if (symbolizer instanceof LineSymbolizer) {
                      LineSymbolizer lineSymbolizer = (LineSymbolizer) symbolizer;
                      Stroke stroke = lineSymbolizer.getStroke();
                      graphics[0] = stroke.getGraphicStroke();
                  } else if (symbolizer instanceof PolygonSymbolizer) {
                      PolygonSymbolizer polygonSymbolizer = (PolygonSymbolizer) symbolizer;
                      Stroke stroke = polygonSymbolizer.getStroke();
                      if (stroke != null)
                          graphics[0] = stroke.getGraphicStroke();
                      Fill fill = polygonSymbolizer.getFill();
                      if (fill != null)
                          graphics[1] = fill.getGraphicFill();
                  }
                  for( int i = 0; i < graphics.length; i++ ) {
                      if (graphics[i] != null) {
                          for( GraphicalSymbol gs : graphics[i].graphicalSymbols() ) {
                              if ((gs != null) && (gs instanceof ExternalGraphic)) {
                                  ExternalGraphic externalGraphic = (ExternalGraphic) gs;
                                  gList.add(externalGraphic);
                              }
                          }
                      }
                  }
              }
              return gList;
          }
          return Collections.emptyList();
      }
docs: Collect all {@link ExternalGraphic}s from the given {@link Rule}.
  
  @param rule the rule to check.
  @return the extracted {@link ExternalGraphic}s.