001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements. See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership. The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the  "License");
007     * you may not use this file except in compliance with the License.
008     * You may obtain a copy of the License at
009     *
010     *     http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing, software
013     * distributed under the License is distributed on an "AS IS" BASIS,
014     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015     * See the License for the specific language governing permissions and
016     * limitations under the License.
017     */
018    /*
019     * $Id: ExtensionEvent.java 468644 2006-10-28 06:56:42Z minchau $
020     */
021     
022    package org.apache.xalan.trace;
023    
024    import java.lang.reflect.Constructor;
025    import java.lang.reflect.Method;
026    
027    import org.apache.xalan.transformer.TransformerImpl;
028    
029    /**
030     * An event representing an extension call.
031     */
032    public class ExtensionEvent {
033    
034            public static final int DEFAULT_CONSTRUCTOR = 0;
035            public static final int METHOD = 1;
036            public static final int CONSTRUCTOR = 2;
037            
038            public final int m_callType; 
039            public final TransformerImpl m_transformer;
040            public final Object m_method;
041            public final Object m_instance;
042            public final Object[] m_arguments;
043            
044            
045            public ExtensionEvent(TransformerImpl transformer, Method method, Object instance, Object[] arguments) {
046                    m_transformer = transformer;
047                    m_method = method;
048                    m_instance = instance;
049                    m_arguments = arguments;
050                    m_callType = METHOD;
051            }               
052    
053            public ExtensionEvent(TransformerImpl transformer, Constructor constructor, Object[] arguments) {
054                    m_transformer = transformer;
055                    m_instance = null;              
056                    m_arguments = arguments;
057                    m_method = constructor;
058                    m_callType = CONSTRUCTOR;               
059            }
060    
061            public ExtensionEvent(TransformerImpl transformer, Class clazz) {
062                    m_transformer = transformer;
063                    m_instance = null;
064                    m_arguments = null;
065                    m_method = clazz;
066                    m_callType = DEFAULT_CONSTRUCTOR;
067            }
068    
069    }
070