private static void generateWriteMethod(PrefsEntity entity) {
		// write method
		MethodSpec.Builder method = MethodSpec.methodBuilder("write").addJavadoc("write bean entirely\n\n").addJavadoc("@param bean bean to entirely write\n").addModifiers(Modifier.PUBLIC)
				.addParameter(typeName(entity.getName()), "bean").returns(Void.TYPE);
		method.addStatement("$T editor=prefs.edit()", SharedPreferences.Editor.class);

		PrefsTransform transform;
		for (PrefsProperty item : entity.getCollection()) {
			if (item.hasTypeAdapter()) {
				transform = PrefsTransformer.lookup(item.typeAdapter.getDataTypeTypename());
			} else {
				transform = PrefsTransformer.lookup(item);
			}

			transform.generateWriteProperty(method, "editor", typeName(entity.getElement()), "bean", item);
			method.addCode("\n");
		}
		method.addCode("\n");
		method.addStatement("editor.commit()");
		builder.addMethod(method.build());
	}
private static void generateWriteMethod ( PrefsEntity entity ) { MethodSpec . Builder method = MethodSpec . methodBuilder ( "write" ) . addJavadoc ( "write bean entirely\n\n" ) . addJavadoc ( "@param bean bean to entirely write\n" ) . addModifiers ( Modifier . PUBLIC ) . addParameter ( typeName ( entity . getName ( ) ) , "bean" ) . returns ( Void . TYPE ) ; method . addStatement ( "$T editor=prefs.edit()" , SharedPreferences . Editor . class ) ; PrefsTransform transform ; for ( PrefsProperty item : entity . getCollection ( ) ) { if ( item . hasTypeAdapter ( ) ) { transform = PrefsTransformer . lookup ( item . typeAdapter . getDataTypeTypename ( ) ) ; } else { transform = PrefsTransformer . lookup ( item ) ; } transform . generateWriteProperty ( method , "editor" , typeName ( entity . getElement ( ) ) , "bean" , item ) ; method . addCode ( "\n" ) ; } method . addCode ( "\n" ) ; method . addStatement ( "editor.commit()" ) ; builder . addMethod ( method . build ( ) ) ; }
Generate write method.

@param entity
the entity