Add option to define factory as static method.

Signed-off-by: Spencer Deinum <spencerdeinum@gmail.com>

Tweak code example

Signed-off-by: Spencer Deinum <spencerdeinum@gmail.com>