org.eclipse.e4.core.di_1.2.0.v20121024-173149

16:42:56.834 INFO  jd.cli.Main - Decompiling org.eclipse.e4.core.di_1.2.0.v20121024-173149.jar
package org.eclipse.e4.core.di;

public abstract interface IBinding
{
  public abstract IBinding named(String paramString);
  
  public abstract IBinding implementedBy(Class<?> paramClass);
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.di.IBinding
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.di;

import java.lang.annotation.Annotation;
import org.eclipse.e4.core.di.suppliers.PrimaryObjectSupplier;

public abstract interface IInjector
{
  public static final Object NOT_A_VALUE = new Object();
  
  public abstract void inject(Object paramObject, PrimaryObjectSupplier paramPrimaryObjectSupplier)
    throws InjectionException;
  
  public abstract void uninject(Object paramObject, PrimaryObjectSupplier paramPrimaryObjectSupplier)
    throws InjectionException;
  
  public abstract Object invoke(Object paramObject, Class<? extends Annotation> paramClass, PrimaryObjectSupplier paramPrimaryObjectSupplier)
    throws InjectionException;
  
  public abstract Object invoke(Object paramObject1, Class<? extends Annotation> paramClass, Object paramObject2, PrimaryObjectSupplier paramPrimaryObjectSupplier)
    throws InjectionException;
  
  public abstract Object invoke(Object paramObject1, Class<? extends Annotation> paramClass, Object paramObject2, PrimaryObjectSupplier paramPrimaryObjectSupplier1, PrimaryObjectSupplier paramPrimaryObjectSupplier2)
    throws InjectionException;
  
  public abstract <T> T make(Class<T> paramClass, PrimaryObjectSupplier paramPrimaryObjectSupplier)
    throws InjectionException;
  
  public abstract <T> T make(Class<T> paramClass, PrimaryObjectSupplier paramPrimaryObjectSupplier1, PrimaryObjectSupplier paramPrimaryObjectSupplier2)
    throws InjectionException;
  
  public abstract IBinding addBinding(Class<?> paramClass);
  
  public abstract IBinding addBinding(IBinding paramIBinding);
  
