Package java.lang.reflect

Examples of java.lang.reflect.AnnotatedElement


     *
     * Return true if this field accessor represents a m-m relationship.
     */
  public static boolean isManyToMany(MetadataAccessibleObject accessibleObject, MetadataDescriptor descriptor) {
        Class rawClass = accessibleObject.getRawClass();
        AnnotatedElement annotatedElement = accessibleObject.getAnnotatedElement();
       
        if (isAnnotationPresent(ManyToMany.class, annotatedElement, descriptor)) {
            if (MetadataHelper.isSupportedCollectionClass(rawClass)) {
                return true;
            } else {
View Full Code Here


     * INTERNAL:
     *
   * Return true if this accessor represents a 1-m relationship.
     */
  public static boolean isOneToMany(MetadataAccessibleObject accessibleObject, MetadataDescriptor descriptor) {
        AnnotatedElement annotatedElement = accessibleObject.getAnnotatedElement();
       
        if (isAnnotationNotPresent(OneToMany.class, annotatedElement, descriptor)) {
            if (MetadataHelper.isGenericCollectionType(accessibleObject.getRelationType()) &&
                MetadataHelper.isSupportedCollectionClass(accessibleObject.getRawClass()) &&
                descriptor.getProject().containsDescriptor(accessibleObject.getReferenceClassFromGeneric())) {
View Full Code Here

     * INTERNAL:
     *
     * Return true if this accessor represents a 1-1 relationship.
     */
  public static boolean isOneToOne(MetadataAccessibleObject accessibleObject, MetadataDescriptor descriptor) {
        AnnotatedElement annotatedElement = accessibleObject.getAnnotatedElement();
       
        if (isAnnotationNotPresent(OneToOne.class, annotatedElement, descriptor)) {
            if (descriptor.getProject().containsDescriptor(accessibleObject.getRawClass()) &&
                ! isEmbedded(accessibleObject, descriptor)) {
               
View Full Code Here

     * @return a new EjbDescriptor
     */
    protected EjbDescriptor createEjbDescriptor(String elementName,
            AnnotationInfo ainfo) throws AnnotationProcessorException {

        AnnotatedElement ae = ainfo.getAnnotatedElement();
        EjbMessageBeanDescriptor newDescriptor = new EjbMessageBeanDescriptor();
        Class ejbClass = (Class)ae;
        newDescriptor.setName(elementName);
        newDescriptor.setEjbClassName(ejbClass.getName());
        return newDescriptor;
View Full Code Here

            return null;
        }
    }

    public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
        AnnotatedElement annotated = getUnsatisfiedElement();
        if (annotated!=null) {
            return annotated.getAnnotation(annotationType);
        } else {
            return null;
        }
    }
View Full Code Here

   
    public HandlerProcessingResult processAnnotation(AnnotationInfo annInfo)
        throws AnnotationProcessorException {
       
        AnnotatedElementHandler annCtx = annInfo.getProcessingContext().getHandler();
        AnnotatedElement annElem = annInfo.getAnnotatedElement();   
        Class declaringClass;
       
        boolean serviceSideChain =
                ((annElem.getAnnotation(WebService.class) != null) ||
                 (annElem.getAnnotation(WebServiceProvider.class) != null)) ? true : false;
        if(serviceSideChain) {
            declaringClass = (Class)annElem;
        } else {
            if (annInfo.getElementType().equals(ElementType.FIELD)) {
                // this is a field injection
View Full Code Here

    public HandlerProcessingResult processAnnotation(AnnotationInfo annInfo)
        throws AnnotationProcessorException
    {
        AnnotatedElementHandler annCtx = annInfo.getProcessingContext().getHandler();
        AnnotatedElement annElem = annInfo.getAnnotatedElement();
        AnnotatedElement origAnnElem = annElem;

        boolean ejbInWar = ignoreWebserviceAnnotations(annElem, annCtx);
        //Bug  http://monaco.sfbay/detail.jsf?cr=6956406
        //When there is an ejb webservice packaged in a war
        //ignore the annotation processing for WebBundleDescriptor
View Full Code Here

   
    public HandlerProcessingResult processAnnotation(AnnotationInfo annInfo)
        throws AnnotationProcessorException    
    {
        AnnotatedElementHandler annCtx = annInfo.getProcessingContext().getHandler();
        AnnotatedElement annElem = annInfo.getAnnotatedElement();
       
        boolean ejbInWar = ignoreWebserviceAnnotations(annElem, annCtx);
        //Bug  http://monaco.sfbay/detail.jsf?cr=6956406
        //When there is an ejb webservice packaged in a war
        //ignore the annotation processing for WebBundleDescriptor
        //In Ejb webservice in a war there are 2 bundle descriptors
        //so we should just allow the processing for the EjbBundleDescriptor
        //and add webservices to that BundleDescriptor
        if (ejbInWar) {
            return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.PROCESSED);
        }

        // sanity check
        if (!(annElem instanceof Class)) {
            AnnotationProcessorException ape = new AnnotationProcessorException(
                    "@WebServiceProvider can only be specified on TYPE", annInfo);
            annInfo.getProcessingContext().getErrorHandler().error(ape);
            return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.FAILED);                       
        }            

        if(isJaxwsRIDeployment(annInfo)) {
            // Looks like JAX-WS RI specific deployment, do not process Web Service annotations otherwise would end up as two web service endpoints
            logger.info(format(rb.getString("enterprise.webservice.deployment.disabled"),
                    annInfo.getProcessingContext().getArchive().getName(),"WEB-INF/sun-jaxws.xml"));
            return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.PROCESSED);
        }
       
        // WebServiceProvider MUST implement the provider interface, let's check this
        if (!javax.xml.ws.Provider.class.isAssignableFrom((Class) annElem)) {
            AnnotationProcessorException ape = new AnnotationProcessorException(
                    annElem.toString() + "does not implement the javax.xml.ws.Provider interface", annInfo);
            annInfo.getProcessingContext().getErrorHandler().error(ape);
            return HandlerProcessingResultImpl.getDefaultResult(getAnnotationType(), ResultType.FAILED);                                   
        }
   
        // let's get the main annotation of interest.
View Full Code Here

        }
       
        // for now, only consider need to handle default creator
        AnnotatedWithParams defaultCreator = _originalInstantiator.getDefaultCreator();
        if (defaultCreator != null) {
            AnnotatedElement elem = defaultCreator.getAnnotated();
            if (elem instanceof Constructor<?>) {
                return createSubclass((Constructor<?>) elem, null);
            }
            if (elem instanceof Method) {
                Method m = (Method) elem;
View Full Code Here

     */

    protected String _findParaName(AnnotatedParameter param)
    {
        int index = param.getIndex();
        AnnotatedElement ctor = param.getOwner().getAnnotated();
        String[] names = _paranamer.lookupParameterNames((AccessibleObject) ctor);
        if (names != null) {
            if (index < names.length) {
                return names[index];
            }
View Full Code Here

TOP

Related Classes of java.lang.reflect.AnnotatedElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.