Package org.springsource.loaded

Examples of org.springsource.loaded.CurrentLiveVersion


      }
      return refs;
    }

    private FieldRef fieldRef(ReloadableType rtype, FieldMember f) {
      CurrentLiveVersion clv = rtype.getLiveVersion();
      if (clv == null) {
        //Not yet reloaded... use original field (with fixed mods)
        try {
          Field jf = rtype.getClazz().getDeclaredField(f.getName());
          ReflectiveInterceptor.fixModifier(rtype.getLatestTypeDescriptor(), jf);
View Full Code Here


      // Since static methods don't change parameter lists, they just invoke the executor
      return new ReloadedTypeInvoker(declaringType, methodMember) {
        @Override
        public Object invoke(Object target, Object... params) throws IllegalArgumentException, IllegalAccessException,
            InvocationTargetException {
          CurrentLiveVersion clv = rtype.getLiveVersion();
          Method executor = clv.getExecutorMethod(methodMember);
          return executor.invoke(target, params);
        }
      };
    } else {
      // Non static method invokers need to add target as a first param
      return new ReloadedTypeInvoker(declaringType, methodMember) {
        @Override
        public Object invoke(Object target, Object... params) throws IllegalArgumentException, IllegalAccessException,
            InvocationTargetException {
          CurrentLiveVersion clv = rtype.getLiveVersion();
          Method executor = clv.getExecutorMethod(methodMember);
          if (params == null) {
            return executor.invoke(null, target);
          } else {
            Object[] ps = new Object[params.length + 1];
            System.arraycopy(params, 0, ps, 1, params.length);
View Full Code Here

    }
    ReloadableType rtype = getReloadableTypeIfHasBeenReloaded(clazz);
    if (rtype == null) {
      return clazz.getDeclaredAnnotations();
    }
    CurrentLiveVersion clv = rtype.getLiveVersion();
    return clv.getExecutorClass().getDeclaredAnnotations();
  }
View Full Code Here

        fixModifier(rtype, c);
        cs[i++] = c;
      }
      return Utils.arrayCopyOf(cs, i);
    } else {
      CurrentLiveVersion liveVersion = rtype.getLiveVersion();
      // Reloaded type
      Constructor<?>[] clazzCs = null;
      TypeDescriptor desc = rtype.getLatestTypeDescriptor();
      MethodMember[] members = desc.getConstructors();
      Constructor<?>[] cs = new Constructor<?>[members.length];
      for (int i = 0; i < cs.length; i++) {
        MethodMember m = members[i];
        if (!liveVersion.hasConstructorChanged(m)) {
          if (clazzCs == null) {
            clazzCs = clazz.getDeclaredConstructors();
          }
          cs[i] = findConstructor(clazzCs, m);
          //           SpringLoaded changes modifiers, so must fix them
View Full Code Here

      fixModifier(rtype, c);
      return c;
    } else {

      // This would be the right thing to do but makes getDeclaredConstructors() very messy
      CurrentLiveVersion clv = rtype.getLiveVersion();
      boolean b = clv.hasConstructorChanged(Utils.toConstructorDescriptor(params));
      if (!b) {
        Constructor<?> c = clazz.getDeclaredConstructor(params);
        if (isMetaConstructor(clazz, c)) {
          // not a real constructor !
          throw Exceptions.noSuchConstructorException(clazz, params);
View Full Code Here

    if (rtype == null) {
      //Nothing special to be done
      return method.getDeclaredAnnotations();
    } else {
      // Method could have changed...
      CurrentLiveVersion clv = rtype.getLiveVersion();
      MethodMember methodMember = rtype.getCurrentMethod(method.getName(), Type.getMethodDescriptor(method));
      if (MethodMember.isCatcher(methodMember)) {
        if (clv.getExecutorMethod(methodMember) != null) {
          throw new IllegalStateException();
        }
        return method.getDeclaredAnnotations();
      }
      Method executor = clv.getExecutorMethod(methodMember);
      return executor.getAnnotations();
    }
  }
View Full Code Here

    if (rtype == null) {
      //Nothing special to be done
      return method.getParameterAnnotations();
    } else {
      // Method could have changed...
      CurrentLiveVersion clv = rtype.getLiveVersion();
      MethodMember currentMethod = rtype.getCurrentMethod(method.getName(), Type.getMethodDescriptor(method));
      Method executor = clv.getExecutorMethod(currentMethod);
      Annotation[][] result = executor.getParameterAnnotations();
      if (!currentMethod.isStatic()) {
        //Non=static methods have an extra param.
        //Though extra param is added to front...
        //Annotations aren't being moved so we have to actually drop the *last* array element
View Full Code Here

        c = asAccessibleConstructor(c, true);
        return c.newInstance(params);
      }
      asAccessibleConstructor(c, false);
      CurrentLiveVersion clv = rtype.getLiveVersion();
      Method executor = clv.getExecutorMethod(rtype.getCurrentConstructor(Type.getConstructorDescriptor(c)));
      Constructor<?> magicConstructor = clazz.getConstructor(C.class);
      Object instance = magicConstructor.newInstance((Object) null);

      Object[] instanceAndParams;
      if (params == null || params.length == 0) {
View Full Code Here

    if (rtype == null) {
      //Nothing special to be done
      return field.getDeclaredAnnotations();
    } else {
      // Field could have changed...
      CurrentLiveVersion clv = rtype.getLiveVersion();
      Field executor;
      try {
        executor = clv.getExecutorField(field.getName());
        return executor.getAnnotations();
      } catch (Exception e) {
        throw new IllegalStateException(e);
      }
    }
View Full Code Here

    if (rtype == null) {
      //Nothing special to be done
      return field.isAnnotationPresent(annotType);
    } else {
      // Field could have changed...
      CurrentLiveVersion clv = rtype.getLiveVersion();
      try {
        Field executor = clv.getExecutorField(field.getName());
        return executor.isAnnotationPresent(annotType);
      } catch (Exception e) {
        throw new IllegalStateException(e);
      }
    }
View Full Code Here

TOP

Related Classes of org.springsource.loaded.CurrentLiveVersion

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.