/** * Find all EntityProxyModels reachable from a given ContextMethod. */ private Set<EntityProxyModel> findReferencedEntities(ContextMethod method) { final Set<EntityProxyModel> models = new LinkedHashSet<EntityProxyModel>(); method.accept(new AllReachableTypesVisitor(model) { @Override public void endVisit(EntityProxyModel x) { models.add(x); models.addAll(x.getSuperProxyTypes()); } }); return models; }
/** * For debugging use only. */ @Override public String toString() { return getQualifiedSourceName() + " " + getMethodName() + "()"; } }
/** * The qualified source name of the implementation. */ public String getQualifiedSourceName() { return getPackageName() + "." + getSimpleSourceName(); }
private void writeContextImplementations() { for (ContextMethod method : model.getMethods()) { PrintWriter pw = context.tryCreate(logger, method.getPackageName(), method.getSimpleSourceName()); if (pw == null) { new ClassSourceFileComposerFactory(method.getPackageName(), method.getSimpleSourceName()); factory.setSuperclass(AbstractRequestContext.class.getCanonicalName()); factory.addImplementedInterface(method.getImplementedInterfaceQualifiedSourceName()); SourceWriter sw = factory.createSourceWriter(context, pw); .getSimpleSourceName(), AbstractRequestFactory.class.getCanonicalName(), Dialect.class .getCanonicalName(), method.getDialect().name()); for (RequestMethod request : method.getRequestMethods()) { JMethod jmethod = request.getDeclarationMethod(); String operation = request.getOperation(); sw.println("public X() { super(%s.this);}", method.getSimpleSourceName()); if (method.getDialect().equals(Dialect.JSON_RPC)) { for (JMethod setter : request.getExtraSetters()) { PropertyName propertyNameAnnotation = setter.getAnnotation(PropertyName.class); if (method.getDialect().equals(Dialect.JSON_RPC)) { for (JParameter param : jmethod.getParameters()) { PropertyName annotation = param.getAnnotation(PropertyName.class);
public void accept(ModelVisitor visitor) { if (visitor.visit(this)) { for (RequestMethod method : getRequestMethods()) { method.accept(visitor); } } visitor.endVisit(this); }
private void writeContextImplementations() { for (ContextMethod method : model.getMethods()) { PrintWriter pw = context.tryCreate(logger, method.getPackageName(), method.getSimpleSourceName()); if (pw == null) { new ClassSourceFileComposerFactory(method.getPackageName(), method.getSimpleSourceName()); factory.setSuperclass(AbstractRequestContext.class.getCanonicalName()); factory.addImplementedInterface(method.getImplementedInterfaceQualifiedSourceName()); SourceWriter sw = factory.createSourceWriter(context, pw); .getSimpleSourceName(), AbstractRequestFactory.class.getCanonicalName(), Dialect.class .getCanonicalName(), method.getDialect().name()); for (RequestMethod request : method.getRequestMethods()) { JMethod jmethod = request.getDeclarationMethod(); String operation = request.getOperation(); sw.println("public X() { super(%s.this);}", method.getSimpleSourceName()); if (method.getDialect().equals(Dialect.JSON_RPC)) { for (JMethod setter : request.getExtraSetters()) { PropertyName propertyNameAnnotation = setter.getAnnotation(PropertyName.class); if (method.getDialect().equals(Dialect.JSON_RPC)) { for (JParameter param : jmethod.getParameters()) { PropertyName annotation = param.getAnnotation(PropertyName.class);
public void accept(ModelVisitor visitor) { if (visitor.visit(this)) { for (RequestMethod method : getRequestMethods()) { method.accept(visitor); } } visitor.endVisit(this); }
/** * For debugging use only. */ @Override public String toString() { return getQualifiedSourceName() + " " + getMethodName() + "()"; } }
/** * The qualified source name of the implementation. */ public String getQualifiedSourceName() { return getPackageName() + "." + getSimpleSourceName(); }
/** * Find all EntityProxyModels reachable from a given ContextMethod. */ private Set<EntityProxyModel> findReferencedEntities(ContextMethod method) { final Set<EntityProxyModel> models = new LinkedHashSet<EntityProxyModel>(); method.accept(new AllReachableTypesVisitor(model) { @Override public void endVisit(EntityProxyModel x) { models.add(x); models.addAll(x.getSuperProxyTypes()); } }); return models; }
private void writeContextMethods(SourceWriter sw) { for (ContextMethod method : model.getMethods()) { // public FooService foo() { sw.println("public %s %s() {", method.getQualifiedSourceName(), method.getMethodName()); // return new FooServiceImpl(this); sw.indentln("return new %s(this);", method.getQualifiedSourceName()); sw.println("}"); } }
public void accept(ModelVisitor visitor) { if (visitor.visit(this)) { for (EntityProxyModel model : getAllProxyModels()) { model.accept(visitor); } for (ContextMethod method : getMethods()) { method.accept(visitor); } } visitor.endVisit(this); }
private void writeContextMethods(SourceWriter sw) { for (ContextMethod method : model.getMethods()) { // public FooService foo() { sw.println("public %s %s() {", method.getQualifiedSourceName(), method.getMethodName()); // return new FooServiceImpl(this); sw.indentln("return new %s(this);", method.getQualifiedSourceName()); sw.println("}"); } }
public void accept(ModelVisitor visitor) { if (visitor.visit(this)) { for (EntityProxyModel model : getAllProxyModels()) { model.accept(visitor); } for (ContextMethod method : getMethods()) { method.accept(visitor); } } visitor.endVisit(this); }