Package com.sun.xml.bind.v2.runtime.reflect

Examples of com.sun.xml.bind.v2.runtime.reflect.Accessor


/*    */   private final Accessor acc;
/*    */
/*    */   public RuntimeReferencePropertyInfoImpl(RuntimeClassInfoImpl classInfo, PropertySeed<Type, Class, Field, Method> seed)
/*    */   {
/* 57 */     super(classInfo, seed);
/* 58 */     Accessor rawAcc = ((RuntimeClassInfoImpl.RuntimePropertySeed)seed).getAccessor();
/* 59 */     if ((getAdapter() != null) && (!isCollection()))
/*    */     {
/* 62 */       rawAcc = rawAcc.adapt(getAdapter());
/* 63 */     }this.acc = rawAcc;
/*    */   }
View Full Code Here


/* 134 */     JaxBeanInfo bi = (JaxBeanInfo)this.expectedElements.get(nsUri, localName);
/* 135 */     if (bi != null) {
/* 136 */       if ((bi instanceof ElementBeanInfoImpl)) {
/* 137 */         ElementBeanInfoImpl ebi = (ElementBeanInfoImpl)bi;
/*     */
/* 139 */         return new Accessor(ebi.expectedType, ebi) {
/*     */           public Object get(BeanT bean) throws AccessorException {
/* 141 */             Object r = SingleReferenceNodeProperty.this.acc.get(bean);
/* 142 */             if ((r instanceof JAXBElement)) {
/* 143 */               return ((JAXBElement)r).getValue();
/*     */             }
View Full Code Here

/*     */
/*     */   public SingleTypePropertyInfoImpl(ClassInfoImpl<T, C, F, M> classInfo, PropertySeed<T, C, F, M> seed)
/*     */   {
/*  71 */     super(classInfo, seed);
/*  72 */     if ((this instanceof RuntimePropertyInfo)) {
/*  73 */       Accessor rawAcc = ((RuntimeClassInfoImpl.RuntimePropertySeed)seed).getAccessor();
/*  74 */       if ((getAdapter() != null) && (!isCollection()))
/*     */       {
/*  77 */         rawAcc = rawAcc.adapt(((RuntimePropertyInfo)this).getAdapter());
/*  78 */       }this.acc = rawAcc;
/*     */     } else {
/*  80 */       this.acc = null;
/*     */     }
/*     */   }
View Full Code Here

/* 241 */     assert (this.attributeWildcard != null);
/* 242 */     return ((RuntimePropertySeed)this.attributeWildcard).getAccessor();
/*     */   }
/*     */   protected RuntimePropertySeed createFieldSeed(Field field) {
/* 247 */     boolean readOnly = Modifier.isStatic(field.getModifiers());
/*     */     Accessor acc;
/*     */     try {
/* 250 */       acc = this.accessorFactory.createFieldAccessor((Class)this.clazz, field, readOnly);
/*     */     } catch (JAXBException e) {
/* 252 */       this.builder.reportError(new IllegalAnnotationException(Messages.CUSTOM_ACCESSORFACTORY_FIELD_ERROR.format(new Object[] { nav().getClassName(this.clazz), e.toString() }), this));
/*     */
View Full Code Here

/*     */     }
/* 257 */     return new RuntimePropertySeed(super.createFieldSeed(field), acc);
/*     */   }
/*     */
/*     */   public RuntimePropertySeed createAccessorSeed(Method getter, Method setter) {
/*     */     Accessor acc;
/*     */     try {
/* 264 */       acc = this.accessorFactory.createPropertyAccessor((Class)this.clazz, getter, setter);
/*     */     } catch (JAXBException e) {
/* 266 */       this.builder.reportError(new IllegalAnnotationException(Messages.CUSTOM_ACCESSORFACTORY_PROPERTY_ERROR.format(new Object[] { nav().getClassName(this.clazz), e.toString() }), this));
/*     */
View Full Code Here

/*    */   private final Accessor acc;
/*    */
/*    */   RuntimeElementPropertyInfoImpl(RuntimeClassInfoImpl classInfo, PropertySeed<Type, Class, Field, Method> seed)
/*    */   {
/* 59 */     super(classInfo, seed);
/* 60 */     Accessor rawAcc = ((RuntimeClassInfoImpl.RuntimePropertySeed)seed).getAccessor();
/* 61 */     if ((getAdapter() != null) && (!isCollection()))
/*    */     {
/* 64 */       rawAcc = rawAcc.adapt(getAdapter());
/* 65 */     }this.acc = rawAcc;
/*    */   }
View Full Code Here

/* 903 */     if (!(bi instanceof ClassBeanInfoImpl)) {
/* 904 */       throw new JAXBException(wrapperBean + " is not a bean");
/*     */     }
/* 906 */     for (ClassBeanInfoImpl cb = (ClassBeanInfoImpl)bi; cb != null; cb = cb.superClazz)
/* 907 */       for (Property p : cb.properties) {
/* 908 */         Accessor acc = p.getElementPropertyAccessor(nsUri, localName);
/* 909 */         if (acc != null)
/* 910 */           return new RawAccessor(acc)
/*     */           {
/*     */             public Object get(Object bean)
/*     */               throws AccessorException
View Full Code Here

        if(!(bi instanceof ClassBeanInfoImpl))
            throw new JAXBException(wrapperBean+" is not a bean");

        for( ClassBeanInfoImpl cb = (ClassBeanInfoImpl) bi; cb!=null; cb=cb.superClazz) {
            for (Property p : cb.properties) {
                final Accessor acc = p.getElementPropertyAccessor(nsUri,localName);
                if(acc!=null)
                    return new RawAccessor() {
                        // Accessor.set/get are designed for unmarshaller/marshaller, and hence
                        // they go through an adapter behind the scene.
                        // this isn't desirable for JAX-WS, which essentially uses this method
                        // just as a reflection library. So use the "unadapted" version to
                        // achieve the desired semantics
                        public Object get(Object bean) throws AccessorException {
                            return acc.getUnadapted(bean);
                        }

                        public void set(Object bean, Object value) throws AccessorException {
                            acc.setUnadapted(bean,value);
                        }
                    };
            }
        }
        throw new JAXBException(new QName(nsUri,localName)+" is not a valid property on "+wrapperBean);
View Full Code Here

        if(!(bi instanceof ClassBeanInfoImpl))
            throw new JAXBException(wrapperBean+" is not a bean");

        for( ClassBeanInfoImpl cb = (ClassBeanInfoImpl) bi; cb!=null; cb=cb.superClazz) {
            for (Property p : cb.properties) {
                final Accessor acc = p.getElementPropertyAccessor(nsUri,localName);
                if(acc!=null)
                    return new RawAccessor() {
                        // Accessor.set/get are designed for unmarshaller/marshaller, and hence
                        // they go through an adapter behind the scene.
                        // this isn't desirable for JAX-WS, which essentially uses this method
                        // just as a reflection library. So use the "unadapted" version to
                        // achieve the desired semantics
                        public Object get(Object bean) throws AccessorException {
                            return acc.getUnadapted(bean);
                        }

                        public void set(Object bean, Object value) throws AccessorException {
                            acc.setUnadapted(bean,value);
                        }
                    };
            }
        }
        throw new JAXBException(new QName(nsUri,localName)+" is not a valid property on "+wrapperBean);
View Full Code Here

    }

    @Override
    protected RuntimePropertySeed createFieldSeed(Field field) {
       final boolean readOnly = Modifier.isStatic(field.getModifiers());
        Accessor acc;
        try {
            if (supressAccessorWarnings) {
                acc = ((InternalAccessorFactory)accessorFactory).createFieldAccessor(clazz, field, readOnly, supressAccessorWarnings);
            } else {
                acc = accessorFactory.createFieldAccessor(clazz, field, readOnly);
View Full Code Here

TOP

Related Classes of com.sun.xml.bind.v2.runtime.reflect.Accessor

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.