private void addGetter ( final TypeSpec . Builder classBuilder , final String attributeName , final TypeName type ) { final String getterMethodName = "get" + attributeName . substring ( 0 , 1 ) . toUpperCase ( ) + attributeName . substring ( 1 ) ; final MethodSpec . Builder getterBuilder = MethodSpec . methodBuilder ( getterMethodName ) ; getterBuilder . returns ( type ) ; getterBuilder . addModifiers ( Modifier . PUBLIC ) ; getterBuilder . addCode ( "return this." + attributeName + ";" ) ; classBuilder . addMethod ( getterBuilder . build ( ) ) ; }
adds getter for field to class