// Path: autobundle/src/main/java/com/yatatsu/autobundle/AutoBundle.java
// public class AutoBundle {
// 
//     private static AutoBundleDispatcher dispatcher = new AutoBundleBindingDispatcher();
// 
//     private AutoBundle() {
//         throw new AssertionError("no instances");
//     }
// 
//     /**
//      * assign to target fields from {@link Activity#getIntent()}
//      * @param activity target activity which has {@link AutoBundleField} annotated fields.
//      */
//     public static void bind(@NonNull Activity activity) {
//         bind(activity, activity.getIntent());
//     }
// 
//     /**
//      * assign to target fields from {@link Fragment#getArguments()}.
//      *
//      * target may be {@link Fragment} or compat.
//      *
//      * @param target target Fragment which has {@link AutoBundleField} annotated fields.
//      */
//     public static void bind(@NonNull Object target) {
//         try {
//             dispatcher.bind(target);
//         } catch (Exception e) {
//             throw new RuntimeException("AutoBundle cannot bind with " + target.getClass(), e);
//         }
//     }
// 
//     /**
//      * assign arguments to target fields.
//      *
//      * @param target target which has {@link AutoBundleField} annotated fields.
//      * @param args source bundle.
//      */
//     public static void bind(@NonNull Object target, @NonNull Bundle args) {
//         try {
//             dispatcher.bind(target, args);
//         } catch (Exception e) {
//             throw new RuntimeException("AutoBundle cannot bind with " + target.getClass(), e);
//         }
//     }
// 
//     /**
//      * assign to target fields from {@link Intent#getExtras()}.
//      *
//      * target may be {@link android.app.Activity},
//      * {@link android.content.BroadcastReceiver},
//      * {@link android.app.Service} or these compatibility class.
//      *
//      * @param target target which has {@link AutoBundleField} annotated fields.
//      * @param intent source bundle.
//      */
//     public static void bind(@NonNull Object target, @NonNull Intent intent) {
//         try {
//             if (intent.getExtras() != null) {
//                 dispatcher.bind(target, intent.getExtras());
//             }
//         } catch (Exception e) {
//             throw new RuntimeException("AutoBundle cannot bind with " + target.getClass(), e);
//         }
//     }
// 
//     /**
//      * set arguments from source fields.
//      *
//      * target may be {@link android.app.Activity},
//      * {@link android.content.BroadcastReceiver},
//      * {@link android.app.Service},
//      * {@link android.app.Fragment} or these compatibility class.
//      *
//      * @param source source instance which has {@link AutoBundleField} annotated fields.
//      * @param args target bundle.
//      */
//     public static void pack(@NonNull Object source, @NonNull Bundle args) {
//         try {
//             dispatcher.pack(source, args);
//         } catch (Exception e) {
//             throw new RuntimeException("AutoBundle cannot bind with " + source.getClass(), e);
//         }
//     }
// }
// 
// Path: autobundle-annotations/src/main/java/com/yatatsu/autobundle/AutoBundleConverter.java
// public interface AutoBundleConverter<Original, Stored> {
//     Stored convert(Original o);
//     Original original(Stored s);
// }


import android.app.Dialog;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.DialogFragment;
import androidx.appcompat.app.AlertDialog;
import com.yatatsu.autobundle.AutoBundle;
import com.yatatsu.autobundle.AutoBundleConverter;
import com.yatatsu.autobundle.AutoBundleField;
import java.util.Date;
package com.yatatsu.autobundle.example;




public class ExampleFragment extends DialogFragment {

    @AutoBundleField
    String title;

    @AutoBundleField(converter = DateArgConverter.class)
    Date targetDate;


    @NonNull
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        if (savedInstanceState != null) {
            // restore from savedInstanceState.
            AutoBundle.bind(this, savedInstanceState);
        } else {
            AutoBundle.bind(this);
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setTitle(title)
                .setMessage("date is " + targetDate.toString());
        // Create the AlertDialog object and return it
        return builder.create();
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        title = String.format("%s!", title);
        // store state
        AutoBundle.pack(this, outState);
    }

    public static class DateArgConverter implements AutoBundleConverter<Date, Long> {

