@Path("P") public static class SB02 { public String f1; } @RestMethod(name=GET,path="/autoDetectBean/{P}")
/** * 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(Path a) { if (a == null) return true; return allEmpty(a.description(), a._enum(), a.example(), a.api()) && allEmpty(a.name(), a.value(), a.type(), a.format(), a.pattern(), a.maximum(), a.minimum(), a.multipleOf()) && allFalse(a.exclusiveMaximum(), a.exclusiveMinimum(), a.uniqueItems()) && allMinusOne(a.maxLength(), a.minLength(), a.maxItems(), a.minItems()) && empty(a.items()); }
HttpPartSchemaBuilder apply(Path a) { name(a.value()); name(a.name()); type(a.type()); format(a.format()); items(a.items()); allowEmptyValue(a.allowEmptyValue()); collectionFormat(a.collectionFormat()); maximum(HttpPartSchema.toNumber(a.maximum())); exclusiveMaximum(a.exclusiveMaximum()); minimum(HttpPartSchema.toNumber(a.minimum())); exclusiveMinimum(a.exclusiveMinimum()); maxLength(a.maxLength()); minLength(a.minLength()); pattern(a.pattern()); maxItems(a.maxItems()); minItems(a.minItems()); uniqueItems(a.uniqueItems()); _enum(HttpPartSchema.toSet(a._enum())); multipleOf(HttpPartSchema.toNumber(a.multipleOf())); parser(a.parser()); serializer(a.serializer()); // Path remainder always allows empty value. if (startsWith(name, '/')) allowEmptyValue(); else required(true); 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(Path a) { if (a == null) return true; return allEmpty(a.description(), a._enum(), a.example(), a.api()) && allEmpty(a.name(), a.value(), a.type(), a.format(), a.pattern(), a.maximum(), a.minimum(), a.multipleOf()) && allFalse(a.exclusiveMaximum(), a.exclusiveMinimum(), a.uniqueItems()) && allMinusOne(a.maxLength(), a.minLength(), a.maxItems(), a.minItems()) && empty(a.items()); }
HttpPartSchemaBuilder apply(Path a) { name(a.value()); name(a.name()); type(a.type()); format(a.format()); items(a.items()); allowEmptyValue(a.allowEmptyValue()); collectionFormat(a.collectionFormat()); maximum(HttpPartSchema.toNumber(a.maximum())); exclusiveMaximum(a.exclusiveMaximum()); minimum(HttpPartSchema.toNumber(a.minimum())); exclusiveMinimum(a.exclusiveMinimum()); maxLength(a.maxLength()); minLength(a.minLength()); pattern(a.pattern()); maxItems(a.maxItems()); minItems(a.minItems()); uniqueItems(a.uniqueItems()); _enum(HttpPartSchema.toSet(a._enum())); multipleOf(HttpPartSchema.toNumber(a.multipleOf())); parser(a.parser()); serializer(a.serializer()); // Path remainder always allows empty value. if (startsWith(name, '/')) allowEmptyValue(); else required(true); return this; }
@RemoteMethod(method=DELETE, path="/user/{username}") public Ok deleteUser( @Path( name="username", description="The name that needs to be deleted" ) String username ) throws InvalidUsername, IdNotFound, NotAcceptable;
/** * 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(Path a) { if (a == null) return true; return allEmpty(a.description(), a._enum(), a.example(), a.api()) && allEmpty(a.name(), a.value(), a.type(), a.format(), a.pattern(), a.maximum(), a.minimum(), a.multipleOf()) && allFalse(a.exclusiveMaximum(), a.exclusiveMinimum(), a.uniqueItems()) && allMinusOne(a.maxLength(), a.minLength(), a.maxItems(), a.minItems()) && empty(a.items()); }
HttpPartSchemaBuilder apply(Path a) { name(a.value()); name(a.name()); type(a.type()); format(a.format()); items(a.items()); allowEmptyValue(a.allowEmptyValue()); collectionFormat(a.collectionFormat()); maximum(HttpPartSchema.toNumber(a.maximum())); exclusiveMaximum(a.exclusiveMaximum()); minimum(HttpPartSchema.toNumber(a.minimum())); exclusiveMinimum(a.exclusiveMinimum()); maxLength(a.maxLength()); minLength(a.minLength()); pattern(a.pattern()); maxItems(a.maxItems()); minItems(a.minItems()); uniqueItems(a.uniqueItems()); _enum(HttpPartSchema.toSet(a._enum())); multipleOf(HttpPartSchema.toNumber(a.multipleOf())); parser(a.parser()); serializer(a.serializer()); // Path remainder always allows empty value. if (startsWith(name, '/')) allowEmptyValue(); else required(true); return this; }
@RemoteMethod(path="/pet/{petId}") /* method inferred from method name */ public Pet getPet( @Path( name="petId", description="ID of pet to return", example="123" ) long petId ) throws IdNotFound, NotAcceptable;
private ObjectMap merge(ObjectMap om, Path a) throws ParseException { if (empty(a)) return om; om = newMap(om); if (a.api().length > 0) om.putAll(parseMap(a.api())); return om .appendSkipEmpty("collectionFormat", a.collectionFormat()) .appendSkipEmpty("description", resolve(a.description())) .appendSkipEmpty("enum", toSet(a._enum())) .appendSkipEmpty("x-example", resolve(a.example())) .appendSkipFalse("exclusiveMaximum", a.exclusiveMaximum()) .appendSkipFalse("exclusiveMinimum", a.exclusiveMinimum()) .appendSkipEmpty("format", a.format()) .appendSkipEmpty("items", merge(om.getObjectMap("items"), a.items())) .appendSkipEmpty("maximum", a.maximum()) .appendSkipMinusOne("maxItems", a.maxItems()) .appendSkipMinusOne("maxLength", a.maxLength()) .appendSkipEmpty("minimum", a.minimum()) .appendSkipMinusOne("minItems", a.minItems()) .appendSkipMinusOne("minLength", a.minLength()) .appendSkipEmpty("multipleOf", a.multipleOf()) .appendSkipEmpty("pattern", a.pattern()) .appendSkipEmpty("type", a.type()) .appendSkipFalse("uniqueItems", a.uniqueItems()) ; }
@RemoteMethod(method=DELETE, path="/store/order/{orderId}") public Ok deleteOrder( @Path( name="orderId", description="ID of the order that needs to be deleted", minimum="1", example="5" ) long orderId ) throws InvalidId, IdNotFound, NotAcceptable;
private ObjectMap merge(ObjectMap om, Path a) throws ParseException { if (empty(a)) return om; om = newMap(om); if (a.api().length > 0) om.putAll(parseMap(a.api())); return om .appendSkipEmpty("collectionFormat", a.collectionFormat()) .appendSkipEmpty("description", resolve(a.description())) .appendSkipEmpty("enum", toSet(a._enum())) .appendSkipEmpty("x-example", resolve(a.example())) .appendSkipFalse("exclusiveMaximum", a.exclusiveMaximum()) .appendSkipFalse("exclusiveMinimum", a.exclusiveMinimum()) .appendSkipEmpty("format", a.format()) .appendSkipEmpty("items", merge(om.getObjectMap("items"), a.items())) .appendSkipEmpty("maximum", a.maximum()) .appendSkipMinusOne("maxItems", a.maxItems()) .appendSkipMinusOne("maxLength", a.maxLength()) .appendSkipEmpty("minimum", a.minimum()) .appendSkipMinusOne("minItems", a.minItems()) .appendSkipMinusOne("minLength", a.minLength()) .appendSkipEmpty("multipleOf", a.multipleOf()) .appendSkipEmpty("pattern", a.pattern()) .appendSkipEmpty("type", a.type()) .appendSkipFalse("uniqueItems", a.uniqueItems()) ; }
@RemoteMethod(method=GET, path="/store/order/{orderId}") public Order getOrder( @Path( name="orderId", description="ID of order to fetch", maximum="1000", minimum="1", example="123" ) long orderId ) throws InvalidId, IdNotFound, NotAcceptable;
private ObjectMap merge(ObjectMap om, Path a) throws ParseException { if (empty(a)) return om; om = newMap(om); if (a.api().length > 0) om.putAll(parseMap(a.api())); return om .appendSkipEmpty("collectionFormat", a.collectionFormat()) .appendSkipEmpty("description", resolve(a.description())) .appendSkipEmpty("enum", toSet(a._enum())) .appendSkipEmpty("x-example", resolve(a.example())) .appendSkipFalse("exclusiveMaximum", a.exclusiveMaximum()) .appendSkipFalse("exclusiveMinimum", a.exclusiveMinimum()) .appendSkipEmpty("format", a.format()) .appendSkipEmpty("items", merge(om.getObjectMap("items"), a.items())) .appendSkipEmpty("maximum", a.maximum()) .appendSkipMinusOne("maxItems", a.maxItems()) .appendSkipMinusOne("maxLength", a.maxLength()) .appendSkipEmpty("minimum", a.minimum()) .appendSkipMinusOne("minItems", a.minItems()) .appendSkipMinusOne("minLength", a.minLength()) .appendSkipEmpty("multipleOf", a.multipleOf()) .appendSkipEmpty("pattern", a.pattern()) .appendSkipEmpty("type", a.type()) .appendSkipFalse("uniqueItems", a.uniqueItems()) ; }
@RemoteMethod(method=GET, path="/user/{username}") public User getUser( @Path( name="username", description="The name that needs to be fetched. Use user1 for testing." ) String username ) throws InvalidUsername, IdNotFound, NotAcceptable;
@RemoteMethod(method=DELETE, path="/user/{username}") public Ok deleteUser( @Path( name="username", description="The name that needs to be deleted" ) String username ) throws InvalidUsername, IdNotFound, NotAcceptable;
@Path(name="P", example={" {f1:'a'} "}) public static class SC01 { public String f1; } @RestMethod(name=GET,path="/example/{P}")
@RemoteMethod(method=DELETE, path="/store/order/{orderId}") public Ok deleteOrder( @Path( name="orderId", description="ID of the order that needs to be deleted", minimum="1", example="5" ) long orderId ) throws InvalidId, IdNotFound, NotAcceptable;
@Path(name="P", _enum={" ['a','b'] "}) public static class SA19 { @Override public String toString() { return "sa19"; } } @RestMethod(name=GET,path="/enum/{P}")
@RemoteMethod(method=GET, path="/store/order/{orderId}") public Order getOrder( @Path( name="orderId", description="ID of order to fetch", maximum="1000", minimum="1", example="123" ) long orderId ) throws InvalidId, IdNotFound, NotAcceptable;