本文整理汇总了Java中org.raml.model.parameter.AbstractParam.getType方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractParam.getType方法的具体用法?Java AbstractParam.getType怎么用?Java AbstractParam.getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.raml.model.parameter.AbstractParam
的用法示例。
在下文中一共展示了AbstractParam.getType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parameterDef
import org.raml.model.parameter.AbstractParam; //导入方法依赖的package包/类
private void parameterDef(Map<String, ?> params, ParamName paramName) {
for (final Map.Entry<String, AbstractParam> entry : paramEntries(params)) {
final String name = entry.getKey();
final AbstractParam param = entry.getValue();
final ParamType type = param.getType() == null ? ParamType.STRING : param.getType();
if (type == ParamType.STRING) {
minMaxNotAllowed(param, name, paramName);
} else {
stringConstraintsNotAllowed(param, name, paramName);
if (type != ParamType.INTEGER && type != ParamType.NUMBER) {
minMaxNotAllowed(param, name, paramName);
}
if (type == ParamType.FILE) {
violations.addIf(paramName != ParamName.FORM, new Message("parameter.file.illegal", locator, name, paramName));
}
}
}
}
示例2: checkStringParameter
import org.raml.model.parameter.AbstractParam; //导入方法依赖的package包/类
private void checkStringParameter(AbstractParam param, String value, Message detail) {
switch (param.getType()) {
case BOOLEAN:
checkBoolean(value, detail);
break;
case DATE:
checkDate(value, detail);
break;
case FILE:
checkFile(detail);
break;
case INTEGER:
checkInteger(param, value, detail);
break;
case NUMBER:
checkNumber(param, value, detail);
break;
case STRING:
checkString(param, value, detail);
break;
default:
throw new RamlCheckerException("Unhandled parameter type '" + param.getType() + "'");
}
}
示例3: toString
import org.raml.model.parameter.AbstractParam; //导入方法依赖的package包/类
@Override
public String toString(Object o, String formatString, Locale locale) {
final AbstractParam param = (AbstractParam) o;
String s = "";
switch (formatString) {
case "intLimit":
if (param.getMinimum() != null) {
s += param.getMinimum() + "<=";
}
if (param.getMinimum() != null || param.getMaximum() != null) {
s += "x";
}
if (param.getMaximum() != null) {
s += "<=" + param.getMaximum();
}
return s;
case "strLimit":
if (param.getMinLength() != null) {
s += param.getMinLength() + "<=";
}
if (param.getMinLength() != null || param.getMaxLength() != null) {
s += "length";
}
if (param.getMaxLength() != null) {
s += "<=" + param.getMaxLength();
}
return s;
case "type":
return (param.getType() == null
? "string"
: param.getType().toString().toLowerCase()) +
(param.isRequired()
? param.isRepeat() ? "+" : ""
: param.isRepeat() ? "*" : "?");
case "enum":
return StringUtils.join(param.getEnumeration(), ", ");
default:
throw new IllegalArgumentException("unknown format '" + formatString + "'");
}
}
示例4: checkNullParameter
import org.raml.model.parameter.AbstractParam; //导入方法依赖的package包/类
private void checkNullParameter(AbstractParam param, Message detail) {
if (param.getType() == ParamType.STRING) {
checkStringParameter(param, "", detail);
} else {
violations.add(detail.withMessageParam("value.empty"));
}
}
示例5: checkFileParameter
import org.raml.model.parameter.AbstractParam; //导入方法依赖的package包/类
private void checkFileParameter(AbstractParam param, Message detail) {
if (param.getType() != ParamType.FILE) {
violations.add(detail.withMessageParam("file.superfluous", param.getType()));
}
}