Skip to content

Commit

Permalink
add tup generate
Browse files Browse the repository at this point in the history
  • Loading branch information
LawlietLi committed Jul 3, 2018
1 parent 0517be1 commit 2500004
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ public static String getParameterName(Annotation[] annotations) {
if (annotation.annotationType() == TarsMethodParameter.class) {
TarsMethodParameter parameter = (TarsMethodParameter) annotation;
return parameter.name();
} else if (annotation.annotationType() == TarsHolder.class) {
TarsHolder tarsHolder = (TarsHolder) annotation;
return tarsHolder.name();
}
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public class Tars2JavaConfig {
@Parameter
public boolean servant;

@Parameter
public boolean tup;

public String getSrcPath() {
return srcPath;
}
Expand Down Expand Up @@ -106,4 +109,12 @@ public boolean isServant() {
public void setServant(boolean servant) {
this.servant = servant;
}

public boolean isTup() {
return tup;
}

public void setTup(boolean tup) {
this.tup = tup;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -841,10 +841,18 @@ public String opertaionParams(List<String> beforeParams, List<TarsParam> paramLi
}
if (p.isOut()) {
sb.append(isFirst ? "" : ", ");
sb.append("@TarsHolder Holder<").append(type(p.paramType(), true, nsMap)).append("> ").append(p.paramName());
if (tars2JavaConfig.isServant() && tars2JavaConfig.isTup()) {
sb.append("@TarsHolder(name=\"").append(p.paramName()).append("\") Holder<").append(type(p.paramType(), true, nsMap)).append("> ").append(p.paramName());
} else {
sb.append("@TarsHolder Holder<").append(type(p.paramType(), true, nsMap)).append("> ").append(p.paramName());
}
} else {
sb.append(isFirst ? "" : ", ");
sb.append(type(p.paramType(), nsMap)).append(" ").append(p.paramName());
if (tars2JavaConfig.isServant() && tars2JavaConfig.isTup()) {
sb.append("@TarsMethodParameter(name=\"").append(p.paramName()).append("\")").append(type(p.paramType(), nsMap)).append(" ").append(p.paramName());
} else {
sb.append(type(p.paramType(), nsMap)).append(" ").append(p.paramName());
}
}
if (isFirst) {
isFirst = false;
Expand Down

0 comments on commit 2500004

Please sign in to comment.