Class<?> toJavaType(MType type) { if(type.isSimpleType()) { return type.asSimpleType().getJavaType(); } if(type.isCollectionType()) { return Array.newInstance(toJavaType(type.asCollectionType().getElementType()), 0).getClass(); } if(type.isComplexType() || type.isDictionaryType() || type.isTypeRef()) { return Map.class; } if(type.isObjectType()) { return Object.class; } throw new IllegalStateException("Unsupported data type '" + type + "'"); }
protected boolean isBodyType(MType type) { if(type.isComplexType()) { return true; } if(type.isTypeRef()) { return true; } if(type.isDictionaryType()) { return true; } if(type.isCollectionType()) { MType elementType = type.asCollectionType().getElementType(); return isBodyType(elementType); } return false; }
private static boolean hasUnresolvedType(MType type) { if(type instanceof MUnresolvedTypeRef) { return true; } if(type.isCollectionType()) { return hasUnresolvedType(type.asCollectionType().getElementType()); } if(type.isDictionaryType()) { return hasUnresolvedType(type.asDictionaryType().getValueType()); } return false; }
protected boolean setDefaultLocation(RouteBuilder route, MApiParameterBuilder p) { if(null == p.getLocation()) { if (route.getPathTemplate().getTemplateVariables().contains(p.getName())) { p.setLocation(MApiParameter.Location.PATH); return true; } if(p.getType().isComplexType() || p.getType().isTypeRef() || p.getType().isDictionaryType()) { p.setLocation(MApiParameter.Location.BODY); return true; } p.setLocation(MApiParameter.Location.QUERY); return true; } return false; }
public static String toTypeName(MType type) { if(type.isSimpleType()) { SwaggerType st = swaggerWriter.convertSimpleType(type.asSimpleType()); if(null == st) { throw new IllegalStateException("Unsupported type '" + type + "'"); } return st.name().toLowerCase(); } if(type.isCollectionType()) { MType elementType = type.asCollectionType().getElementType(); return "array<" + toTypeName(elementType) + ">"; } if(type.isComplexType()) { return type.asComplexType().getName(); } if(type.isTypeRef()) { return type.asTypeRef().getRefTypeName(); } if(type.isDictionaryType()) { return "map<string," + toTypeName(type.asDictionaryType().getValueType()) + ">"; } if(type.isObjectType()) { return "object"; } if(type.isVoidType()) { return ""; } throw new IllegalStateException("Unsupported type '" + type + "'"); }
if(type.isDictionaryType()) { arg.setType(Map.class); return;
if(type.isDictionaryType()) { writeDictionaryType(context, m, w, type.asDictionaryType()); return;
if(type.isDictionaryType()) { writeDictionaryType(context, m, w, type.asDictionaryType()); return;
if(type.isDictionaryType()) { return ofMap(api, name, required, type.asDictionaryType());