public void addProxyMethod(final ProxyMethodElement proxyMethod) { proxyMethods.add(proxyMethod); proxyMethod.parentService = this; }
public void addConstuctorExtraCode(CodeBlock cb) { constructorExtraCode.add(cb); }
public void addInterface(TypeName interfaceTypeName) { TypeName intf = interfaces.find(i -> i.toString().equals(interfaceTypeName.toString())); if (intf != null) { return; } interfaces.add(interfaceTypeName); }
public void addField(final ProxyFieldElement field) { ProxyFieldElement mfe = fields.find(f -> f.getName().equals(field.getName())); if (mfe != null) { if (mfe.getTypeName().equals(field.getTypeName())) { return; } throw CodegenException.of().message("Duplicate field name:" + field.getName()).element(getOriginClass()).build(); } fields.add(field); field.parentService = this; }
public void addTeleFacade(TeleFacadeElement teleFacade) { TeleFacadeElement ta = teleFacades.find(t -> t.getTeleType().equals(teleFacade.getTeleType())); if (ta != null) { throw CodegenException.of().message("Duplicate teleDriver-facade: " + teleFacade.getTeleType()).element(getOriginClass()).build(); } teleFacade.parentService = this; teleFacades.add(teleFacade); }
public void addCustomMethod(final CustomMethodElement customMethod) { CustomMethodElement cme = customMethods.find(m -> m.getName().equals(customMethod.getName())); if (cme != null) { throw CodegenException.of().message("Duplicate method name:" + customMethod.getName()).element(getOriginClass()).build(); } customMethods.add(customMethod); customMethod.parentService = this; }
public void addTeleMethod(TeleMethodElement teleMethod) { if (teleMethods.find((tm) -> tm.getName().equals(teleMethod.getName())) != null) { throw CodegenException.of().message("Duplicate tele-method name: " + teleMethod.getName()).element(teleMethod.getProxyMethod().getOriginMethod()).build(); } teleMethods.add(teleMethod); teleMethod.parentTeleFacade = this; }
public final void registTeleMethod(TeleMethodElement teleMethod) { String teleMethodName = teleMethod.getName(); final String route = buildMethodRoute(teleMethod); RoutedTeleMethodElement rtme = teleMethods.find(rte -> rte.getRoute().equals(route)); if (null != rtme) { throw CodegenException.of() .message("Duplicate router path: " + route + "->" + teleMethodName + "(...). Route already binded to " + rtme.getTeleMethod().getProxyMethod().getName() + "(...)") .element(teleMethod.getProxyMethod().getOriginMethod()).build(); } RoutedTeleMethodElement routedTeleMethodElement = new RoutedTeleMethodElement(teleMethod, route); teleMethods.add(routedTeleMethodElement); }