All Downloads are FREE. Search and download functionalities are using the official Maven repository.

au.org.consumerdatastandards.support.model.ParamModel Maven / Gradle / Ivy

Go to download

This artefact describes the Consumer Data Standards using Java classes and annotations in a way suitable for automatic generation of Open API Specification, documentation, Server Stub, Client Libraries and Reference Test.

There is a newer version: 1.1.1
Show newest version
package au.org.consumerdatastandards.support.model;

import au.org.consumerdatastandards.support.Param;
import au.org.consumerdatastandards.support.data.CDSDataType;
import au.org.consumerdatastandards.support.data.IntegerRange;
import au.org.consumerdatastandards.support.data.Pattern;
import au.org.consumerdatastandards.support.data.StringFormat;

import java.lang.reflect.Parameter;

public class ParamModel extends ModelBase implements Comparable {

    private Param param;

    private String name;

    private Class paramDataType;

    private CDSDataType cdsDataType;

    private StringFormat stringFormat;

    private Pattern pattern;

    private IntegerRange integerRange;
    
    public ParamModel(Parameter parameter) {
        this.param = parameter.getAnnotation(Param.class);
        this.name = this.param.name();
        this.paramDataType = parameter.getType();
        this.cdsDataType = parameter.getAnnotation(CDSDataType.class);
        this.stringFormat = parameter.getAnnotation(StringFormat.class);
        this.pattern = parameter.getAnnotation(Pattern.class);
        this.integerRange = parameter.getAnnotation(IntegerRange.class);
    }

    public StringFormat getStringFormat() {
        return stringFormat;
    }

    public Pattern getPattern() {
        return pattern;
    }

    public IntegerRange getIntegerRange() {
        return integerRange;
    }

    public Param getParam() {
        return param;
    }

    public Class getParamDataType() {
        return paramDataType;
    }

    public CDSDataType getCDSDataType() {
        return cdsDataType;
    }

    @Override
    public int compareTo(ParamModel paramModel) {

        return name.compareTo(paramModel.name);
    }
    
    public String getName() {
        return name;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy