Esempio n. 1
0
  private void genMetaForPty(
      MethodDeclaration astNode, final JstType jstType, final Annotation anno) {

    CustomType cType = getCustomType(jstType);
    MethodKey mtdKey = MethodKey.genMethodKey(astNode);
    CustomMethod cMtd = cType.getCustomMethod(mtdKey);
    if (cMtd == null) {
      cMtd = new CustomMethod(mtdKey);
      cType.addCustomMethod(cMtd);
    }

    cMtd.setIsProperty(true);

    if (anno instanceof NormalAnnotation) {
      NormalAnnotation normalAnno = (NormalAnnotation) anno;
      List<?> annos = normalAnno.values();
      MemberValuePair pair = (MemberValuePair) annos.get(0);
      String name = getValue(pair.getValue(), astNode, jstType);
      if (name != null) {
        cMtd.setJstName(name);
        return;
      }
    }

    String mtdName = cMtd.getJstName();
    if (mtdName.startsWith("get")) {
      mtdName = mtdName.substring(3, 4).toLowerCase() + mtdName.substring(4, mtdName.length());
      cMtd.setJstName(mtdName);
    } else if (mtdName.startsWith("set")) {
      mtdName = mtdName.substring(3, 4).toLowerCase() + mtdName.substring(4, mtdName.length());
      cMtd.setJstName(mtdName);
    }
  }