// Path: Proton/src/main/java/proton/inject/internal/Element.java
// public static class ElementField {
//     public final Field field;
//     public final boolean isNoInject;
//     public final ElementFieldListener[] listeners;
// 
//     private ElementField(Field field, boolean isNoInject, ElementFieldListener[] listeners) {
//         this.field = field;
//         this.isNoInject = isNoInject;
//         this.listeners = listeners;
//     }
// 
//     public static class ElementFieldListener {
//         public final Annotation annotation;
//         public final FieldListener listener;
// 
//         private ElementFieldListener(Annotation annotation, FieldListener listener) {
//             this.annotation = annotation;
//             this.listener = listener;
//         }
// 
//     }
// }
// 
// Path: Proton/src/main/java/proton/inject/internal/Element.java
// public static class ElementFieldListener {
//     public final Annotation annotation;
//     public final FieldListener listener;
// 
//     private ElementFieldListener(Annotation annotation, FieldListener listener) {
//         this.annotation = annotation;
//         this.listener = listener;
//     }
// 
// }
// 
// Path: Proton/src/main/java/proton/inject/util/SparseClassArray.java
// public class SparseClassArray<T> {
//     private SparseArray<T> mArray = new SparseArray<T>();
// 
//     public void put(Class<?> key, T value) {
//         mArray.put(key.hashCode(), value);
//     }
// 
//     public T get(Class<?> key) {
//         return mArray.get(key.hashCode());
//     }
// 
//     public void remove(Class<?> key) {
//         mArray.remove(key.hashCode());
//     }
// 
//     public void clear() {
//         mArray.clear();
//     }
// }


import java.lang.annotation.Annotation;
import proton.inject.Injector;
import proton.inject.internal.Element.ElementField;
import proton.inject.internal.Element.ElementField.ElementFieldListener;
import proton.inject.util.SparseClassArray;
package proton.inject.listener;



public class FieldListeners {
    private SparseClassArray<FieldListener> mListeners = new SparseClassArray<FieldListener>();

    public void register(Class<? extends Annotation> annClass, FieldListener listener) {
        synchronized (this) {
            mListeners.put(annClass, listener);
        }
    }

    public void unregister(Class<? extends Annotation> annClass) {
        synchronized (this) {
            mListeners.remove(annClass);
        }
    }

    public FieldListener getListener(Class<?> clazz) {
        synchronized (this) {
            return mListeners.get(clazz);
        }
    }

    public void call(Injector injector, Object receiver, Class<? extends Annotation> scope, ElementField field) {
        if (field.listeners.length == 0)
            return;

        ElementFieldListener[] listeners = field.listeners;
// Path: Proton/src/main/java/proton/inject/internal/Element.java
// public static class ElementField {
//     public final Field field;
//     public final boolean isNoInject;
//     public final ElementFieldListener[] listeners;
// 
//     private ElementField(Field field, boolean isNoInject, ElementFieldListener[] listeners) {
//         this.field = field;
//         this.isNoInject = isNoInject;
//         this.listeners = listeners;
//     }
// 
//     public static class ElementFieldListener {
//         public final Annotation annotation;
//         public final FieldListener listener;
// 
//         private ElementFieldListener(Annotation annotation, FieldListener listener) {
//             this.annotation = annotation;
//             this.listener = listener;
//         }
// 
//     }
// }
// 
// Path: Proton/src/main/java/proton/inject/internal/Element.java
// public static class ElementFieldListener {
//     public final Annotation annotation;
//     public final FieldListener listener;
// 
//     private ElementFieldListener(Annotation annotation, FieldListener listener) {
//         this.annotation = annotation;
//         this.listener = listener;
//     }
// 
// }
// 
// Path: Proton/src/main/java/proton/inject/util/SparseClassArray.java
// public class SparseClassArray<T> {
//     private SparseArray<T> mArray = new SparseArray<T>();
// 
//     public void put(Class<?> key, T value) {
//         mArray.put(key.hashCode(), value);
//     }
// 
//     public T get(Class<?> key) {
//         return mArray.get(key.hashCode());
//     }
// 
//     public void remove(Class<?> key) {
//         mArray.remove(key.hashCode());
//     }
// 
//     public void clear() {
//         mArray.clear();
//     }
// }


// Path: Proton/src/main/java/proton/inject/listener/FieldListeners.java
import java.lang.annotation.Annotation;
import proton.inject.Injector;
import proton.inject.internal.Element.ElementField;
import proton.inject.internal.Element.ElementField.ElementFieldListener;
import proton.inject.util.SparseClassArray;

package proton.inject.listener;



public class FieldListeners {
    private SparseClassArray<FieldListener> mListeners = new SparseClassArray<FieldListener>();

    public void register(Class<? extends Annotation> annClass, FieldListener listener) {
        synchronized (this) {
            mListeners.put(annClass, listener);
        }
    }

    public void unregister(Class<? extends Annotation> annClass) {
        synchronized (this) {
            mListeners.remove(annClass);
        }
    }

    public FieldListener getListener(Class<?> clazz) {
        synchronized (this) {
            return mListeners.get(clazz);
        }
    }

    public void call(Injector injector, Object receiver, Class<? extends Annotation> scope, ElementField field) {
        if (field.listeners.length == 0)
            return;

        ElementFieldListener[] listeners = field.listeners;
        for (ElementFieldListener listener : listeners)