Search in sources :

Example 1 with DocAnnotations

use of org.develnext.jphp.genapi.DocAnnotations in project jphp by jphp-compiler.

the class ConstantDescription method parse.

@Override
protected void parse() {
    if (token.getDocComment() != null) {
        DocAnnotations annotations = new DocAnnotations(token.getDocComment().getComment());
        description = annotations.getDescription();
    }
}
Also used : DocAnnotations(org.develnext.jphp.genapi.DocAnnotations)

Example 2 with DocAnnotations

use of org.develnext.jphp.genapi.DocAnnotations in project jphp by jphp-compiler.

the class FunctionDescription method parse.

@Override
protected void parse() {
    arguments = new LinkedHashMap<String, ArgumentDescription>();
    annotations = new DocAnnotations(token.getDocComment() == null ? "" : token.getDocComment().getComment());
    DocAnnotations.Parameter returnParam = annotations.getParameter("return");
    if (returnParam != null) {
        this.returnParameter = new MethodReturnParameter(token.getNamespace(), returnParam.value());
    }
    DocAnnotations.Parameter throwsParam = annotations.getParameter("throws");
    if (throwsParam != null) {
        this.throwsParameters = new MethodReturnParameter[throwsParam.values().size()];
        int i = 0;
        for (String e : throwsParam.values()) {
            this.throwsParameters[i] = new MethodReturnParameter(token.getNamespace(), e);
            i++;
        }
    }
    Map<String, MethodParamParameter> paramDescription = new HashMap<String, MethodParamParameter>();
    DocAnnotations.Parameter param = annotations.getParameter("param");
    if (param != null) {
        for (String el : param.values()) {
            MethodParamParameter tmp = new MethodParamParameter(token.getNamespace(), el);
            paramDescription.put(tmp.getArgument(), tmp);
        }
    }
    for (ArgumentStmtToken el : token.getArguments()) {
        MethodParamParameter desc = paramDescription.get(el.getName().getName());
        arguments.put(el.getName().getName(), new ArgumentDescription(el, desc));
    }
}
Also used : MethodParamParameter(org.develnext.jphp.genapi.parameter.MethodParamParameter) ArgumentStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ArgumentStmtToken) MethodReturnParameter(org.develnext.jphp.genapi.parameter.MethodReturnParameter) DocAnnotations(org.develnext.jphp.genapi.DocAnnotations)

Example 3 with DocAnnotations

use of org.develnext.jphp.genapi.DocAnnotations in project jphp by jphp-compiler.

the class PropertyDescription method parse.

@Override
protected void parse() {
    if (token.getDocComment() != null) {
        DocAnnotations annotations = new DocAnnotations(token.getDocComment().getComment());
        description = annotations.getDescription();
        isReadonly = annotations.hasParameter("readonly");
        List<String> types = new ArrayList<String>();
        for (String el : annotations.getParameter("var").values()) {
            el = el.trim();
            if (!BaseParameter.isNotClass(el))
                el = SyntaxAnalyzer.getRealName(NameToken.valueOf(el.trim()), token.getClazz().getNamespace()).getName();
            types.add(el);
        }
        this.types = types.toArray(new String[0]);
    }
}
Also used : ArrayList(java.util.ArrayList) DocAnnotations(org.develnext.jphp.genapi.DocAnnotations)

Example 4 with DocAnnotations

use of org.develnext.jphp.genapi.DocAnnotations in project jphp by jphp-compiler.

the class ClassDescription method parse.

@Override
protected void parse() {
    methods = new LinkedHashMap<String, MethodDescription>();
    for (MethodStmtToken el : token.getMethods()) {
        methods.put(el.getName().getName().toLowerCase(), new MethodDescription(el));
    }
    properties = new LinkedHashMap<String, PropertyDescription>();
    for (ClassVarStmtToken el : token.getProperties()) {
        properties.put(el.getVariable().getName(), new PropertyDescription(el));
    }
    constants = new LinkedHashMap<String, ConstantDescription>();
    for (ConstStmtToken el : token.getConstants()) {
        constants.put(el.items.get(0).getFulledName(), new ConstantDescription(el));
    }
    if (token.getDocComment() != null) {
        DocAnnotations annotations = new DocAnnotations(token.getDocComment().getComment());
        description = annotations.getDescription();
    }
}
Also used : ConstStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ConstStmtToken) MethodStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.MethodStmtToken) ClassVarStmtToken(org.develnext.jphp.core.tokenizer.token.stmt.ClassVarStmtToken) DocAnnotations(org.develnext.jphp.genapi.DocAnnotations)

Aggregations

DocAnnotations (org.develnext.jphp.genapi.DocAnnotations)4 ArrayList (java.util.ArrayList)1 ArgumentStmtToken (org.develnext.jphp.core.tokenizer.token.stmt.ArgumentStmtToken)1 ClassVarStmtToken (org.develnext.jphp.core.tokenizer.token.stmt.ClassVarStmtToken)1 ConstStmtToken (org.develnext.jphp.core.tokenizer.token.stmt.ConstStmtToken)1 MethodStmtToken (org.develnext.jphp.core.tokenizer.token.stmt.MethodStmtToken)1 MethodParamParameter (org.develnext.jphp.genapi.parameter.MethodParamParameter)1 MethodReturnParameter (org.develnext.jphp.genapi.parameter.MethodReturnParameter)1