        @Override
        public Long convert(Date o) {
// Path: autobundle/src/main/java/com/yatatsu/autobundle/AutoBundle.java
// public class AutoBundle {
// 
//     private static AutoBundleDispatcher dispatcher = new AutoBundleBindingDispatcher();
// 
//     private AutoBundle() {
//         throw new AssertionError("no instances");
//     }
// 
//     /**
//      * assign to target fields from {@link Activity#getIntent()}
//      * @param activity target activity which has {@link AutoBundleField} annotated fields.
//      */
//     public static void bind(@NonNull Activity activity) {
//         bind(activity, activity.getIntent());
//     }
// 
//     /**
//      * assign to target fields from {@link Fragment#getArguments()}.
//      *
//      * target may be {@link Fragment} or compat.
//      *
//      * @param target target Fragment which has {@link AutoBundleField} annotated fields.
//      */
//     public static void bind(@NonNull Object target) {
//         try {
//             dispatcher.bind(target);
//         } catch (Exception e) {
//             throw new RuntimeException("AutoBundle cannot bind with " + target.getClass(), e);
//         }
//     }
// 
//     /**
//      * assign arguments to target fields.
//      *
//      * @param target target which has {@link AutoBundleField} annotated fields.
//      * @param args source bundle.
//      */
//     public static void bind(@NonNull Object target, @NonNull Bundle args) {
//         try {
//             dispatcher.bind(target, args);
//         } catch (Exception e) {
//             throw new RuntimeException("AutoBundle cannot bind with " + target.getClass(), e);
//         }
//     }
// 
//     /**
//      * assign to target fields from {@link Intent#getExtras()}.
//      *
//      * target may be {@link android.app.Activity},
//      * {@link android.content.BroadcastReceiver},
//      * {@link android.app.Service} or these compatibility class.
//      *
//      * @param target target which has {@link AutoBundleField} annotated fields.
//      * @param intent source bundle.
//      */
//     public static void bind(@NonNull Object target, @NonNull Intent intent) {
//         try {
//             if (intent.getExtras() != null) {
//                 dispatcher.bind(target, intent.getExtras());
//             }
//         } catch (Exception e) {
//             throw new RuntimeException("AutoBundle cannot bind with " + target.getClass(), e);
//         }
//     }
// 
//     /**
//      * set arguments from source fields.
//      *
//      * target may be {@link android.app.Activity},
//      * {@link android.content.BroadcastReceiver},
//      * {@link android.app.Service},
//      * {@link android.app.Fragment} or these compatibility class.
//      *
//      * @param source source instance which has {@link AutoBundleField} annotated fields.
//      * @param args target bundle.
//      */
//     public static void pack(@NonNull Object source, @NonNull Bundle args) {
//         try {
//             dispatcher.pack(source, args);
//         } catch (Exception e) {
//             throw new RuntimeException("AutoBundle cannot bind with " + source.getClass(), e);
//         }
//     }
// }
// 
// Path: autobundle-annotations/src/main/java/com/yatatsu/autobundle/AutoBundleConverter.java
// public interface AutoBundleConverter<Original, Stored> {
//     Stored convert(Original o);
//     Original original(Stored s);
// }


// Path: example/src/main/java/com/yatatsu/autobundle/example/ExampleFragment.java
import android.app.Dialog;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.DialogFragment;
import androidx.appcompat.app.AlertDialog;
import com.yatatsu.autobundle.AutoBundle;
import com.yatatsu.autobundle.AutoBundleConverter;
import com.yatatsu.autobundle.AutoBundleField;
import java.util.Date;

package com.yatatsu.autobundle.example;




public class ExampleFragment extends DialogFragment {

    @AutoBundleField
    String title;

    @AutoBundleField(converter = DateArgConverter.class)
    Date targetDate;


    @NonNull
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        if (savedInstanceState != null) {
            // restore from savedInstanceState.
            AutoBundle.bind(this, savedInstanceState);
        } else {
            AutoBundle.bind(this);
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setTitle(title)
                .setMessage("date is " + targetDate.toString());
        // Create the AlertDialog object and return it
        return builder.create();
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        title = String.format("%s!", title);
        // store state
        AutoBundle.pack(this, outState);
    }

    public static class DateArgConverter implements AutoBundleConverter<Date, Long> {

        @Override
        public Long convert(Date o) {
            return o.getTime();