@Override
	public void generateWriteProperty(Builder methodBuilder, String editorName, TypeName beanClass, String beanName,
			PrefsProperty property) {
		Converter<String, String> formatter = CaseFormat.LOWER_CAMEL.converterTo(CaseFormat.UPPER_CAMEL);

		String tempPre = "";
		String tempPost = "";

		if (property.hasTypeAdapter()) {
			// this comment is needed to include $T for PrefsTypeAdapterUtils
			methodBuilder.addComment("Use $T to convert objects", PrefsTypeAdapterUtils.class);
			tempPre = String.format("%s.getAdapter(%s.class).toData(", PrefsTypeAdapterUtils.class.getSimpleName(),
					TypeUtility.className(property.typeAdapter.adapterClazz).simpleName());
			tempPost = ")";
		}

		boolean isStringSet = isStringSet(property);

		if (!isStringSet) {
			methodBuilder.beginControlFlow("if ($L!=null) ", getter(beanName, beanClass, property));
			methodBuilder.addStatement("String temp=serialize$L($L)", formatter.convert(property.getName()),
					getter(beanName, beanClass, property));
			methodBuilder.addStatement("$L.putString($S,temp)", editorName, property.getPreferenceKey());
			methodBuilder.nextControlFlow(" else ");
			methodBuilder.addStatement("$L.remove($S)", editorName, property.getPreferenceKey());
			methodBuilder.endControlFlow();
		} else {
			methodBuilder.addStatement("$L.putStringSet($S," + tempPre + "$L" + tempPost + ")", editorName,
					property.getPreferenceKey(), getter(beanName, beanClass, property));
		}

	}
@ Override public void generateWriteProperty ( Builder methodBuilder , String editorName , TypeName beanClass , String beanName , PrefsProperty property ) { Converter < String , String > formatter = CaseFormat . LOWER_CAMEL . converterTo ( CaseFormat . UPPER_CAMEL ) ; String tempPre = "" ; String tempPost = "" ; if ( property . hasTypeAdapter ( ) ) { methodBuilder . addComment ( "Use $T to convert objects" , PrefsTypeAdapterUtils . class ) ; tempPre = String . format ( "%s.getAdapter(%s.class).toData(" , PrefsTypeAdapterUtils . class . getSimpleName ( ) , TypeUtility . className ( property . typeAdapter . adapterClazz ) . simpleName ( ) ) ; tempPost = ")" ; } boolean isStringSet = isStringSet ( property ) ; if ( ! isStringSet ) { methodBuilder . beginControlFlow ( "if ($L!=null) " , getter ( beanName , beanClass , property ) ) ; methodBuilder . addStatement ( "String temp=serialize$L($L)" , formatter . convert ( property . getName ( ) ) , getter ( beanName , beanClass , property ) ) ; methodBuilder . addStatement ( "$L.putString($S,temp)" , editorName , property . getPreferenceKey ( ) ) ; methodBuilder . nextControlFlow ( " else " ) ; methodBuilder . addStatement ( "$L.remove($S)" , editorName , property . getPreferenceKey ( ) ) ; methodBuilder . endControlFlow ( ) ; } else { methodBuilder . addStatement ( "$L.putStringSet($S," + tempPre + "$L" + tempPost + ")" , editorName , property . getPreferenceKey ( ) , getter ( beanName , beanClass , property ) ) ; } }
/* (non-Javadoc)
@see com.abubusoft.kripton.processor.sharedprefs.transform.AbstractGeneratedPrefsTransform#generateWriteProperty(com.squareup.javapoet.MethodSpec.Builder, java.lang.String, com.squareup.javapoet.TypeName, java.lang.String, com.abubusoft.kripton.processor.sharedprefs.model.PrefsProperty)