Search in sources :

Example 1 with ClassOrInterfaceTypeDescr

use of org.kie.workbench.common.services.datamodeller.parser.descr.ClassOrInterfaceTypeDescr in project kie-wb-common by kiegroup.

the class ParserTestUtil method createField.

public static FieldDescr createField(String[] modifiers, String name, String type, String initializer) {
    FieldDescr fieldDescr = new FieldDescr();
    if (modifiers != null) {
        fieldDescr.setModifiers(new ModifierListDescr());
        for (int i = 0; i < modifiers.length; i++) {
            fieldDescr.addModifier(new ModifierDescr(modifiers[i], -1, -1, -1, -1, modifiers[i]));
        }
    }
    if (NamingUtils.isPrimitiveTypeId(type)) {
        fieldDescr.setType(new TypeDescr());
        fieldDescr.getType().setPrimitiveType(new PrimitiveTypeDescr(type, -1, -1, -1, -1, type));
    } else {
        fieldDescr.setType(new TypeDescr());
        fieldDescr.getType().setClassOrInterfaceType(new ClassOrInterfaceTypeDescr(type, -1, -1, -1, -1));
    }
    VariableDeclarationDescr variableDecl = new VariableDeclarationDescr();
    variableDecl.setIdentifier(new IdentifierDescr(name, -1, -1, -1));
    fieldDescr.addVariableDeclaration(variableDecl);
    if (initializer != null) {
        variableDecl.setVariableInitializer(new VariableInitializerDescr(initializer, -1, -1, -1, -1, initializer));
    }
    fieldDescr.setEndSemiColon(new JavaTokenDescr(ElementDescriptor.ElementType.JAVA_SEMI_COLON, ";", -1, -1, -1, -1));
    return fieldDescr;
}
Also used : ModifierListDescr(org.kie.workbench.common.services.datamodeller.parser.descr.ModifierListDescr) ClassOrInterfaceTypeDescr(org.kie.workbench.common.services.datamodeller.parser.descr.ClassOrInterfaceTypeDescr) VariableDeclarationDescr(org.kie.workbench.common.services.datamodeller.parser.descr.VariableDeclarationDescr) VariableInitializerDescr(org.kie.workbench.common.services.datamodeller.parser.descr.VariableInitializerDescr) TypeDescr(org.kie.workbench.common.services.datamodeller.parser.descr.TypeDescr) PrimitiveTypeDescr(org.kie.workbench.common.services.datamodeller.parser.descr.PrimitiveTypeDescr) ClassOrInterfaceTypeDescr(org.kie.workbench.common.services.datamodeller.parser.descr.ClassOrInterfaceTypeDescr) FieldDescr(org.kie.workbench.common.services.datamodeller.parser.descr.FieldDescr) PrimitiveTypeDescr(org.kie.workbench.common.services.datamodeller.parser.descr.PrimitiveTypeDescr) ModifierDescr(org.kie.workbench.common.services.datamodeller.parser.descr.ModifierDescr) JavaTokenDescr(org.kie.workbench.common.services.datamodeller.parser.descr.JavaTokenDescr) IdentifierDescr(org.kie.workbench.common.services.datamodeller.parser.descr.IdentifierDescr)

Example 2 with ClassOrInterfaceTypeDescr

use of org.kie.workbench.common.services.datamodeller.parser.descr.ClassOrInterfaceTypeDescr in project kie-wb-common by kiegroup.

the class JavaDriverUtils method isSimpleClass.

