/** * Returns an array of this package's declared annotations. Package annotations aren't * inherited, so this is equivalent to {@link #getAnnotations}. */ public Annotation[] getDeclaredAnnotations() { return getAnnotations(); }
/** * Returns the annotation associated with the specified annotation type and * this package, if present. * * @param annotationType * the annotation type to look for. * @return an instance of {@link Annotation} or {@code null}. * @see java.lang.reflect.AnnotatedElement#getAnnotation(java.lang.Class) */ @SuppressWarnings("unchecked") public <A extends Annotation> A getAnnotation(Class<A> annotationType) { for (Annotation annotation : getAnnotations()) { if (annotationType.isInstance(annotation)) { return (A) annotation; } } return null; }
setAnnotationMetaData(classNode.getTypeClass().getPackage().getAnnotations(), packageNode);
/** * Returns an array of this package's declared annotations. Package annotations aren't * inherited, so this is equivalent to {@link #getAnnotations}. */ public Annotation[] getDeclaredAnnotations() { return getAnnotations(); }
/** * Returns an array of this package's declared annotations. Package annotations aren't * inherited, so this is equivalent to {@link #getAnnotations}. */ public Annotation[] getDeclaredAnnotations() { return getAnnotations(); }
/** * Returns an array of this package's declared annotations. Package annotations aren't * inherited, so this is equivalent to {@link #getAnnotations}. */ public Annotation[] getDeclaredAnnotations() { return getAnnotations(); }
av0.visitEnd(); if (clz.getPackage() != null && clz.getPackage().getAnnotations() != null) { for (Annotation ann : clz.getPackage().getAnnotations()) { if (ann instanceof XmlJavaTypeAdapters) { av0 = cw.visitAnnotation("Ljavax/xml/bind/annotation/adapters/XmlJavaTypeAdapters;", true);
/** * Returns an array of this package's declared annotations. Package annotations aren't * inherited, so this is equivalent to {@link #getAnnotations}. */ public Annotation[] getDeclaredAnnotations() { return getAnnotations(); }
/** * Returns an array of this package's declared annotations. Package annotations aren't * inherited, so this is equivalent to {@link #getAnnotations}. */ public Annotation[] getDeclaredAnnotations() { return getAnnotations(); }
/** * Returns an array of this package's declared annotations. Package annotations aren't * inherited, so this is equivalent to {@link #getAnnotations}. */ public Annotation[] getDeclaredAnnotations() { return getAnnotations(); }
import java.lang.annotation.Annotation; public class PackageAnnotationsTest { public static void main(String[] args) { Package myPackage = AClassInMyPackage.class.getPackage(); Annotation[] myPackageAnnotations = myPackage.getAnnotations(); System.out.println("Available annotations for package : " + myPackage.getName()); for(Annotation a : myPackageAnnotations) { System.out.println("\t * " + a.annotationType()); } } }
public static <T> String getNamespaceUriFromJaxbClass(Class<T> jaxbClass) throws BootStarterCxfException { for(Annotation annotation: jaxbClass.getPackage().getAnnotations()){ if(annotation.annotationType() == XmlSchema.class){ return ((XmlSchema)annotation).namespace(); } } throw new BootStarterCxfException("namespaceUri not found -> Is it really a JAXB-Class, thats used to call the method?"); }
public static <T> String getNamespaceUriFromJaxbClass(Class<T> jaxbClass) throws BusinessException { for(Annotation annotation: jaxbClass.getPackage().getAnnotations()){ if(annotation.annotationType() == XmlSchema.class){ return ((XmlSchema)annotation).namespace(); } } throw new BusinessException("namespaceUri not found -> Is it really a JAXB-Class, thats used to call the method?"); }
public <T extends Component> KiSecurityConstraint checkInvalidInstantiation( final Class<T> componentClass ) { KiSecurityConstraint fail = checkInvalidInstantiation( componentClass.getAnnotations(), KiAction.INSTANTIATE ); if( fail == null ) { fail = checkInvalidInstantiation( componentClass.getPackage().getAnnotations(), KiAction.INSTANTIATE ); } return fail; }
public <T extends Component> ShiroSecurityConstraint checkInvalidInstantiation( final Class<T> componentClass) { ShiroSecurityConstraint fail = checkInvalidInstantiation(componentClass.getAnnotations(), ShiroAction.INSTANTIATE); if (fail == null) fail = checkInvalidInstantiation(componentClass.getPackage().getAnnotations(), ShiroAction.INSTANTIATE); return fail; }
public static <T> String getNamespaceUriFromJaxbClass(Class<T> jaxbClass) throws InternalBusinessException { for(Annotation annotation: jaxbClass.getPackage().getAnnotations()){ if(annotation.annotationType() == XmlSchema.class){ return ((XmlSchema)annotation).namespace(); } } throw new InternalBusinessException("namespaceUri not found -> Is it really a JAXB-Class, thats used to call the method?"); }
public boolean isActionAuthorized(final Component component, final Action action) { KiAction _action = (action.getName().equals( Action.RENDER ) ) ? KiAction.RENDER : KiAction.ENABLE; Class<? extends Component> clazz = component.getClass(); KiSecurityConstraint fail = checkInvalidInstantiation( clazz.getAnnotations(), _action ); if( fail == null ) { fail = checkInvalidInstantiation( clazz.getPackage().getAnnotations(), _action ); } return fail == null; }
/** * {@inheritDoc} */ public boolean isActionAuthorized(final Component component, final Action action) { final ShiroAction _action = action.getName().equals(Action.RENDER) ? ShiroAction.RENDER : ShiroAction.ENABLE; final Class<? extends Component> clazz = component.getClass(); ShiroSecurityConstraint fail = checkInvalidInstantiation(clazz.getAnnotations(), _action); if (fail == null) fail = checkInvalidInstantiation(clazz.getPackage().getAnnotations(), _action); return fail == null; }
public static <T extends Annotation> T getAnnotation(final Package pck, final Class<T> api) { final T annotation = pck.getAnnotation(api); if (annotation != null) { return annotation; } return findMeta(pck.getAnnotations(), api); }
public static <T extends Annotation> T getAnnotation(final Package pck, final Class<T> api) { final T annotation = pck.getAnnotation(api); if (annotation != null) { return annotation; } return findMeta(pck.getAnnotations(), api); }