代码模型缩小为泛型

时间:2015-09-17 00:44:51

标签: java generics sun-codemodel

我想按如下方式生成一个新类:

Array
(
    [0] => Application\Document\Page Object
        (
            [id:Application\Document\Page:private] => 55fa06f29d6d75f0020041a7
            [name:Application\Document\Page:private] => test page
        )

    [1] => Application\Document\Page Object
        (
            [id:Application\Document\Page:private] => 55fa0bf59d6d755d030041a7
            [name:Application\Document\Page:private] => Focus
        )

)

我试过这个,但它没有缩小范围...

public class QueryBuilder_QueryField
extends AbstractQueryBuilder<QueryBuilder_QueryField>

但最终会像

一样
JCodeModel model = new JCodeModel();
String fqcn = packageName + "." + className;
JDefinedClass builderClass = model._class(fqcn);
builderClass._extends(AbstractQueryBuilder.class).narrow(builderClass);

任何想法?

1 个答案:

答案 0 :(得分:3)

我认为在将课程传递到$SaveLocation = "C:\Completed\" $WorkbookName = "Intro" if ((Test-Path $SaveLocation\$WorkbookName + ".csv")) { [IO.Path]::GetFileNameWithoutExtension($WorkbookName) + "_RoundTwo" + [IO.Path]::GetExtension($WorkbookName) } 之前需要缩小范围:

_extends()

生成:

JCodeModel model = new JCodeModel();
String fqcn = packageName + "." + className;
JDefinedClass builderClass = model._class(fqcn);
builderClass._extends(model.ref(AbstractQueryBuilder.class).narrow(builderClass));