private static void generateInstance(String className) {
		builder.addField(FieldSpec.builder(className(className), "instance", Modifier.PRIVATE, Modifier.STATIC).addJavadoc("instance of shared preferences\n").build());
		// instance
		MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder("getInstance").addModifiers(Modifier.PUBLIC, Modifier.STATIC, Modifier.SYNCHRONIZED)
				.addJavadoc("get instance of shared preferences\n").returns(className(className));

		methodBuilder.beginControlFlow("if (instance==null)");
		methodBuilder.addStatement("instance=new $L()", className(className));
		methodBuilder.addComment("read and write instance to sync with default values");
		methodBuilder.addStatement("instance.write(instance.read())");
		methodBuilder.endControlFlow();
		methodBuilder.addCode("return instance;\n");

		builder.addMethod(methodBuilder.build());
	}
private static void generateInstance ( String className ) { builder . addField ( FieldSpec . builder ( className ( className ) , "instance" , Modifier . PRIVATE , Modifier . STATIC ) . addJavadoc ( "instance of shared preferences\n" ) . build ( ) ) ; MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "getInstance" ) . addModifiers ( Modifier . PUBLIC , Modifier . STATIC , Modifier . SYNCHRONIZED ) . addJavadoc ( "get instance of shared preferences\n" ) . returns ( className ( className ) ) ; methodBuilder . beginControlFlow ( "if (instance==null)" ) ; methodBuilder . addStatement ( "instance=new $L()" , className ( className ) ) ; methodBuilder . addComment ( "read and write instance to sync with default values" ) ; methodBuilder . addStatement ( "instance.write(instance.read())" ) ; methodBuilder . endControlFlow ( ) ; methodBuilder . addCode ( "return instance;\n" ) ; builder . addMethod ( methodBuilder . build ( ) ) ; }
Generate instance of shared preferences.

@param className
the class name