@Test public void testInterfaceWithBadSignature() throws Exception { Exception error = null; try { JavaService.fromClass(JavaInterfaceBadSig.class); } catch (Exception ex) { error = ex; } Assert.assertNotNull(JavaInterfaceBadSig.class.getName() + " shoud not be accepted as a valid ServiceInterface", error); }
public static JavaService fromClass(Class<?> serviceInterface) { HashSet<ServiceOperation> ops = new HashSet<ServiceOperation>(); Method[] methods = serviceInterface.isInterface() ? serviceInterface.getMethods() : serviceInterface.getDeclaredMethods(); for (Method m : methods) { if (Modifier.isPublic(m.getModifiers())) { Class<?>[] params = m.getParameterTypes(); if (params.length > 1) { throw APIMessages.MESSAGES.serviceOpNeedOneParamater(); } OperationTypeQNames operationTypeNames = new OperationTypeQNames(m); if (m.getReturnType().equals(Void.TYPE)) { ops.add(new InOnlyOperation(m.getName(), operationTypeNames.in())); } else { ops.add(new InOutOperation(m.getName(), operationTypeNames.in(), operationTypeNames.out(), operationTypeNames.fault())); } } } return new JavaService(ops, serviceInterface); }
JavaService extends BaseService { public static JavaService fromClass(Class<?> serviceInterface) { HashSet<ServiceOperation> ops = new HashSet<ServiceOperation>(); Method[] methods = serviceInterface.isInterface() ? serviceInterface.getMethods() : serviceInterface.getDeclaredMethods(); for (Method m : methods) { if (Modifier.isPublic(m.getModifiers())) { Class<?>[] params = m.getParameterTypes(); if (params.length > 1) { throw APIMessages.MESSAGES.serviceOpNeedOneParamater(); } OperationTypeQNames operationTypeNames = new OperationTypeQNames(m); if (m.getReturnType().equals(Void.TYPE)) { ops.add(new InOnlyOperation(m.getName(), operationTypeNames.in())); } else { ops.add(new InOutOperation(m.getName(), operationTypeNames.in(), operationTypeNames.out(), operationTypeNames.fault())); } } } return new JavaService(ops, serviceInterface); } }
JavaService extends BaseService { public static JavaService fromClass(Class<?> serviceInterface) { HashSet<ServiceOperation> ops = new HashSet<ServiceOperation>(); Method[] methods = serviceInterface.isInterface() ? serviceInterface.getMethods() : serviceInterface.getDeclaredMethods(); for (Method m : methods) { if (Modifier.isPublic(m.getModifiers())) { Class<?>[] params = m.getParameterTypes(); if (params.length > 1) { throw APIMessages.MESSAGES.serviceOpNeedOneParamater(); } OperationTypeQNames operationTypeNames = new OperationTypeQNames(m); if (m.getReturnType().equals(Void.TYPE)) { ops.add(new InOnlyOperation(m.getName(), operationTypeNames.in())); } else { ops.add(new InOutOperation(m.getName(), operationTypeNames.in(), operationTypeNames.out(), operationTypeNames.fault())); } } } return new JavaService(ops, serviceInterface); } private  JavaService(Set<ServiceOperation> operations, Class<?> serviceInterface); }
JavaService extends BaseService { public static JavaService fromClass(Class<?> serviceInterface) { HashSet<ServiceOperation> ops = new HashSet<ServiceOperation>(); Method[] methods = serviceInterface.isInterface() ? serviceInterface.getMethods() : serviceInterface.getDeclaredMethods(); for (Method m : methods) { if (Modifier.isPublic(m.getModifiers())) { Class<?>[] params = m.getParameterTypes(); if (params.length > 1) { throw APIMessages.MESSAGES.serviceOpNeedOneParamater(); } OperationTypeQNames operationTypeNames = new OperationTypeQNames(m); if (m.getReturnType().equals(Void.TYPE)) { ops.add(new InOnlyOperation(m.getName(), operationTypeNames.in())); } else { ops.add(new InOutOperation(m.getName(), operationTypeNames.in(), operationTypeNames.out(), operationTypeNames.fault())); } } } return new JavaService(ops, serviceInterface); } private  JavaService(Set<ServiceOperation> operations, Class<?> serviceInterface); static JavaService fromClass(Class<?> serviceInterface); Class<?> getJavaInterface(); static Class<?> parseType(final QName type); }
JavaService extends BaseService { public static JavaService fromClass(Class<?> serviceInterface) { HashSet<ServiceOperation> ops = new HashSet<ServiceOperation>(); Method[] methods = serviceInterface.isInterface() ? serviceInterface.getMethods() : serviceInterface.getDeclaredMethods(); for (Method m : methods) { if (Modifier.isPublic(m.getModifiers())) { Class<?>[] params = m.getParameterTypes(); if (params.length > 1) { throw APIMessages.MESSAGES.serviceOpNeedOneParamater(); } OperationTypeQNames operationTypeNames = new OperationTypeQNames(m); if (m.getReturnType().equals(Void.TYPE)) { ops.add(new InOnlyOperation(m.getName(), operationTypeNames.in())); } else { ops.add(new InOutOperation(m.getName(), operationTypeNames.in(), operationTypeNames.out(), operationTypeNames.fault())); } } } return new JavaService(ops, serviceInterface); } private  JavaService(Set<ServiceOperation> operations, Class<?> serviceInterface); static JavaService fromClass(Class<?> serviceInterface); Class<?> getJavaInterface(); static Class<?> parseType(final QName type); static final String TYPE; }