@Override
  protected ClassSourceFileComposerFactory createComposerFactory() {
    String parameters = "";
    if (source instanceof JGenericType) {
      JGenericType gtype = (JGenericType) source;
      StringBuilder builder = new StringBuilder();
      builder.append("<");
      boolean first = true;
      for (JTypeParameter arg : gtype.getTypeParameters()) {
        if (!first) builder.append(",");
        builder.append(arg.getName());
        builder.append(" extends ");
        builder.append(arg.getFirstBound().getParameterizedQualifiedSourceName());
        first = false;
      }
      builder.append(">");
      parameters = builder.toString();
    }

    ClassSourceFileComposerFactory composerFactory =
        new ClassSourceFileComposerFactory(packageName, shortName + parameters);
    composerFactory.addImplementedInterface(source.getParameterizedQualifiedSourceName());
    composerFactory.addImplementedInterface(RestServiceProxy.class.getName());
    return composerFactory;
  }
Example #2
0
  @Override
  public MetaTypeVariable[] getTypeParameters() {
    final List<MetaTypeVariable> typeVariables = new ArrayList<MetaTypeVariable>();
    final JGenericType genericType = getEnclosedMetaObject().isGenericType();

    if (genericType != null) {
      for (final JTypeParameter typeParameter : genericType.getTypeParameters()) {
        typeVariables.add(new GWTTypeVariable(oracle, typeParameter));
      }
    }

    return typeVariables.toArray(new MetaTypeVariable[typeVariables.size()]);
  }