/** * Returns <jk>true</jk> if the {@link #getAnnotation(Class, Method, int)} returns a value. * * @param a The annotation to check for. * @param m The method containing the parameter to check. * @param index The parameter index. * @return <jk>true</jk> if the {@link #getAnnotation(Class, Method, int)} returns a value. */ public static boolean hasAnnotation(Class<? extends Annotation> a, Method m, int index) { return getAnnotation(a, m, index) != null; }
/** * Shortcut for calling <code>getAnnotation(a,m,index,<jk>true</jk>,<jk>true</jk>)</code> * * @param a The annotation to check for. * @param m The method containing the parameter to check. * @param index The parameter index. * @return <jk>true</jk> if the {@link #getAnnotation(Class, Method, int)} returns a value. */ public static <T extends Annotation> T getAnnotation(Class<T> a, Method m, int index) { return getAnnotation(a, m, index, true, true); }
/** * Returns <jk>true</jk> if the {@link #getAnnotation(Class, Type)} returns a value. * * @param a The annotation to check for. * @param t The class to check. * @return <jk>true</jk> if the {@link #getAnnotation(Class, Type)} returns a value. */ public static boolean hasAnnotation(Class<? extends Annotation> a, Type t) { return getAnnotation(a, t) != null; }
/** * Shortcut for calling <code>getAnnotation(a,m,index,<jk>true</jk>,<jk>true</jk>)</code> * * @param a The annotation to check for. * @param m The method containing the parameter to check. * @param index The parameter index. * @return <jk>true</jk> if the {@link #getAnnotation(Class, Method, int)} returns a value. */ public static <T extends Annotation> T getAnnotation(Class<T> a, Method m, int index) { return getAnnotation(a, m, index, true, true); }
/** * Returns <jk>true</jk> if the {@link #getAnnotation(Class, Method)} returns a value. * * @param a The annotation to check for. * @param m The method to check. * @return <jk>true</jk> if the {@link #getAnnotation(Class, Method)} returns a value. */ public static boolean hasAnnotation(Class<? extends Annotation> a, Method m) { return getAnnotation(a, m) != null; }
/** * Returns <jk>true</jk> if the {@link #getAnnotation(Class, Type)} returns a value. * * @param a The annotation to check for. * @param t The class to check. * @return <jk>true</jk> if the {@link #getAnnotation(Class, Type)} returns a value. */ public static boolean hasAnnotation(Class<? extends Annotation> a, Type t) { return getAnnotation(a, t) != null; }
/** * Returns <jk>true</jk> if the {@link #getAnnotation(Class, Method)} returns a value. * * @param a The annotation to check for. * @param m The method to check. * @return <jk>true</jk> if the {@link #getAnnotation(Class, Method)} returns a value. */ public static boolean hasAnnotation(Class<? extends Annotation> a, Method m) { return getAnnotation(a, m) != null; }
/** * Shortcut for calling <code>getAnnotation(a,m,index,<jk>true</jk>,<jk>true</jk>)</code> * * @param a The annotation to check for. * @param m The method containing the parameter to check. * @param index The parameter index. * @return <jk>true</jk> if the {@link #getAnnotation(Class, Method, int)} returns a value. */ public static <T extends Annotation> T getAnnotation(Class<T> a, Method m, int index) { return getAnnotation(a, m, index, true, true); }
/** * Returns <jk>true</jk> if the {@link #getAnnotation(Class, Type)} returns a value. * * @param a The annotation to check for. * @param t The class to check. * @return <jk>true</jk> if the {@link #getAnnotation(Class, Type)} returns a value. */ public static boolean hasAnnotation(Class<? extends Annotation> a, Type t) { return getAnnotation(a, t) != null; }
/** * Returns <jk>true</jk> if the {@link #getAnnotation(Class, Method, int)} returns a value. * * @param a The annotation to check for. * @param m The method containing the parameter to check. * @param index The parameter index. * @return <jk>true</jk> if the {@link #getAnnotation(Class, Method, int)} returns a value. */ public static boolean hasAnnotation(Class<? extends Annotation> a, Method m, int index) { return getAnnotation(a, m, index) != null; }
/** * Returns <jk>true</jk> if the {@link #getAnnotation(Class, Method)} returns a value. * * @param a The annotation to check for. * @param m The method to check. * @return <jk>true</jk> if the {@link #getAnnotation(Class, Method)} returns a value. */ public static boolean hasAnnotation(Class<? extends Annotation> a, Method m) { return getAnnotation(a, m) != null; }
/** * Returns <jk>true</jk> if the {@link #getAnnotation(Class, Method, int)} returns a value. * * @param a The annotation to check for. * @param m The method containing the parameter to check. * @param index The parameter index. * @return <jk>true</jk> if the {@link #getAnnotation(Class, Method, int)} returns a value. */ public static boolean hasAnnotation(Class<? extends Annotation> a, Method m, int index) { return getAnnotation(a, m, index) != null; }
/** * Constructor. * * @param cm The class that this annotation is defined on. * @throws Exception If invalid <ja>@Schema</ja> definition was encountered. */ public JsonSchemaClassMeta(ClassMeta<?> cm) throws Exception { super(cm); Schema s = ClassUtils.getAnnotation(Schema.class, getInnerClass()); schema = s == null ? ObjectMap.EMPTY_MAP : SchemaUtils.asMap(s); }
/** * Constructor. * * @param cm The class that this annotation is defined on. * @throws Exception If invalid <ja>@Schema</ja> definition was encountered. */ public JsonSchemaClassMeta(ClassMeta<?> cm) throws Exception { super(cm); Schema s = ClassUtils.getAnnotation(Schema.class, getInnerClass()); schema = s == null ? ObjectMap.EMPTY_MAP : SchemaUtils.asMap(s); }
/** * Constructor. * * @param cm The class that this annotation is defined on. * @throws Exception If invalid <ja>@Schema</ja> definition was encountered. */ public JsonSchemaClassMeta(ClassMeta<?> cm) throws Exception { super(cm); Schema s = ClassUtils.getAnnotation(Schema.class, getInnerClass()); schema = s == null ? ObjectMap.EMPTY_MAP : SchemaUtils.asMap(s); }
private Operation getSwaggerOperation(Method method, RestRequest req) throws Exception { Swagger s = getSwagger(req); if (s != null) { Map<String,OperationMap> sp = s.getPaths(); if (sp != null) { Map<String,Operation> spp = sp.get(getAnnotation(RestMethod.class, method).path()); if (spp != null) return spp.get(req.getMethod()); } } return null; }
private Operation getSwaggerOperation(Method method, RestRequest req) throws Exception { Swagger s = getSwagger(req); if (s != null) { Map<String,OperationMap> sp = s.getPaths(); if (sp != null) { Map<String,Operation> spp = sp.get(getAnnotation(RestMethod.class, method).path()); if (spp != null) return spp.get(req.getMethod()); } } return null; }
private Operation getSwaggerOperation(Method method, RestRequest req) throws Exception { Swagger s = getSwagger(req); if (s != null) { Map<String,OperationMap> sp = s.getPaths(); if (sp != null) { Map<String,Operation> spp = sp.get(getAnnotation(RestMethod.class, method).path()); if (spp != null) return spp.get(req.getMethod()); } } return null; }
/** * Constructor. * * @param clientVersionHeader * The HTTP request header name containing the client version. * If <jk>null</jk> or an empty string, uses <js>"X-Client-Version"</js> * @param javaMethod The version string that the client version must match. */ protected ClientVersionMatcher(String clientVersionHeader, java.lang.reflect.Method javaMethod) { this.clientVersionHeader = isEmpty(clientVersionHeader) ? "X-Client-Version" : clientVersionHeader; RestMethod m = getAnnotation(RestMethod.class, javaMethod); range = new VersionRange(m.clientVersion()); }
@Test public void getMethodAnnotations() throws Exception { assertEquals("a1", getAnnotation(TestAnnotation.class, CI3.class.getMethod("a1")).value()); assertEquals("a2b", getAnnotation(TestAnnotation.class, CI3.class.getMethod("a2")).value()); assertEquals("a3", getAnnotation(TestAnnotation.class, CI3.class.getMethod("a3", CharSequence.class)).value()); assertEquals("a4", getAnnotation(TestAnnotation.class, CI3.class.getMethod("a4")).value()); }