Examples of ReflectiveCapabilityImplementationException


Examples of org.sonatype.nexus.capabilities.client.support.ReflectiveCapabilityImplementationException

          return Primitives.wrap(method.getReturnType())
              .getConstructor(String.class)
              .newInstance(value);
        }
        catch (final Exception e) {
          throw new ReflectiveCapabilityImplementationException(
              "Could not convert '" + value + "' to a " + method.getReturnType()
          );
        }
      }
      else if (args.length == 1) {
        delegate.withProperty(capabilityProperty.value(), args[0] == null ? null : args[0].toString());
        if (Void.TYPE.equals(method.getReturnType())) {
          return null;
        }
        if (method.getReturnType().isAssignableFrom(capabilityType)) {
          return proxy;
        }
        throw new ReflectiveCapabilityImplementationException("Could not reflectively implement " + method);
      }
      else {
        throw new ReflectiveCapabilityImplementationException(
            CapabilityProperty.class.getName() + " annotations are only allowed on setters and getters"
        );
      }
    }
    try {
      final Method actual = delegate.getClass().getMethod(method.getName(), method.getParameterTypes());
      final Object result = actual.invoke(delegate, args);
      if (method.getReturnType() != null && method.getReturnType().isAssignableFrom(capabilityType)) {
        return proxy;
      }
      return result;
    }
    catch (NoSuchMethodException e) {
      throw new ReflectiveCapabilityImplementationException("Could not reflectively implement " + method);
    }
    catch (InvocationTargetException e) {
      throw e.getTargetException();
    }
    catch (IllegalAccessException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.