@Override public Class<?> resolveDomainClass(Class<?> clazz) { if (List.class.equals(clazz)) { return List.class; } else if (Set.class.equals(clazz)) { return Set.class; } else if (Map.class.equals(clazz)) { return Map.class; } else if (BaseProxy.class.isAssignableFrom(clazz)) { ProxyFor pf = clazz.getAnnotation(ProxyFor.class); if (pf != null) { return pf.value(); } ProxyForName pfn = clazz.getAnnotation(ProxyForName.class); if (pfn != null) { Class<?> toReturn = forName(pfn.value()); return toReturn; } } return die(null, "Could not resolve a domain type for client type %s", clazz.getCanonicalName()); }
@Override public Void visitType(TypeElement x, State state) { checkedElement = x; ProxyFor proxyFor = x.getAnnotation(ProxyFor.class); ProxyForName proxyForName = x.getAnnotation(ProxyForName.class); JsonRpcProxy jsonRpcProxy = x.getAnnotation(JsonRpcProxy.class); if (proxyFor != null) { poisonIfAnnotationPresent(state, x, proxyForName, jsonRpcProxy); // See javadoc on Element.getAnnotation() for why it works this way try { proxyFor.value(); throw new RuntimeException("Should not reach here"); } catch (MirroredTypeException expected) { TypeMirror type = expected.getTypeMirror(); state.addMapping(x, (TypeElement) state.types.asElement(type)); } } if (proxyForName != null) { poisonIfAnnotationPresent(state, x, jsonRpcProxy); TypeElement domain = state.elements.getTypeElement(BinaryName.toSourceName(proxyForName.value())); if (domain == null) { state.warn(x, Messages.proxyMissingDomainType(proxyForName.value())); } state.addMapping(x, domain); } scanAllInheritedMethods(x, state); state.checkExtraTypes(x); return null; }
@Override public Class<?> resolveDomainClass(Class<?> clazz) { if (List.class.equals(clazz)) { return List.class; } else if (Set.class.equals(clazz)) { return Set.class; } else if (Map.class.equals(clazz)) { return Map.class; } else if (BaseProxy.class.isAssignableFrom(clazz)) { ProxyFor pf = clazz.getAnnotation(ProxyFor.class); if (pf != null) { return pf.value(); } ProxyForName pfn = clazz.getAnnotation(ProxyForName.class); if (pfn != null) { Class<?> toReturn = forName(pfn.value()); return toReturn; } } return die(null, "Could not resolve a domain type for client type %s", clazz.getCanonicalName()); }
@Override public Class<?> resolveDomainClass(Class<?> clazz) { if (List.class.equals(clazz)) { return List.class; } else if (Set.class.equals(clazz)) { return Set.class; } else if (Map.class.equals(clazz)) { return Map.class; } else if (BaseProxy.class.isAssignableFrom(clazz)) { ProxyFor pf = clazz.getAnnotation(ProxyFor.class); if (pf != null) { return pf.value(); } ProxyForName pfn = clazz.getAnnotation(ProxyForName.class); if (pfn != null) { Class<?> toReturn = forName(pfn.value()); return toReturn; } } return die(null, "Could not resolve a domain type for client type %s", clazz.getCanonicalName()); }
@Override public Class<?> resolveDomainClass(Class<?> clazz) { if (List.class.equals(clazz)) { return List.class; } else if (Set.class.equals(clazz)) { return Set.class; } else if (Map.class.equals(clazz)) { return Map.class; } else if (BaseProxy.class.isAssignableFrom(clazz)) { ProxyFor pf = clazz.getAnnotation(ProxyFor.class); if (pf != null) { return pf.value(); } ProxyForName pfn = clazz.getAnnotation(ProxyForName.class); if (pfn != null) { Class<?> toReturn = forName(pfn.value()); return toReturn; } } return die(null, "Could not resolve a domain type for client type %s", clazz.getCanonicalName()); }
@Override public Void visitType(TypeElement x, State state) { checkedElement = x; ProxyFor proxyFor = x.getAnnotation(ProxyFor.class); ProxyForName proxyForName = x.getAnnotation(ProxyForName.class); JsonRpcProxy jsonRpcProxy = x.getAnnotation(JsonRpcProxy.class); if (proxyFor != null) { poisonIfAnnotationPresent(state, x, proxyForName, jsonRpcProxy); // See javadoc on Element.getAnnotation() for why it works this way try { proxyFor.value(); throw new RuntimeException("Should not reach here"); } catch (MirroredTypeException expected) { TypeMirror type = expected.getTypeMirror(); state.addMapping(x, (TypeElement) state.types.asElement(type)); } } if (proxyForName != null) { poisonIfAnnotationPresent(state, x, jsonRpcProxy); TypeElement domain = state.elements.getTypeElement(BinaryName.toSourceName(proxyForName.value())); if (domain == null) { state.warn(x, Messages.proxyMissingDomainType(proxyForName.value())); } state.addMapping(x, domain); } scanAllInheritedMethods(x, state); state.checkExtraTypes(x); return null; }
@Override public Void visitType(TypeElement x, State state) { checkedElement = x; ProxyFor proxyFor = x.getAnnotation(ProxyFor.class); ProxyForName proxyForName = x.getAnnotation(ProxyForName.class); JsonRpcProxy jsonRpcProxy = x.getAnnotation(JsonRpcProxy.class); if (proxyFor != null) { poisonIfAnnotationPresent(state, x, proxyForName, jsonRpcProxy); // See javadoc on Element.getAnnotation() for why it works this way try { proxyFor.value(); throw new RuntimeException("Should not reach here"); } catch (MirroredTypeException expected) { TypeMirror type = expected.getTypeMirror(); state.addMapping(x, (TypeElement) state.types.asElement(type)); } } if (proxyForName != null) { poisonIfAnnotationPresent(state, x, jsonRpcProxy); TypeElement domain = state.elements.getTypeElement(BinaryName.toSourceName(proxyForName.value())); if (domain == null) { state.warn(x, Messages.proxyMissingDomainType(proxyForName.value())); } state.addMapping(x, domain); } scanAllInheritedMethods(x, state); state.checkExtraTypes(x); return null; }
@Override public Void visitType(TypeElement x, State state) { checkedElement = x; ProxyFor proxyFor = x.getAnnotation(ProxyFor.class); ProxyForName proxyForName = x.getAnnotation(ProxyForName.class); JsonRpcProxy jsonRpcProxy = x.getAnnotation(JsonRpcProxy.class); if (proxyFor != null) { poisonIfAnnotationPresent(state, x, proxyForName, jsonRpcProxy); // See javadoc on Element.getAnnotation() for why it works this way try { proxyFor.value(); throw new RuntimeException("Should not reach here"); } catch (MirroredTypeException expected) { TypeMirror type = expected.getTypeMirror(); state.addMapping(x, (TypeElement) state.types.asElement(type)); } } if (proxyForName != null) { poisonIfAnnotationPresent(state, x, jsonRpcProxy); TypeElement domain = state.elements.getTypeElement(BinaryName.toSourceName(proxyForName.value())); if (domain == null) { state.warn(x, Messages.proxyMissingDomainType(proxyForName.value())); } state.addMapping(x, domain); } scanAllInheritedMethods(x, state); state.checkExtraTypes(x); return null; }