Java Code Examples for javax.xml.bind.Marshaller.Listener

The following are Jave code examples for showing how to use Listener of the javax.xml.bind.Marshaller class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: OpenJSharp   File: XMLSerializer.java   Source Code and License Vote up 5 votes
/**
 * Invoke the afterMarshal api on the external listener (if it exists) and on the bean embedded
 * afterMarshal api(if it exists).
 *
 * This method is called only after the callee has determined that beanInfo.lookForLifecycleMethods == true.
 *
 * @param beanInfo
 * @param currentTarget
 */
private void fireAfterMarshalEvents(final JaxBeanInfo beanInfo, Object currentTarget) {
    // first invoke bean embedded listener
    if (beanInfo.hasAfterMarshalMethod()) {
        Method m = beanInfo.getLifecycleMethods().afterMarshal;
        fireMarshalEvent(currentTarget, m);
    }

    // then invoke external listener before bean embedded listener
    Marshaller.Listener externalListener = marshaller.getListener();
    if (externalListener != null) {
        externalListener.afterMarshal(currentTarget);
    }

}
 
Example 2
Project: OpenJSharp   File: XMLSerializer.java   Source Code and License Vote up 5 votes
/**
 * Invoke the beforeMarshal api on the external listener (if it exists) and on the bean embedded
 * beforeMarshal api(if it exists).
 *
 * This method is called only after the callee has determined that beanInfo.lookForLifecycleMethods == true.
 *
 * @param beanInfo
 * @param currentTarget
 */
private void fireBeforeMarshalEvents(final JaxBeanInfo beanInfo, Object currentTarget) {
    // first invoke bean embedded listener
    if (beanInfo.hasBeforeMarshalMethod()) {
        Method m = beanInfo.getLifecycleMethods().beforeMarshal;
        fireMarshalEvent(currentTarget, m);
    }

    // then invoke external listener
    Marshaller.Listener externalListener = marshaller.getListener();
    if (externalListener != null) {
        externalListener.beforeMarshal(currentTarget);
    }
}
 
Example 3
Project: openjdk-jdk10   File: XMLSerializer.java   Source Code and License Vote up 5 votes
/**
 * Invoke the afterMarshal api on the external listener (if it exists) and on the bean embedded
 * afterMarshal api(if it exists).
 *
 * This method is called only after the callee has determined that beanInfo.lookForLifecycleMethods == true.
 *
 * @param beanInfo
 * @param currentTarget
 */
private void fireAfterMarshalEvents(final JaxBeanInfo beanInfo, Object currentTarget) {
    // first invoke bean embedded listener
    if (beanInfo.hasAfterMarshalMethod()) {
        Method m = beanInfo.getLifecycleMethods().afterMarshal;
        fireMarshalEvent(currentTarget, m);
    }

    // then invoke external listener before bean embedded listener
    Marshaller.Listener externalListener = marshaller.getListener();
    if (externalListener != null) {
        externalListener.afterMarshal(currentTarget);
    }

}
 
Example 4
Project: openjdk-jdk10   File: XMLSerializer.java   Source Code and License Vote up 5 votes
/**
 * Invoke the beforeMarshal api on the external listener (if it exists) and on the bean embedded
 * beforeMarshal api(if it exists).
 *
 * This method is called only after the callee has determined that beanInfo.lookForLifecycleMethods == true.
 *
 * @param beanInfo
 * @param currentTarget
 */
private void fireBeforeMarshalEvents(final JaxBeanInfo beanInfo, Object currentTarget) {
    // first invoke bean embedded listener
    if (beanInfo.hasBeforeMarshalMethod()) {
        Method m = beanInfo.getLifecycleMethods().beforeMarshal;
        fireMarshalEvent(currentTarget, m);
    }

    // then invoke external listener
    Marshaller.Listener externalListener = marshaller.getListener();
    if (externalListener != null) {
        externalListener.beforeMarshal(currentTarget);
    }
}