  public abstract void setDefaultSupplier(PrimaryObjectSupplier paramPrimaryObjectSupplier);
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.di.IInjector
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.di;

public class InjectionException
  extends RuntimeException
{
  private static final long serialVersionUID = 3098545573510654907L;
  
  public InjectionException() {}
  
  public InjectionException(Throwable e)
  {
    super(e);
  }
  
  public InjectionException(String msg)
  {
    super(msg);
  }
  
  public InjectionException(String msg, Throwable e)
  {
    super(msg, e);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.di.InjectionException
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.di;

import org.eclipse.e4.core.internal.di.InjectorImpl;

public final class InjectorFactory
{
  private static IInjector injector = new InjectorImpl();
  
  public static IInjector getDefault()
  {
    return injector;
  }
  
  public static IInjector makeInjector()
  {
    return new InjectorImpl();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.di.InjectorFactory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.di.annotations;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Documented
@Target({java.lang.annotation.ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface CanExecute {}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.di.annotations.CanExecute
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.di.annotations;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.inject.Qualifier;

@Qualifier
@Documented
@Target({java.lang.annotation.ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface Creatable
{
  String value() default "";
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.di.annotations.Creatable
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.di.annotations;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Documented
@Target({java.lang.annotation.ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface Execute {}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.di.annotations.Execute
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.di.annotations;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Documented
@Target({java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface GroupUpdates {}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.di.annotations.GroupUpdates
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.di.annotations;

import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.inject.Qualifier;

@Qualifier
@Documented
@Target({java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
public @interface Optional {}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.di.annotations.Optional
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.di.suppliers;

public abstract class ExtendedObjectSupplier
{
  public static final String SERVICE_NAME = ExtendedObjectSupplier.class.getName();
  public static final String SERVICE_CONTEXT_KEY = "dependency.injection.annotation";
  
  public abstract Object get(IObjectDescriptor paramIObjectDescriptor, IRequestor paramIRequestor, boolean paramBoolean1, boolean paramBoolean2);
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.di.suppliers.ExtendedObjectSupplier
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.di.suppliers;

import java.lang.annotation.Annotation;
import java.lang.reflect.Type;

public abstract interface IObjectDescriptor
{
  public abstract Type getDesiredType();
  
  public abstract boolean hasQualifier(Class<? extends Annotation> paramClass);
  
  public abstract <T extends Annotation> T getQualifier(Class<T> paramClass);
  
  public abstract Annotation[] getQualifiers();
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.di.suppliers.IObjectDescriptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.di.suppliers;

import org.eclipse.e4.core.di.InjectionException;

public abstract interface IRequestor
{
  public abstract void resolveArguments(boolean paramBoolean)
    throws InjectionException;
  
  public abstract Object execute()
    throws InjectionException;
  
  public abstract Object getRequestingObject();
  
  public abstract Class<?> getRequestingObjectClass();
  
  public abstract boolean isValid();
  
  public abstract void disposed(PrimaryObjectSupplier paramPrimaryObjectSupplier)
    throws InjectionException;
  
  public abstract boolean uninject(Object paramObject, PrimaryObjectSupplier paramPrimaryObjectSupplier)
    throws InjectionException;
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.di.suppliers.IRequestor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.di.suppliers;

import java.lang.ref.WeakReference;

public abstract class PrimaryObjectSupplier
{
  public abstract void get(IObjectDescriptor[] paramArrayOfIObjectDescriptor, Object[] paramArrayOfObject, IRequestor paramIRequestor, boolean paramBoolean1, boolean paramBoolean2, boolean paramBoolean3);
  
  public abstract void pauseRecording();
  
  public abstract void resumeRecording();
  
  public WeakReference<Object> makeReference(Object object)
  {
    return new WeakReference(object);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.di.suppliers.PrimaryObjectSupplier
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.internal.di;

import org.eclipse.e4.core.di.IBinding;
import org.eclipse.e4.core.di.IInjector;

public class Binding
  implements IBinding
{
  private final Class<?> clazz;
  private final IInjector injector;
  private Class<?> implementationClazz;
  private String qualifierName;
  
  public Binding(Class<?> clazz, IInjector injector)
  {
    this.clazz = clazz;
    this.injector = injector;
  }
  
  private Binding(Binding source)
  {
    clazz = clazz;
    injector = injector;
    implementationClazz = implementationClazz;
    qualifierName = qualifierName;
  }
  
  public IBinding named(String name)
  {
    Binding binding = new Binding(this);
    qualifierName = name;
    injector.addBinding(binding);
    return binding;
  }
  
  public IBinding implementedBy(Class<?> implClazz)
  {
    Binding binding = new Binding(this);
    implementationClazz = implClazz;
    injector.addBinding(binding);
    return binding;
  }
  
  public Class<?> getDescribedClass()
  {
    return clazz;
  }
  
  public String getQualifierName()
  {
    return qualifierName;
  }
  
  public Class<?> getImplementationClass()
  {
    if (implementationClazz != null) {
      return implementationClazz;
    }
    return clazz;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.internal.di.Binding
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.internal.di;

import java.lang.reflect.Field;
import javax.inject.Named;
import org.eclipse.e4.core.di.IInjector;
import org.eclipse.e4.core.di.InjectionException;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.core.di.suppliers.IObjectDescriptor;
import org.eclipse.e4.core.di.suppliers.PrimaryObjectSupplier;

public class ClassRequestor
  extends Requestor
{
  @Optional
  @Named("e4.internal.injectionLink")
  public static final String pseudoVariable = null;
  private final String clazzName;
  
  public ClassRequestor(Class<?> clazz, IInjector injector, PrimaryObjectSupplier primarySupplier, PrimaryObjectSupplier tempSupplier, Object requestingObject, boolean track)
  {
    super(null, injector, primarySupplier, tempSupplier, requestingObject, track);
    clazzName = (clazz == null ? null : clazz.getSimpleName());
  }
  
  public Object execute()
    throws InjectionException
  {
    clearResolvedArgs();
    return null;
  }
  
  public IObjectDescriptor[] calcDependentObjects()
  {
    Field field = null;
    try
    {
      field = ClassRequestor.class.getField("pseudoVariable");
    }
    catch (SecurityException e)
    {
      e.printStackTrace();
      return null;
    }
    catch (NoSuchFieldException e)
    {
      e.printStackTrace();
      return null;
    }
    return new IObjectDescriptor[] { new ObjectDescriptor(field.getGenericType(), field.getAnnotations()) };
  }
  
  public String toString()
  {
    StringBuffer tmp = new StringBuffer();
    if (clazzName != null) {
      tmp.append(clazzName);
    }
    tmp.append('.');
    tmp.append(pseudoVariable);
    return tmp.toString();
  }
  
  public int hashCode()
  {
    int result = super.hashCode();
    result = 31 * result + (clazzName == null ? 0 : clazzName.hashCode());
    return result;
  }
  
  public boolean equals(Object obj)
  {
    if (this == obj) {
      return true;
    }
    if (!super.equals(obj)) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }
    ClassRequestor other = (ClassRequestor)obj;
    if (clazzName == null)
    {
      if (clazzName != null) {
        return false;
      }
    }
    else if (!clazzName.equals(clazzName)) {
      return false;
    }
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.internal.di.ClassRequestor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.internal.di;

import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Type;
import org.eclipse.e4.core.di.IInjector;
import org.eclipse.e4.core.di.suppliers.IObjectDescriptor;
import org.eclipse.e4.core.di.suppliers.PrimaryObjectSupplier;

public class ConstructorRequestor
  extends Requestor
{
  private final Constructor<?> constructor;
  
  public ConstructorRequestor(Constructor<?> constructor, IInjector injector, PrimaryObjectSupplier primarySupplier, PrimaryObjectSupplier tempSupplier)
  {
    super(null, injector, primarySupplier, tempSupplier, null, false);
    this.constructor = constructor;
  }
  
  /* Error */
  public Object execute()
    throws org.eclipse.e4.core.di.InjectionException
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_1
    //   2: iconst_1
    //   3: istore_2
    //   4: aload_0
    //   5: getfield 156	org/eclipse/e4/core/internal/di/ConstructorRequestor:constructor	Ljava/lang/reflect/Constructor;
    //   8: invokevirtual 169	java/lang/reflect/Constructor:isAccessible	()Z
    //   11: ifne +13 -> 24
    //   14: aload_0
    //   15: getfield 156	org/eclipse/e4/core/internal/di/ConstructorRequestor:constructor	Ljava/lang/reflect/Constructor;
    //   18: iconst_1
    //   19: invokevirtual 170	java/lang/reflect/Constructor:setAccessible	(Z)V
    //   22: iconst_0
    //   23: istore_2
    //   24: iconst_0
    //   25: istore_3
    //   26: aload_0
    //   27: getfield 157	org/eclipse/e4/core/internal/di/ConstructorRequestor:primarySupplier	Lorg/eclipse/e4/core/di/suppliers/PrimaryObjectSupplier;
    //   30: ifnull +12 -> 42
    //   33: aload_0
    //   34: getfield 157	org/eclipse/e4/core/internal/di/ConstructorRequestor:primarySupplier	Lorg/eclipse/e4/core/di/suppliers/PrimaryObjectSupplier;
    //   37: invokevirtual 180	org/eclipse/e4/core/di/suppliers/PrimaryObjectSupplier:pauseRecording	()V
    //   40: iconst_1
    //   41: istore_3
    //   42: aload_0
    //   43: getfield 156	org/eclipse/e4/core/internal/di/ConstructorRequestor:constructor	Ljava/lang/reflect/Constructor;
    //   46: aload_0
    //   47: getfield 155	org/eclipse/e4/core/internal/di/ConstructorRequestor:actualArgs	[Ljava/lang/Object;
    //   50: invokevirtual 176	java/lang/reflect/Constructor:newInstance	([Ljava/lang/Object;)Ljava/lang/Object;
    //   53: astore_1
    //   54: goto +119 -> 173
    //   57: astore 4
    //   59: new 81	org/eclipse/e4/core/di/InjectionException
    //   62: dup
    //   63: aload 4
    //   65: invokespecial 178	org/eclipse/e4/core/di/InjectionException:<init>	(Ljava/lang/Throwable;)V
    //   68: athrow
    //   69: astore 4
    //   71: new 81	org/eclipse/e4/core/di/InjectionException
    //   74: dup
    //   75: new 76	java/lang/StringBuilder
    //   78: dup
    //   79: ldc 1
    //   81: invokespecial 165	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
    //   84: aload_0
    //   85: getfield 156	org/eclipse/e4/core/internal/di/ConstructorRequestor:constructor	Ljava/lang/reflect/Constructor;
    //   88: invokevirtual 166	java/lang/StringBuilder:append	(Ljava/lang/Object;)Ljava/lang/StringBuilder;
    //   91: invokevirtual 164	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   94: aload 4
    //   96: invokespecial 179	org/eclipse/e4/core/di/InjectionException:<init>	(Ljava/lang/String;Ljava/lang/Throwable;)V
    //   99: athrow
    //   100: astore 4
    //   102: new 81	org/eclipse/e4/core/di/InjectionException
    //   105: dup
    //   106: aload 4
    //   108: invokespecial 178	org/eclipse/e4/core/di/InjectionException:<init>	(Ljava/lang/Throwable;)V
    //   111: athrow
    //   112: astore 4
    //   114: aload 4
    //   116: invokevirtual 177	java/lang/reflect/InvocationTargetException:getCause	()Ljava/lang/Throwable;
    //   119: astore 5
    //   121: new 81	org/eclipse/e4/core/di/InjectionException
    //   124: dup
    //   125: aload 5
    //   127: ifnull +8 -> 135
    //   130: aload 5
    //   132: goto +5 -> 137
    //   135: aload 4
    //   137: invokespecial 178	org/eclipse/e4/core/di/InjectionException:<init>	(Ljava/lang/Throwable;)V
    //   140: athrow
    //   141: astore 6
    //   143: iload_2
    //   144: ifne +11 -> 155
    //   147: aload_0
    //   148: getfield 156	org/eclipse/e4/core/internal/di/ConstructorRequestor:constructor	Ljava/lang/reflect/Constructor;
    //   151: iconst_0
    //   152: invokevirtual 170	java/lang/reflect/Constructor:setAccessible	(Z)V
    //   155: iload_3
    //   156: ifeq +10 -> 166
    //   159: aload_0
    //   160: getfield 157	org/eclipse/e4/core/internal/di/ConstructorRequestor:primarySupplier	Lorg/eclipse/e4/core/di/suppliers/PrimaryObjectSupplier;
    //   163: invokevirtual 181	org/eclipse/e4/core/di/suppliers/PrimaryObjectSupplier:resumeRecording	()V
    //   166: aload_0
    //   167: invokevirtual 182	org/eclipse/e4/core/internal/di/ConstructorRequestor:clearResolvedArgs	()V
    //   170: aload 6
    //   172: athrow
    //   173: iload_2
    //   174: ifne +11 -> 185
    //   177: aload_0
    //   178: getfield 156	org/eclipse/e4/core/internal/di/ConstructorRequestor:constructor	Ljava/lang/reflect/Constructor;
    //   181: iconst_0
    //   182: invokevirtual 170	java/lang/reflect/Constructor:setAccessible	(Z)V
    //   185: iload_3
    //   186: ifeq +10 -> 196
    //   189: aload_0
    //   190: getfield 157	org/eclipse/e4/core/internal/di/ConstructorRequestor:primarySupplier	Lorg/eclipse/e4/core/di/suppliers/PrimaryObjectSupplier;
    //   193: invokevirtual 181	org/eclipse/e4/core/di/suppliers/PrimaryObjectSupplier:resumeRecording	()V
    //   196: aload_0
    //   197: invokevirtual 182	org/eclipse/e4/core/internal/di/ConstructorRequestor:clearResolvedArgs	()V
    //   200: aload_1
    //   201: areturn
    // Line number table:
    //   Java source line #32	-> byte code offset #0
    //   Java source line #33	-> byte code offset #2
    //   Java source line #34	-> byte code offset #4
    //   Java source line #35	-> byte code offset #14
    //   Java source line #36	-> byte code offset #22
    //   Java source line #38	-> byte code offset #24
    //   Java source line #39	-> byte code offset #26
    //   Java source line #40	-> byte code offset #33
    //   Java source line #41	-> byte code offset #40
    //   Java source line #44	-> byte code offset #42
    //   Java source line #45	-> byte code offset #57
    //   Java source line #46	-> byte code offset #59
    //   Java source line #47	-> byte code offset #69
    //   Java source line #48	-> byte code offset #71
    //   Java source line #49	-> byte code offset #100
    //   Java source line #50	-> byte code offset #102
    //   Java source line #51	-> byte code offset #112
    //   Java source line #52	-> byte code offset #114
    //   Java source line #53	-> byte code offset #121
    //   Java source line #54	-> byte code offset #141
    //   Java source line #55	-> byte code offset #143
    //   Java source line #56	-> byte code offset #147
    //   Java source line #57	-> byte code offset #155
    //   Java source line #58	-> byte code offset #159
    //   Java source line #59	-> byte code offset #166
    //   Java source line #60	-> byte code offset #170
    //   Java source line #55	-> byte code offset #173
    //   Java source line #56	-> byte code offset #177
    //   Java source line #57	-> byte code offset #185
    //   Java source line #58	-> byte code offset #189
    //   Java source line #59	-> byte code offset #196
    //   Java source line #61	-> byte code offset #200
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	202	0	this	ConstructorRequestor
    //   1	200	1	result	Object
    //   3	171	2	wasAccessible	boolean
    //   25	161	3	pausedRecording	boolean
    //   57	7	4	e	IllegalArgumentException
    //   69	26	4	e	InstantiationException
    //   100	7	4	e	IllegalAccessException
    //   112	24	4	e	java.lang.reflect.InvocationTargetException
    //   119	12	5	originalException	Throwable
    //   141	30	6	localObject1	Object
    // Exception table:
    //   from	to	target	type
    //   42	54	57	java/lang/IllegalArgumentException
    //   42	54	69	java/lang/InstantiationException
    //   42	54	100	java/lang/IllegalAccessException
    //   42	54	112	java/lang/reflect/InvocationTargetException
    //   42	141	141	finally
  }
  
  public IObjectDescriptor[] calcDependentObjects()
  {
    Annotation[][] annotations = constructor.getParameterAnnotations();
    Type[] logicalParams = constructor.getGenericParameterTypes();
    
    Class[] compilerParams = constructor.getParameterTypes();
    if (compilerParams.length > logicalParams.length)
    {
      Type[] tmp = new Type[compilerParams.length];
      System.arraycopy(compilerParams, 0, tmp, 0, compilerParams.length - logicalParams.length);
      System.arraycopy(logicalParams, 0, tmp, compilerParams.length - logicalParams.length, logicalParams.length);
      logicalParams = tmp;
    }
    IObjectDescriptor[] descriptors = new IObjectDescriptor[logicalParams.length];
    for (int i = 0; i < logicalParams.length; i++) {
      descriptors[i] = new ObjectDescriptor(logicalParams[i], annotations[i]);
    }
    return descriptors;
  }
  
  public Class<?> getRequestingObjectClass()
  {
    return constructor.getDeclaringClass();
  }
  
  public String toString()
  {
    StringBuffer tmp = new StringBuffer();
    Object object = getRequestingObject();
    if (object != null) {
      tmp.append(object.getClass().getSimpleName());
    } else {
      tmp.append(constructor.getDeclaringClass().getSimpleName());
    }
    tmp.append('(');
    tmp.append(')');
    return tmp.toString();
  }
  
  public int hashCode()
  {
    int result = super.hashCode();
    result = 31 * result + (constructor == null ? 0 : constructor.hashCode());
    return result;
  }
  
  public boolean equals(Object obj)
  {
    if (this == obj) {
      return true;
    }
    if (!super.equals(obj)) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }
    ConstructorRequestor other = (ConstructorRequestor)obj;
    if (constructor == null)
    {
      if (constructor != null) {
        return false;
      }
    }
    else if (!constructor.equals(constructor)) {
      return false;
    }
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.internal.di.ConstructorRequestor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.internal.di;

import java.lang.reflect.Field;
import org.eclipse.e4.core.di.IInjector;
import org.eclipse.e4.core.di.InjectionException;
import org.eclipse.e4.core.di.suppliers.IObjectDescriptor;
import org.eclipse.e4.core.di.suppliers.PrimaryObjectSupplier;

public class FieldRequestor
  extends Requestor
{
  private final Field field;
  
  public FieldRequestor(Field field, IInjector injector, PrimaryObjectSupplier primarySupplier, PrimaryObjectSupplier tempSupplier, Object requestingObject, boolean track)
  {
    super(field, injector, primarySupplier, tempSupplier, requestingObject, track);
    this.field = field;
  }
  
  public Object execute()
    throws InjectionException
  {
    if (actualArgs == null) {
      return null;
    }
    setField(field, actualArgs[0]);
    clearResolvedArgs();
    return null;
  }
  
  protected IObjectDescriptor[] calcDependentObjects()
  {
    IObjectDescriptor objectDescriptor = new ObjectDescriptor(field.getGenericType(), field.getAnnotations());
    return new IObjectDescriptor[] { objectDescriptor };
  }
  
  /* Error */
  private boolean setField(Field field, Object value)
    throws InjectionException
  {
    // Byte code:
    //   0: aload_0
    //   1: invokevirtual 130	org/eclipse/e4/core/internal/di/FieldRequestor:getRequestingObject	()Ljava/lang/Object;
    //   4: astore_3
    //   5: aload_3
    //   6: ifnonnull +5 -> 11
    //   9: iconst_0
    //   10: ireturn
    //   11: iconst_1
    //   12: istore 4
    //   14: aload_1
    //   15: invokevirtual 121	java/lang/reflect/Field:isAccessible	()Z
    //   18: ifne +11 -> 29
    //   21: aload_1
    //   22: iconst_1
    //   23: invokevirtual 122	java/lang/reflect/Field:setAccessible	(Z)V
    //   26: iconst_0
    //   27: istore 4
    //   29: aload_1
    //   30: aload_3
    //   31: aload_2
    //   32: invokevirtual 127	java/lang/reflect/Field:set	(Ljava/lang/Object;Ljava/lang/Object;)V
    //   35: goto +42 -> 77
    //   38: astore 5
    //   40: new 60	org/eclipse/e4/core/di/InjectionException
    //   43: dup
    //   44: aload 5
    //   46: invokespecial 128	org/eclipse/e4/core/di/InjectionException:<init>	(Ljava/lang/Throwable;)V
    //   49: athrow
    //   50: astore 5
    //   52: new 60	org/eclipse/e4/core/di/InjectionException
    //   55: dup
    //   56: aload 5
    //   58: invokespecial 128	org/eclipse/e4/core/di/InjectionException:<init>	(Ljava/lang/Throwable;)V
    //   61: athrow
    //   62: astore 6
    //   64: iload 4
    //   66: ifne +8 -> 74
    //   69: aload_1
    //   70: iconst_0
    //   71: invokevirtual 122	java/lang/reflect/Field:setAccessible	(Z)V
    //   74: aload 6
    //   76: athrow
    //   77: iload 4
    //   79: ifne +8 -> 87
    //   82: aload_1
    //   83: iconst_0
    //   84: invokevirtual 122	java/lang/reflect/Field:setAccessible	(Z)V
    //   87: iconst_1
    //   88: ireturn
    // Line number table:
    //   Java source line #42	-> byte code offset #0
    //   Java source line #43	-> byte code offset #5
    //   Java source line #44	-> byte code offset #9
    //   Java source line #45	-> byte code offset #11
    //   Java source line #46	-> byte code offset #14
    //   Java source line #47	-> byte code offset #21
    //   Java source line #48	-> byte code offset #26
    //   Java source line #51	-> byte code offset #29
    //   Java source line #52	-> byte code offset #38
    //   Java source line #53	-> byte code offset #40
    //   Java source line #54	-> byte code offset #50
    //   Java source line #55	-> byte code offset #52
    //   Java source line #56	-> byte code offset #62
    //   Java source line #57	-> byte code offset #64
    //   Java source line #58	-> byte code offset #69
    //   Java source line #59	-> byte code offset #74
    //   Java source line #57	-> byte code offset #77
    //   Java source line #58	-> byte code offset #82
    //   Java source line #60	-> byte code offset #87
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	89	0	this	FieldRequestor
    //   0	89	1	field	Field
    //   0	89	2	value	Object
    //   4	27	3	userObject	Object
    //   12	66	4	wasAccessible	boolean
    //   38	7	5	e	IllegalArgumentException
    //   50	7	5	e	IllegalAccessException
    //   62	13	6	localObject1	Object
    // Exception table:
    //   from	to	target	type
    //   29	35	38	java/lang/IllegalArgumentException
    //   29	35	50	java/lang/IllegalAccessException
    //   29	62	62	finally
  }
  
  public String toString()
  {
    StringBuffer tmp = new StringBuffer();
    Object object = getRequestingObject();
    if (object != null) {
      tmp.append(object.getClass().getSimpleName());
    }
    tmp.append('.');
    tmp.append(field.getName());
    return tmp.toString();
  }
  
  public int hashCode()
  {
    int result = super.hashCode();
    result = 31 * result + (field == null ? 0 : field.hashCode());
    return result;
  }
  
  public boolean equals(Object obj)
  {
    if (this == obj) {
      return true;
    }
    if (!super.equals(obj)) {
      return false;
    }
    if (getClass() != obj.getClass()) {
      return false;
    }
    FieldRequestor other = (FieldRequestor)obj;
    if (field == null)
    {
      if (field != null) {
        return false;
      }
    }
    else if (!field.equals(field)) {
      return false;
    }
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.internal.di.FieldRequestor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.internal.di;

import java.lang.reflect.Constructor;
import java.util.Comparator;

class InjectorImpl$1
  implements Comparator<Constructor<?>>
{
  InjectorImpl$1(InjectorImpl paramInjectorImpl) {}
  
  public int compare(Constructor<?> c1, Constructor<?> c2)
  {
    int l1 = c1.getParameterTypes().length;
    int l2 = c2.getParameterTypes().length;
    return l2 - l1;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.e4.core.internal.di.InjectorImpl.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.e4.core.internal.di;

import java.lang.annotation.Annotation;
import java.lang.ref.WeakReference;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;
import javax.inject.Singleton;
import org.eclipse.e4.core.di.IBinding;
import org.eclipse.e4.core.di.IInjector;
import org.eclipse.e4.core.di.InjectionException;
import org.eclipse.e4.core.di.annotations.Creatable;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.core.di.suppliers.ExtendedObjectSupplier;
import org.eclipse.e4.core.di.suppliers.IObjectDescriptor;
import org.eclipse.e4.core.di.suppliers.IRequestor;
import org.eclipse.e4.core.di.suppliers.PrimaryObjectSupplier;
import org.eclipse.e4.core.internal.di.osgi.DIActivator;
import org.eclipse.e4.core.internal.di.osgi.LogHelper;
import org.eclipse.e4.core.internal.di.osgi.ProviderHelper;

public class InjectorImpl
  implements IInjector
{
  private static final String DEBUG_INJECTION = "org.eclipse.e4.core.di/debug/injector";
  private static final boolean shouldDebug = DIActivator.getDefault().getBooleanDebugOption("org.eclipse.e4.core.di/debug/injector", false);
  private static final String JAVA_OBJECT = "java.lang.Object";
  private static final Boolean DEFAULT_BOOLEAN = new Boolean(false);
  private static final Integer DEFAULT_INTEGER = new Integer(0);
  private static final Character DEFAULT_CHAR = new Character('\000');
  private static final Float DEFAULT_FLOAT = new Float(0.0F);
  private static final Double DEFAULT_DOUBLE = new Double(0.0D);
  private static final Long DEFAULT_LONG = new Long(0L);
  private static final Short DEFAULT_SHORT = new Short((short)0);
  private static final Byte DEFAULT_BYTE = new Byte((byte)0);
  private Map<PrimaryObjectSupplier, List<WeakReference<?>>> injectedObjects = new HashMap();
  private Set<WeakReference<Class<?>>> injectedClasses = new HashSet();
  private HashMap<Class<?>, Object> singletonCache = new HashMap();
  private Map<Class<?>, Set<Binding>> bindings = new HashMap();
  private Map<Class<?>, Method[]> methodsCache = new WeakHashMap();
  private Map<Class<?>, Map<Method, Boolean>> isOverriddenCache = new WeakHashMap();
  private Set<Class<?>> classesBeingCreated = new HashSet(5);
  private PrimaryObjectSupplier defaultSupplier;
  
  public void inject(Object object, PrimaryObjectSupplier objectSupplier)
  {
    inject(object, objectSupplier, null);
  }
  
  public void inject(Object object, PrimaryObjectSupplier objectSupplier, PrimaryObjectSupplier tempSupplier)
  {
    ArrayList<Requestor> requestors = new ArrayList();
    processClassHierarchy(object, objectSupplier, tempSupplier, true, true, requestors);
    
    boolean haveLink = false;
    for (Requestor requestor : requestors) {
      if (requestor.shouldTrack()) {
        haveLink = true;
      }
    }
    if (!haveLink) {
      requestors.add(new ClassRequestor(object.getClass(), this, objectSupplier, tempSupplier, object, true));
    }
    resolveRequestorArgs(requestors, objectSupplier, tempSupplier, false, true, true);
    for (Requestor requestor : requestors) {
      if (requestor.isResolved()) {
        requestor.execute();
      }
    }
    rememberInjectedObject(object, objectSupplier);
    
    processAnnotated(PostConstruct.class, object, object.getClass(), objectSupplier, tempSupplier, new ArrayList(5));
    for (Requestor requestor : requestors) {
      requestor.clearTempSupplier();
    }
  }
  
  private void rememberInjectedObject(Object object, PrimaryObjectSupplier objectSupplier)
  {
    synchronized (injectedObjects)
    {
      List<WeakReference<?>> list;
      if (!injectedObjects.containsKey(objectSupplier))
      {
        List<WeakReference<?>> list = new ArrayList();
        injectedObjects.put(objectSupplier, list);
      }
      else
      {
        list = (List)injectedObjects.get(objectSupplier);
      }
      for (WeakReference<?> ref : list) {
        if (object == ref.get()) {
          return;
        }
      }
      list.add(new WeakReference(object));
    }
  }
  
  private boolean forgetInjectedObject(Object object, PrimaryObjectSupplier objectSupplier)
  {
    synchronized (injectedObjects)
    {
      if (!injectedObjects.containsKey(objectSupplier)) {
        return false;
      }
      List<WeakReference<?>> list = (List)injectedObjects.get(objectSupplier);
      for (Iterator<WeakReference<?>> i = list.iterator(); i.hasNext();)
      {
        WeakReference<?> ref = (WeakReference)i.next();
        if (object == ref.get())
        {
          i.remove();
          return true;
        }
      }
      return false;
    }
  }
  
  private List<WeakReference<?>> forgetSupplier(PrimaryObjectSupplier objectSupplier)
  {
    synchronized (injectedObjects)
    {
      if (!injectedObjects.containsKey(objectSupplier)) {
        return null;
      }
      return (List)injectedObjects.remove(objectSupplier);
    }
  }
  
  private List<WeakReference<?>> getSupplierObjects(PrimaryObjectSupplier objectSupplier)
  {
    synchronized (injectedObjects)
    {
      if (!injectedObjects.containsKey(objectSupplier)) {
        return null;
      }
      return (List)injectedObjects.get(objectSupplier);
    }
  }
  
  public void uninject(Object object, PrimaryObjectSupplier objectSupplier)
  {
    if (!forgetInjectedObject(object, objectSupplier)) {
      return;
    }
    processAnnotated(PreDestroy.class, object, object.getClass(), objectSupplier, null, new ArrayList(5));
    
    ArrayList<Requestor> requestors = new ArrayList();
    processClassHierarchy(object, objectSupplier, null, true, false, requestors);
    for (Requestor requestor : requestors)
    {
      Object[] actualArgs = resolveArgs(requestor, null, null, true, false, false);
      int unresolved = unresolved(actualArgs);
      if (unresolved == -1)
      {
        requestor.setResolvedArgs(actualArgs);
        requestor.execute();
      }
      else if (requestor.isOptional())
      {
        requestor.setResolvedArgs(null);
      }
      else if (shouldDebug)
      {
        StringBuffer tmp = new StringBuffer();
        tmp.append("Uninjecting object \"");
        tmp.append(object.toString());
        tmp.append("\": dependency on \"");
        tmp.append(requestor.getDependentObjects()[unresolved].toString());
        tmp.append("\" is not optional.");
        LogHelper.logError(tmp.toString(), null);
      }
    }
  }
  
  public Object invoke(Object object, Class<? extends Annotation> qualifier, PrimaryObjectSupplier objectSupplier)
  {
    Object result = invokeUsingClass(object, object.getClass(), qualifier, IInjector.NOT_A_VALUE, objectSupplier, null, true);
    if (result == IInjector.NOT_A_VALUE) {
      throw new InjectionException("Unable to find matching method to invoke");
    }
    return result;
  }
  
  public Object invoke(Object object, Class<? extends Annotation> qualifier, Object defaultValue, PrimaryObjectSupplier objectSupplier)
  {
    return invokeUsingClass(object, object.getClass(), qualifier, defaultValue, objectSupplier, null, false);
  }
  
  public Object invoke(Object object, Class<? extends Annotation> qualifier, Object defaultValue, PrimaryObjectSupplier objectSupplier, PrimaryObjectSupplier localSupplier)
  {
    return invokeUsingClass(object, object.getClass(), qualifier, defaultValue, objectSupplier, localSupplier, false);
  }
  
  private Object invokeUsingClass(Object userObject, Class<?> currentClass, Class<? extends Annotation> qualifier, Object defaultValue, PrimaryObjectSupplier objectSupplier, PrimaryObjectSupplier tempSupplier, boolean throwUnresolved)
  {
    Method[] methods = getDeclaredMethods(currentClass);
    for (int j = 0; j < methods.length; j++)
    {
      Method method = methods[j];
      if (method.getAnnotation(qualifier) != null)
      {
        MethodRequestor requestor = new MethodRequestor(method, this, objectSupplier, tempSupplier, userObject, false);
        
        Object[] actualArgs = resolveArgs(requestor, objectSupplier, tempSupplier, false, true, false);
        int unresolved = unresolved(actualArgs);
        if (unresolved != -1)
        {
          if (throwUnresolved) {
            reportUnresolvedArgument(requestor, unresolved);
          }
        }
        else
        {
          requestor.setResolvedArgs(actualArgs);
          return requestor.execute();
        }
      }
    }
    Class<?> superClass = currentClass.getSuperclass();
    if (superClass == null) {
      return defaultValue;
    }
    return invokeUsingClass(userObject, superClass, qualifier, defaultValue, objectSupplier, tempSupplier, throwUnresolved);
  }
  
  public <T> T make(Class<T> clazz, PrimaryObjectSupplier objectSupplier)
  {
    Class<?> implementationClass = getImplementationClass(clazz);
    return (T)clazz.cast(internalMake(implementationClass, objectSupplier, null));
  }
  
  private Class<?> getImplementationClass(Class<?> clazz)
  {
    IObjectDescriptor descriptor = new ObjectDescriptor(clazz, null);
    Binding binding = findBinding(descriptor);
    if (binding == null) {
      return getDesiredClass(descriptor.getDesiredType());
    }
    return binding.getImplementationClass();
  }
  
  public <T> T make(Class<T> clazz, PrimaryObjectSupplier objectSupplier, PrimaryObjectSupplier staticSupplier)
  {
    Class<?> implementationClass = getImplementationClass(clazz);
    return (T)clazz.cast(internalMake(implementationClass, objectSupplier, staticSupplier));
  }
  
  public Object makeFromProvider(IObjectDescriptor descriptor, PrimaryObjectSupplier objectSupplier)
  {
    Binding binding = findBinding(descriptor);
    Class<?> implementationClass;
    Class<?> implementationClass;
    if (binding == null) {
      implementationClass = getProviderType(descriptor.getDesiredType());
    } else {
      implementationClass = binding.getImplementationClass();
    }
    if (objectSupplier != null)
    {
      IObjectDescriptor actualClass = new ObjectDescriptor(implementationClass, null);
      Object[] actualArgs = { IInjector.NOT_A_VALUE };
      objectSupplier.get(new IO
1 2 3

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd