Here you can find the source of getAnnotation(Object context, Class
Takes the target IckleActivity and finds the given annotation (if any).
Parameter | Description |
---|---|
injectorActivity | the IckleActivity whose metadata is searched <br><br> |
annotation | the Class of the Annotation to look for <br><br> |
public static <T extends Annotation> T getAnnotation(Object context, Class<T> annotation)
//package com.java2s; /*//from w w w. ja v a 2s. co m * #%L * IckleBot * %% * Copyright (C) 2013 Lonepulse * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ import java.lang.annotation.Annotation; public class Main { /** * <p>Takes the target {@link IckleActivity} and finds the given * annotation (if any).</p> * * @param injectorActivity * the {@link IckleActivity} whose metadata is searched * <br><br> * @param annotation * the {@link Class} of the {@link Annotation} to look for * <br><br> * @since 1.0.0 */ public static <T extends Annotation> T getAnnotation(Object context, Class<T> annotation) { Class<?> contextClass = context.getClass(); if (contextClass.isAnnotationPresent(annotation)) { return contextClass.getAnnotation(annotation); } else { return null; } } }