public static boolean isSimpleClass(TypeDescr typeDescr) {
    if (!typeDescr.isClassOrInterfaceType()) {
        return false;
    }
    ClassOrInterfaceTypeDescr classOrInterfaceTypeDescr = typeDescr.getClassOrInterfaceType();
    List<IdentifierWithTypeArgumentsDescr> identifierWithTypeArgumentsList = classOrInterfaceTypeDescr.getIdentifierWithTypeArguments();
    if (identifierWithTypeArgumentsList == null || identifierWithTypeArgumentsList.size() == 0) {
        return false;
    }
    for (IdentifierWithTypeArgumentsDescr identifierWithTypeArguments : identifierWithTypeArgumentsList) {
        if (identifierWithTypeArguments.getArguments() != null) {
            return false;
        }
    }
    return true;
}
Also used : ClassOrInterfaceTypeDescr(org.kie.workbench.common.services.datamodeller.parser.descr.ClassOrInterfaceTypeDescr) IdentifierWithTypeArgumentsDescr(org.kie.workbench.common.services.datamodeller.parser.descr.IdentifierWithTypeArgumentsDescr)

Example 3 with ClassOrInterfaceTypeDescr

use of org.kie.workbench.common.services.datamodeller.parser.descr.ClassOrInterfaceTypeDescr in project kie-wb-common by kiegroup.

the class JavaDriverUtils method isSimpleGeneric.

public static Object[] isSimpleGeneric(TypeDescr typeDescr) {
    Object[] result = new Object[3];
    result[0] = false;
    result[1] = null;
    result[2] = null;
    if (!typeDescr.isClassOrInterfaceType()) {
        return result;
    }
    ClassOrInterfaceTypeDescr classOrInterfaceTypeDescr = typeDescr.getClassOrInterfaceType();
    List<IdentifierWithTypeArgumentsDescr> identifierWithTypeArgumentsList = classOrInterfaceTypeDescr.getIdentifierWithTypeArguments();
    if (identifierWithTypeArgumentsList == null || identifierWithTypeArgumentsList.size() == 0) {
        return result;
    }
    int i = 0;
    StringBuilder outerClassName = new StringBuilder();
    for (IdentifierWithTypeArgumentsDescr identifierWithTypeArguments : identifierWithTypeArgumentsList) {
        i++;
        if (i > 1) {
            outerClassName.append(".");
        }
        outerClassName.append(identifierWithTypeArguments.getIdentifier().getIdentifier());
        if (identifierWithTypeArguments.getArguments() != null) {
            if (identifierWithTypeArgumentsList.size() > i) {
                return result;
            }
            TypeArgumentListDescr typeArgumentList = identifierWithTypeArguments.getArguments();
            List<TypeArgumentDescr> typeArguments = typeArgumentList != null ? typeArgumentList.getArguments() : null;
            if (typeArguments == null || typeArguments.size() != 1) {
                return result;
            }
            TypeDescr type;
            if ((type = typeArguments.get(0).getType()) != null && isSimpleClass(type)) {
                result[0] = true;
                result[1] = outerClassName.toString();
                result[2] = type;
                return result;
            }
        }
    }
    return result;
}
Also used : TypeArgumentDescr(org.kie.workbench.common.services.datamodeller.parser.descr.TypeArgumentDescr) ClassOrInterfaceTypeDescr(org.kie.workbench.common.services.datamodeller.parser.descr.ClassOrInterfaceTypeDescr) TypeArgumentListDescr(org.kie.workbench.common.services.datamodeller.parser.descr.TypeArgumentListDescr) TypeDescr(org.kie.workbench.common.services.datamodeller.parser.descr.TypeDescr) ClassOrInterfaceTypeDescr(org.kie.workbench.common.services.datamodeller.parser.descr.ClassOrInterfaceTypeDescr) IdentifierWithTypeArgumentsDescr(org.kie.workbench.common.services.datamodeller.parser.descr.IdentifierWithTypeArgumentsDescr)

Example 4 with ClassOrInterfaceTypeDescr

use of org.kie.workbench.common.services.datamodeller.parser.descr.ClassOrInterfaceTypeDescr in project kie-wb-common by kiegroup.

the class MehodParsing1Test method init.

