Class Accessor<BeanT,​ValueT>

    • Field Detail

      • valueType

        public final java.lang.Class<ValueT> valueType
      • JAXB_ELEMENT_VALUE

        public static final Accessor<javax.xml.bind.JAXBElement,​java.lang.Object> JAXB_ELEMENT_VALUE
        Accessor for JAXBElement.getValue().
    • Constructor Detail

      • Accessor

        protected Accessor​(java.lang.Class<ValueT> valueType)
    • Method Detail

      • getValueType

        public java.lang.Class<ValueT> getValueType()
      • get

        public abstract ValueT get​(BeanT bean)
                            throws AccessorException
        Gets the value of the property of the given bean object.
        Parameters:
        bean - must not be null.
        Throws:
        AccessorException - if failed to set a value. For example, the getter method may throw an exception.
        Since:
        2.0 EA1
      • set

        public abstract void set​(BeanT bean,
                                 ValueT value)
                          throws AccessorException
        Sets the value of the property of the given bean object.
        Parameters:
        bean - must not be null.
        value - the value to be set. Setting value to null means resetting to the VM default value (even for primitive properties.)
        Throws:
        AccessorException - if failed to set a value. For example, the setter method may throw an exception.
        Since:
        2.0 EA1
      • isAdapted

        public boolean isAdapted()
        Returns true if this accessor wraps an adapter.

        This method needs to be used with care, but it helps some optimization.

      • receive

        public void receive​(UnmarshallingContext.State state,
                            java.lang.Object o)
                     throws org.xml.sax.SAXException
        Description copied from interface: Receiver
        Called when the child loader is deactivated.
        Specified by:
        receive in interface Receiver
        Parameters:
        state - points to the parent's current state.
        o - object that was loaded. may be null.
        Throws:
        org.xml.sax.SAXException
      • isValueTypeAbstractable

        public boolean isValueTypeAbstractable()
      • isAbstractable

        public boolean isAbstractable​(java.lang.Class clazz)
        Checks if it is not builtin jaxb class
        Parameters:
        clazz - to be checked
        Returns:
        true if it is NOT builtin class
      • adapt

        public final <T> Accessor<BeanT,​T> adapt​(java.lang.Class<T> targetType,
                                                       java.lang.Class<? extends javax.xml.bind.annotation.adapters.XmlAdapter<T,​ValueT>> adapter)
        Wraps this Accessor into another Accessor and performs the type adaption as necessary.
      • adapt

        public final <T> Accessor<BeanT,​T> adapt​(Adapter<java.lang.reflect.Type,​java.lang.Class> adapter)
      • getErrorInstance

        public static <A,​B> Accessor<A,​B> getErrorInstance()
        Gets the special Accessor used to recover from errors.