@Response(description="File action") public static class Action extends LinkString { public Action(String name, String uri, Object...uriArgs) { super(name, uri, uriArgs); } }
Builder apply(Response a) { if (a != null) { if (a.partSerializer() != HttpPartSerializer.Null.class) partSerializer = a.partSerializer(); if (a.partParser() != HttpPartParser.Null.class) partParser = a.partParser(); if (a.value().length > 0) code = a.value()[0]; if (a.code().length > 0) code = a.code()[0]; schema.apply(a.schema()); } return this; }
/** * Returns <jk>true</jk> if the specified annotation contains all default values. * * @param a The annotation to check. * @return <jk>true</jk> if the specified annotation contains all default values. */ public static boolean empty(Response a) { if (a == null) return true; return allEmpty(a.description(), a.example(), a.examples(), a.api()) && a.headers().length == 0 && empty(a.schema()) ; }
expected = bodyType.getAnnotation(Response.class).code();
expected = bodyType.getAnnotation(Response.class).code();
@Response(schema=@Schema(type="string",format="binary"), description="Contents of file") static class FileContents extends FileInputStream { public FileContents(File file) throws FileNotFoundException { super(file); } }
/** * Returns <jk>true</jk> if the specified annotation contains all default values. * * @param a The annotation to check. * @return <jk>true</jk> if the specified annotation contains all default values. */ public static boolean empty(Response a) { if (a == null) return true; return allEmpty(a.description(), a.example(), a.examples(), a.api()) && a.headers().length == 0 && empty(a.schema()) ; }
Builder apply(Response a) { if (a != null) { if (a.partSerializer() != HttpPartSerializer.Null.class) partSerializer = a.partSerializer(); if (a.partParser() != HttpPartParser.Null.class) partParser = a.partParser(); if (a.value().length > 0) code = a.value()[0]; if (a.code().length > 0) code = a.code()[0]; schema.apply(a.schema()); } return this; }
expected = bodyType.getAnnotation(Response.class).code();
@Response(schema=@Schema(type="string",format="binary"), description="Contents of file") static class FileContents extends FileInputStream { public FileContents(File file) throws FileNotFoundException { super(file); } }
/** * Returns <jk>true</jk> if the specified annotation contains all default values. * * @param a The annotation to check. * @return <jk>true</jk> if the specified annotation contains all default values. */ public static boolean empty(Response a) { if (a == null) return true; return allEmpty(a.description(), a.example(), a.examples(), a.api()) && a.headers().length == 0 && empty(a.schema()) ; }
Builder apply(Response a) { if (a != null) { if (a.partSerializer() != HttpPartSerializer.Null.class) partSerializer = a.partSerializer(); if (a.partParser() != HttpPartParser.Null.class) partParser = a.partParser(); if (a.value().length > 0) code = a.value()[0]; if (a.code().length > 0) code = a.code()[0]; schema.apply(a.schema()); } return this; }
@Response(description="File action") public static class Action extends LinkString { public Action(String name, String uri, Object...uriArgs) { super(name, uri, uriArgs); } }
private ObjectMap merge(ObjectMap om, Response a) throws ParseException { if (empty(a)) return om; om = newMap(om); if (a.api().length > 0) om.putAll(parseMap(a.api())); return om .appendSkipEmpty("description", resolve(a.description())) .appendSkipEmpty("x-example", resolve(a.example())) .appendSkipEmpty("examples", parseMap(a.examples())) .appendSkipEmpty("headers", merge(om.getObjectMap("headers"), a.headers())) .appendSkipEmpty("schema", merge(om.getObjectMap("schema"), a.schema())) ; }
HttpPartSchemaBuilder apply(Response a) { codes(a.value()); codes(a.code()); required(false); allowEmptyValue(true); serializer(a.partSerializer()); parser(a.partParser()); apply(a.schema()); return this; }
@Response(description="Section not found.") private class SectionNotFound extends NotFound { private static final long serialVersionUID = 1L; SectionNotFound() { super("Section not found."); } }
private ObjectMap merge(ObjectMap om, Response a) throws ParseException { if (empty(a)) return om; om = newMap(om); if (a.api().length > 0) om.putAll(parseMap(a.api())); return om .appendSkipEmpty("description", resolve(a.description())) .appendSkipEmpty("x-example", resolve(a.example())) .appendSkipEmpty("examples", parseMap(a.examples())) .appendSkipEmpty("headers", merge(om.getObjectMap("headers"), a.headers())) .appendSkipEmpty("schema", merge(om.getObjectMap("schema"), a.schema())) ; }