private void init() {
    methodSentences = new ArrayList<String>();
    methodSentences.add("public MethodParsing1() { this(null); }");
    methodSentences.add("public MethodParsing1(String field1) { this.field1 = field1; }");
    methodSentences.add("public MethodParsing1(int a, int b) { this(a, b, (byte)1); }");
    methodSentences.add("public MethodParsing1(int a, int b, byte c) { super(); }");
    methodSentences.add("public String getField1() { return field1; }");
    methodSentences.add("public void setField1(String field1) { this.field1 = field1; }");
    methodSentences.add("private int method1() { return -1; }");
    methodSentences.add("private void method2() {}");
    methodSentences.add("public static java.lang.String method3() { return null; }");
    methodSentences.add("public static final Integer method4() { return null; }");
    methodSentences.add("public void method5(java.lang.Integer param1, int param2) {}");
    methodSentences.add("java.util.List<java.lang.String> method6() { return null;    }");
    methodSentences.add("protected   java.util.AbstractList<String>    method7  ( final int   param1 ,  java.lang.Integer   param2  ,   java.util.List<java.lang.Integer>      param3      ) {    return  null  ;    }");
    methodSentences.add("int method8  ( final int   param1 ,  java.lang.Integer   param2   ) [  ]   [    ] { return null; }");
    methodSentences.add("int method9 ( final Object ...  param1) { return -1;}");
    methodSentences.add("private java.util.AbstractList<Object> method10  (  final java.lang.String param1,  int param2 , List<java.util.List<String>>...param3) { return null; }");
    expectedMethods = new ArrayList<MethodDescr>();
    MethodDescr method;
    NormalParameterDescr param1;
    NormalParameterDescr param2;
    NormalParameterDescr param3;
    EllipsisParameterDescr ellipsisParam;
    ParameterListDescr parmsList;
    // public MethodParsing1() { this(null); }
    method = new MethodDescr(null, -1, -1);
    method.setModifiers(new ModifierListDescr());
    method.addModifier(new ModifierDescr(null, -1, -1, "public"));
    method.setIdentifier(new IdentifierDescr("MethodParsing1", -1, -1, -1, -1));
    expectedMethods.add(method);
    // public MethodParsing1(String field1) { this.field1 = field1; }
    method = new MethodDescr(null, -1, -1);
    method.setModifiers(new ModifierListDescr());
    method.addModifier(new ModifierDescr(null, -1, -1, "public"));
    method.setIdentifier(new IdentifierDescr("MethodParsing1", -1, -1, -1, -1));
    param1 = new NormalParameterDescr();
    // param1.setModifiers( new ModifierListDescr( ) );
    param1.setType(new TypeDescr(null, -1, -1));
    param1.getType().setClassOrInterfaceType(new ClassOrInterfaceTypeDescr("String", -1, -1));
    param1.setIdentifier(new IdentifierDescr("field1", -1, -1, -1, -1));
    parmsList = new ParameterListDescr();
    parmsList.addParameter(param1);
    method.setParamsList(parmsList);
    expectedMethods.add(method);
    // public MethodParsing1(int a, int b) { this(a, b, (byte)1); }
    method = new MethodDescr(null, -1, -1);
    method.setModifiers(new ModifierListDescr());
    method.addModifier(new ModifierDescr(null, -1, -1, "public"));
    method.setIdentifier(new IdentifierDescr("MethodParsing1", -1, -1, -1, -1));
    param1 = new NormalParameterDescr();
    // param1.setModifiers( new ModifierListDescr( ) );
    param1.setType(new TypeDescr(null, -1, -1));
    param1.getType().setPrimitiveType(new PrimitiveTypeDescr(null, -1, -1, "int"));
    param1.setIdentifier(new IdentifierDescr("a", -1, -1, -1, -1));
    param2 = new NormalParameterDescr();
    // param2.setModifiers( new ModifierListDescr( ) );
    param2.setType(new TypeDescr(null, -1, -1));
    param2.getType().setPrimitiveType(new PrimitiveTypeDescr(null, -1, -1, "int"));
    param2.setIdentifier(new IdentifierDescr("b", -1, -1, -1, -1));
    parmsList = new ParameterListDescr();
    parmsList.addParameter(param1);
    parmsList.addParameter(param2);
    method.setParamsList(parmsList);
    expectedMethods.add(method);
    // public MethodParsing1(int a, int b, byte c) { super(); }
    method = new MethodDescr(null, -1, -1);
    method.setModifiers(new ModifierListDescr());
    method.addModifier(new ModifierDescr(null, -1, -1, "public"));
    method.setIdentifier(new IdentifierDescr("MethodParsing1", -1, -1, -1, -1));
    param1 = new NormalParameterDescr();
    // param1.setModifiers( new ModifierListDescr( ) );
    param1.setType(new TypeDescr(null, -1, -1));
    param1.getType().setPrimitiveType(new PrimitiveTypeDescr(null, -1, -1, "int"));
    param1.setIdentifier(new IdentifierDescr("a", -1, -1, -1, -1));
    param2 = new NormalParameterDescr();
    // param2.setModifiers( new ModifierListDescr( ) );
    param2.setType(new TypeDescr(null, -1, -1));
    param2.getType().setPrimitiveType(new PrimitiveTypeDescr(null, -1, -1, "int"));
    param2.setIdentifier(new IdentifierDescr("b", -1, -1, -1, -1));
    param3 = new NormalParameterDescr();
    // param3.setModifiers( new ModifierListDescr( ) );
    param3.setType(new TypeDescr(null, -1, -1));
    param3.getType().setPrimitiveType(new PrimitiveTypeDescr(null, -1, -1, "byte"));
    param3.setIdentifier(new IdentifierDescr("c", -1, -1, -1, -1));
    parmsList = new ParameterListDescr();
    parmsList.addParameter(param1);
    parmsList.addParameter(param2);
    parmsList.addParameter(param3);
    method.setParamsList(parmsList);
    expectedMethods.add(method);
    // "public String getField1() { return field1; }"
    method = new MethodDescr(null, -1, -1);
    method.setModifiers(new ModifierListDescr());
    method.addModifier(new ModifierDescr(null, -1, -1, "public"));
    method.setType(new TypeDescr(null, -1, -1));
    method.getType().setClassOrInterfaceType(new ClassOrInterfaceTypeDescr("String", -1, -1));
    method.setIdentifier(new IdentifierDescr("getField1", -1, -1, -1, -1));
    expectedMethods.add(method);
    // "public void setField1(String field1) { this.field1 = field1; }"
    method = new MethodDescr(null, -1, -1);
    method.setModifiers(new ModifierListDescr());
    method.addModifier(new ModifierDescr(null, -1, -1, "public"));
    method.setType(new TypeDescr());
    method.getType().setVoidType(new JavaTokenDescr(ElementDescriptor.ElementType.JAVA_VOID, "void", -1, -1, -1, -1));
    method.setIdentifier(new IdentifierDescr("setField1", -1, -1, -1, -1));
    param1 = new NormalParameterDescr();
    // param1.setModifiers( new ModifierListDescr( ) );
    param1.setType(new TypeDescr(null, -1, -1));
    param1.getType().setClassOrInterfaceType(new ClassOrInterfaceTypeDescr("String", -1, -1));
    param1.setIdentifier(new IdentifierDescr("field1", -1, -1, -1, -1));
    parmsList = new ParameterListDescr();
    parmsList.addParameter(param1);
    method.setParamsList(parmsList);
    expectedMethods.add(method);
    // "private int method1() { return -1; }"
    method = new MethodDescr(null, -1, -1);
    method.setModifiers(new ModifierListDescr());
    method.addModifier(new ModifierDescr(null, -1, -1, "private"));
    method.setType(new TypeDescr(null, -1, -1));
    method.getType().setPrimitiveType(new PrimitiveTypeDescr(null, -1, -1, "int"));
    method.setIdentifier(new IdentifierDescr("method1", -1, -1, -1, 1));
    expectedMethods.add(method);
    // "private void method2() {}"
    method = new MethodDescr(null, -1, -1);
    method.setModifiers(new ModifierListDescr());
    method.addModifier(new ModifierDescr(null, -1, -1, "private"));
    method.setType(new TypeDescr());
    method.getType().setVoidType(new JavaTokenDescr(ElementDescriptor.ElementType.JAVA_VOID, "void", -1, -1, -1, -1));
    method.setIdentifier(new IdentifierDescr("method2", -1, -1, -1, -1));
    expectedMethods.add(method);
    // "public static java.lang.String method3() { return null; }"
    method = new MethodDescr(null, -1, -1);
    method.setModifiers(new ModifierListDescr());
    method.addModifier(new ModifierDescr(null, -1, -1, "public"));
    method.addModifier(new ModifierDescr(null, -1, -1, "static"));
    method.setType(new TypeDescr(null, -1, -1));
    method.getType().setClassOrInterfaceType(new ClassOrInterfaceTypeDescr("java.lang.String", -1, -1));
    method.setIdentifier(new IdentifierDescr("method3", -1, -1, -1, -1));
    expectedMethods.add(method);
    // "public static final Integer method4() { return null; }"
    method = new MethodDescr(null, -1, -1);
    method.setModifiers(new ModifierListDescr());
    method.addModifier(new ModifierDescr(null, -1, -1, "public"));
    method.addModifier(new ModifierDescr(null, -1, -1, "static"));
    method.addModifier(new ModifierDescr(null, -1, -1, "final"));
    method.setType(new TypeDescr(null, -1, -1));
    method.getType().setClassOrInterfaceType(new ClassOrInterfaceTypeDescr("Integer", -1, -1));
    method.setIdentifier(new IdentifierDescr("method4", -1, -1, -1, -1));
    expectedMethods.add(method);
    // "public void method5(java.lang.Integer param1, int param2) {}"
    method = new MethodDescr(null, -1, -1);
    method.setModifiers(new ModifierListDescr());
    method.addModifier(new ModifierDescr(null, -1, -1, "public"));
    method.setType(new TypeDescr());
    method.getType().setVoidType(new JavaTokenDescr(ElementDescriptor.ElementType.JAVA_VOID, "void", -1, -1, -1, -1));
    method.setIdentifier(new IdentifierDescr("method5", -1, -1, -1, -1));
    param1 = new NormalParameterDescr();
    // param1.setModifiers( new ModifierListDescr( ) );
    param1.setType(new TypeDescr(null, -1, -1));
    param1.getType().setClassOrInterfaceType(new ClassOrInterfaceTypeDescr("java.lang.Integer", -1, -1));
    param1.setIdentifier(new IdentifierDescr("param1", -1, -1, -1, -1));
    param2 = new NormalParameterDescr();
    // param2.setModifiers( new ModifierListDescr( ) );
    param2.setType(new TypeDescr(null, -1, -1));
    param2.getType().setPrimitiveType(new PrimitiveTypeDescr(null, -1, -1, "int"));
    param2.setIdentifier(new IdentifierDescr("param2", -1, -1, -1, -1));
    parmsList = new ParameterListDescr();
    parmsList.addParameter(param1);
    parmsList.addParameter(param2);
    method.setParamsList(parmsList);
    expectedMethods.add(method);
    // "java.util.List<java.lang.String> method6() { return null;    }"
    method = new MethodDescr(null, -1, -1);
    // method.setModifiers( new ModifierListDescr( ) );
    method.setType(new TypeDescr(null, -1, -1));
    method.getType().setClassOrInterfaceType(new ClassOrInterfaceTypeDescr("java.util.List<java.lang.String>", -1, -1));
    method.setIdentifier(new IdentifierDescr("method6", -1, -1, -1, -1));
    expectedMethods.add(method);
    // "protected   java.util.AbstractList<String>    method7  ( final int   param1 ,  java.lang.Integer   param2  ,   java.util.List<java.lang.Integer>      param3      ) {    return  null  ;    }"
    method = new MethodDescr(null, -1, -1);
    method.setModifiers(new ModifierListDescr());
    method.addModifier(new ModifierDescr(null, -1, -1, "protected"));
    method.setType(new TypeDescr(null, -1, -1));
    method.getType().setClassOrInterfaceType(new ClassOrInterfaceTypeDescr("java.util.AbstractList<String>", -1, -1));
    method.setIdentifier(new IdentifierDescr("method7", -1, -1, -1, -1));
    param1 = new NormalParameterDescr();
    param1.setModifiers(new ModifierListDescr());
    param1.addModifier(new ModifierDescr(null, -1, -1, "final"));
    param1.setType(new TypeDescr(null, -1, -1));
    param1.getType().setPrimitiveType(new PrimitiveTypeDescr(null, -1, -1, "int"));
    param1.setIdentifier(new IdentifierDescr("param1", -1, -1, -1, -1));
    param2 = new NormalParameterDescr();
    // param2.setModifiers( new ModifierListDescr( ) );
    param2.setType(new TypeDescr(null, -1, -1));
    param2.getType().setClassOrInterfaceType(new ClassOrInterfaceTypeDescr("java.lang.Integer", -1, -1));
    param2.setIdentifier(new IdentifierDescr("param2", -1, -1, -1, -1));
    param3 = new NormalParameterDescr();
    // param3.setModifiers( new ModifierListDescr( ) );
    param3.setType(new TypeDescr(null, -1, -1));
    param3.getType().setClassOrInterfaceType(new ClassOrInterfaceTypeDescr("java.util.List<java.lang.Integer>", -1, -1));
    param3.setIdentifier(new IdentifierDescr("param3", -1, -1, -1, -1));
    parmsList = new ParameterListDescr();
    parmsList.addParameter(param1);
    parmsList.addParameter(param2);
    parmsList.addParameter(param3);
    method.setParamsList(parmsList);
    expectedMethods.add(method);
    // "int method8  ( final int   param1 ,  java.lang.Integer   param2)[][] { return null; }"
    method = new MethodDescr(null, -1, -1);
    // method.setModifiers( new ModifierListDescr( ) );
    method.setType(new TypeDescr(null, -1, -1));
    method.getType().setPrimitiveType(new PrimitiveTypeDescr(null, -1, -1, "int"));
    method.setIdentifier(new IdentifierDescr("method8", -1, -1, -1, -1));
    param1 = new NormalParameterDescr();
    param1.setModifiers(new ModifierListDescr());
    param1.setType(new TypeDescr(null, -1, -1));
    param1.getType().setPrimitiveType(new PrimitiveTypeDescr(null, -1, -1, "int"));
    param1.addModifier(new ModifierDescr(null, -1, -1, "final"));
    param1.setIdentifier(new IdentifierDescr("param1", -1, -1, -1, -1));
    param2 = new NormalParameterDescr();
    // param2.setModifiers( new ModifierListDescr( ) );
    param2.setType(new TypeDescr(null, -1, -1));
    param2.getType().setClassOrInterfaceType(new ClassOrInterfaceTypeDescr("java.lang.Integer", -1, -1));
    param2.setIdentifier(new IdentifierDescr("param2", -1, -1, -1, -1));
    method.addDimension(new DimensionDescr("", -1, -1, -1, -1, new JavaTokenDescr(ElementDescriptor.ElementType.JAVA_LBRACKET, "[", -1, -1, -1, -1), new JavaTokenDescr(ElementDescriptor.ElementType.JAVA_RBRACKET, "]", -1, -1, -1, -1)));
    method.addDimension(new DimensionDescr("", -1, -1, -1, -1, new JavaTokenDescr(ElementDescriptor.ElementType.JAVA_LBRACKET, "[", -1, -1, -1, -1), new JavaTokenDescr(ElementDescriptor.ElementType.JAVA_RBRACKET, "]", -1, -1, -1, -1)));
    parmsList = new ParameterListDescr();
    parmsList.addParameter(param1);
    parmsList.addParameter(param2);
    method.setParamsList(parmsList);
    expectedMethods.add(method);
    // "int method9 ( final Object ...  param1) { return -1;}"
    method = new MethodDescr(null, -1, -1);
    // method.setModifiers( new ModifierListDescr( ) );
    method.setType(new TypeDescr(null, -1, -1));
    method.getType().setPrimitiveType(new PrimitiveTypeDescr(null, -1, -1, "int"));
    method.setIdentifier(new IdentifierDescr("method9", -1, -1, -1, -1));
    ellipsisParam = new EllipsisParameterDescr();
    ellipsisParam.setModifiers(new ModifierListDescr());
    ellipsisParam.setType(new TypeDescr(null, -1, -1));
    ellipsisParam.getType().setClassOrInterfaceType(new ClassOrInterfaceTypeDescr("Object", -1, -1));
    ellipsisParam.addModifier(new ModifierDescr(null, -1, -1, "final"));
    ellipsisParam.setIdentifier(new IdentifierDescr("param1", -1, -1, -1, -1));
    parmsList = new ParameterListDescr();
    parmsList.addParameter(ellipsisParam);
    method.setParamsList(parmsList);
    expectedMethods.add(method);
    // private java.util.AbstractList<Object> method10  (  final java.lang.String param1,  int param2 , List<java.util.List<String>>...param3) { return null; }
    method = new MethodDescr(null, -1, -1);
    method.setModifiers(new ModifierListDescr());
    method.setType(new TypeDescr(null, -1, -1));
    method.getType().setClassOrInterfaceType(new ClassOrInterfaceTypeDescr("java.util.AbstractList<Object>", -1, -1));
    method.addModifier(new ModifierDescr(null, -1, -1, "private"));
    method.setIdentifier(new IdentifierDescr("method10", -1, -1, -1, -1));
    param1 = new NormalParameterDescr();
    param1.setModifiers(new ModifierListDescr());
    param1.addModifier(new ModifierDescr(null, -1, -1, "final"));
    param1.setType(new TypeDescr(null, -1, -1));
    param1.getType().setClassOrInterfaceType(new ClassOrInterfaceTypeDescr("java.lang.String", -1, -1));
    param1.setIdentifier(new IdentifierDescr("param1", -1, -1, -1, -1));
    param2 = new NormalParameterDescr();
    // param2.setModifiers( new ModifierListDescr( ) );
    param2.setType(new TypeDescr(null, -1, -1));
    param2.getType().setPrimitiveType(new PrimitiveTypeDescr(null, -1, -1, "int"));
    param2.setIdentifier(new IdentifierDescr("param2", -1, -1, -1, -1));
    ellipsisParam = new EllipsisParameterDescr();
    // ellipsisParam.setModifiers( new ModifierListDescr( ) );
    ellipsisParam.setType(new TypeDescr(null, -1, -1));
    ellipsisParam.getType().setClassOrInterfaceType(new ClassOrInterfaceTypeDescr("List<java.util.List<String>>", -1, -1));
    ellipsisParam.setIdentifier(new IdentifierDescr("param3", -1, -1, -1, -1));
    parmsList = new ParameterListDescr();
    parmsList.addParameter(param1);
    parmsList.addParameter(param2);
    parmsList.addParameter(ellipsisParam);
    method.setParamsList(parmsList);
    expectedMethods.add(method);
}
Also used : ClassOrInterfaceTypeDescr(org.kie.workbench.common.services.datamodeller.parser.descr.ClassOrInterfaceTypeDescr) TypeDescr(org.kie.workbench.common.services.datamodeller.parser.descr.TypeDescr) PrimitiveTypeDescr(org.kie.workbench.common.services.datamodeller.parser.descr.PrimitiveTypeDescr) ClassOrInterfaceTypeDescr(org.kie.workbench.common.services.datamodeller.parser.descr.ClassOrInterfaceTypeDescr) MethodDescr(org.kie.workbench.common.services.datamodeller.parser.descr.MethodDescr) ParameterListDescr(org.kie.workbench.common.services.datamodeller.parser.descr.ParameterListDescr) JavaTokenDescr(org.kie.workbench.common.services.datamodeller.parser.descr.JavaTokenDescr) ModifierListDescr(org.kie.workbench.common.services.datamodeller.parser.descr.ModifierListDescr) PrimitiveTypeDescr(org.kie.workbench.common.services.datamodeller.parser.descr.PrimitiveTypeDescr) DimensionDescr(org.kie.workbench.common.services.datamodeller.parser.descr.DimensionDescr) ModifierDescr(org.kie.workbench.common.services.datamodeller.parser.descr.ModifierDescr) EllipsisParameterDescr(org.kie.workbench.common.services.datamodeller.parser.descr.EllipsisParameterDescr) IdentifierDescr(org.kie.workbench.common.services.datamodeller.parser.descr.IdentifierDescr) NormalParameterDescr(org.kie.workbench.common.services.datamodeller.parser.descr.NormalParameterDescr)

