public JavaServiceContract introspect(Class<?> interfaze, Class<?> baseClass, IntrospectionContext context, ModelObject... modelObjects) { JavaServiceContract contract = introspectInterface(interfaze, baseClass, context, modelObjects); Callback callback = interfaze.getAnnotation(Callback.class); if (callback != null) { Class<?> callbackClass = callback.value(); introspectCallback(interfaze, callbackClass, contract, context); } return contract; }
public JavaServiceContract introspect(Class<?> interfaze, Class<?> baseClass, IntrospectionContext context, ModelObject... modelObjects) { JavaServiceContract contract = introspectInterface(interfaze, baseClass, context, modelObjects); Callback callback = interfaze.getAnnotation(Callback.class); if (callback != null) { Class<?> callbackClass = callback.value(); introspectCallback(interfaze, callbackClass, contract, context); } return contract; }
private void processCallback(Class<?> interfaze, Contract contract) throws InvalidServiceTypeException { Callback callback = interfaze.getAnnotation(Callback.class); if (callback != null && !Void.class.equals(callback.value())) { Class<?> callbackClass = callback.value(); JavaInterface javaInterface; try { javaInterface = javaInterfaceFactory.createJavaInterface(callbackClass); contract.getInterfaceContract().setCallbackInterface(javaInterface); } catch (InvalidInterfaceException e) { throw new InvalidServiceTypeException("Invalid callback interface "+callbackClass, interfaze); } } else if (callback != null && Void.class.equals(callback.value())) { throw new InvalidServiceTypeException("No callback interface specified on annotation", interfaze); } }
@Override public void visitField(Field field, JavaImplementation type) throws IntrospectionException { Callback annotation = field.getAnnotation(Callback.class); if (annotation == null) { return; } if( type.getJavaScope() == JavaScopeImpl.COMPOSITE ) { throw new IllegalCallbackReferenceException("[JCA90057] @Callback on field or method cannot be used for a class with @Scope(COMPOSITE): " + type.getName() + "." + field.getName()); } if (!(annotation.value() == null || annotation.value() == Void.class)) { throw new IllegalCallbackReferenceException("[JCA90046] @Callback on field of method must not have any parameters: " + type.getName() + "." + field.getName()); } if(Modifier.isPrivate(field.getModifiers())) { throw new IllegalCallbackReferenceException("Illegal annotation @Callback found on "+field, field); } JavaElementImpl element = new JavaElementImpl(field); createCallback(type, element); }
@Override public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException { Callback annotation = method.getAnnotation(Callback.class); if (annotation == null) { return; } if( type.getJavaScope() == JavaScopeImpl.COMPOSITE ) { throw new IllegalCallbackReferenceException("[JCA90057] @Callback on field or method cannot be used for a class with @Scope(COMPOSITE): " + type.getName() + "." + method.getName()); } if (!(annotation.value() == null || annotation.value() == Void.class)) { throw new IllegalCallbackReferenceException("[JCA90046] @Callback on field of method must not have any parameters: " + type.getName() + "." + method.getName()); } if(Modifier.isPrivate(method.getModifiers())) { throw new IllegalCallbackReferenceException("Illegal annotation @Callback found on "+method, method); } if (method.getParameterTypes().length != 1) { throw new IllegalCallbackReferenceException("Setter must have one parameter", method); } JavaElementImpl element = new JavaElementImpl(method, 0); createCallback(type, element); }
if (callback != null && !Void.class.equals(callback.value())) { callbackClass = callback.value(); if (remotable && !callbackClass.isAnnotationPresent(Remotable.class)) { throw new InvalidCallbackException("Callback " + callbackClass.getName() + " must not be remotable on local interface " + clazz.getName()); } else if (callback != null && Void.class.equals(callback.value())) { throw new InvalidCallbackException("No callback interface specified on callback annotation in " + clazz.getName());
if (callback != null && !Void.class.equals(callback.value())) { callbackClass = callback.value(); if (remotable && !callbackClass.isAnnotationPresent(Remotable.class)) { throw new InvalidCallbackException("Callback " + callbackClass.getName() + " must not be remotable on local interface " + clazz.getName()); } else if (callback != null && Void.class.equals(callback.value())) { throw new InvalidCallbackException("No callback interface specified on callback annotation in " + clazz.getName());