public ServiceElement(ClassElement originClass, ClassType customScopeType) { this.originClass = originClass; this.customScopeType = customScopeType; this.interfaces = new Elements<>(); this.proxyMethods = new Elements<>(); this.fields = new Elements<>(); this.customMethods = new Elements<>(); this.constructorExtraCode = new Elements<>(); this.teleFacades = new Elements<>(); this.properties = new HashMap(); }
public void addProxyMethod(final ProxyMethodElement proxyMethod) { proxyMethods.add(proxyMethod); proxyMethod.parentService = this; }
public void addConstuctorExtraCode(CodeBlock cb) { constructorExtraCode.add(cb); }
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 TeleFacadeElement(String teleType, Class<? extends TeleDriver> teleDriverClass, Class<? extends DataPort> dataPortClass, Class<?> ligatureClass, IocQualifiers iocQualifiers) { this.teleType = checkTeleType(teleType); this.teleDriverClass = teleDriverClass; this.ligatureClass = ligatureClass; this.dataPortClass = dataPortClass; this.teleMethods = new Elements<>(); this.properties = new HashMap(); this.iocQualifiers = iocQualifiers; }
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 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 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); }