Aggregations

ClassOrInterfaceTypeDescr (org.kie.workbench.common.services.datamodeller.parser.descr.ClassOrInterfaceTypeDescr)4 TypeDescr (org.kie.workbench.common.services.datamodeller.parser.descr.TypeDescr)3 IdentifierDescr (org.kie.workbench.common.services.datamodeller.parser.descr.IdentifierDescr)2 IdentifierWithTypeArgumentsDescr (org.kie.workbench.common.services.datamodeller.parser.descr.IdentifierWithTypeArgumentsDescr)2 JavaTokenDescr (org.kie.workbench.common.services.datamodeller.parser.descr.JavaTokenDescr)2 ModifierDescr (org.kie.workbench.common.services.datamodeller.parser.descr.ModifierDescr)2 ModifierListDescr (org.kie.workbench.common.services.datamodeller.parser.descr.ModifierListDescr)2 PrimitiveTypeDescr (org.kie.workbench.common.services.datamodeller.parser.descr.PrimitiveTypeDescr)2 DimensionDescr (org.kie.workbench.common.services.datamodeller.parser.descr.DimensionDescr)1 EllipsisParameterDescr (org.kie.workbench.common.services.datamodeller.parser.descr.EllipsisParameterDescr)1 FieldDescr (org.kie.workbench.common.services.datamodeller.parser.descr.FieldDescr)1 MethodDescr (org.kie.workbench.common.services.datamodeller.parser.descr.MethodDescr)1 NormalParameterDescr (org.kie.workbench.common.services.datamodeller.parser.descr.NormalParameterDescr)1 ParameterListDescr (org.kie.workbench.common.services.datamodeller.parser.descr.ParameterListDescr)1 TypeArgumentDescr (org.kie.workbench.common.services.datamodeller.parser.descr.TypeArgumentDescr)1 TypeArgumentListDescr (org.kie.workbench.common.services.datamodeller.parser.descr.TypeArgumentListDescr)1 VariableDeclarationDescr (org.kie.workbench.common.services.datamodeller.parser.descr.VariableDeclarationDescr)1 VariableInitializerDescr (org.kie.workbench.common.services.datamodeller.parser.descr.VariableInitializerDescr)1