001    /**
002     *  Licensed to the Apache Software Foundation (ASF) under one or more
003     *  contributor license agreements.  See the NOTICE file distributed with
004     *  this work for additional information regarding copyright ownership.
005     *  The ASF licenses this file to You under the Apache License, Version 2.0
006     *  (the "License"); you may not use this file except in compliance with
007     *  the License.  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     *  Unless required by applicable law or agreed to in writing, software
012     *  distributed under the License is distributed on an "AS IS" BASIS,
013     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     *  See the License for the specific language governing permissions and
015     *  limitations under the License.
016     */
017    
018    package org.apache.geronimo.gbean;
019    
020    import java.io.Serializable;
021    
022    
023    /**
024     * @version $Rev: 706640 $ $Date: 2008-10-21 14:44:05 +0000 (Tue, 21 Oct 2008) $
025     */
026    public class GReferenceInfo implements Serializable {
027        private static final long serialVersionUID = 8817036672214905192L;
028    
029        /**
030         * Name of this reference.
031         */
032        private final String name;
033    
034        /**
035         * Type of this reference.
036         */
037        private final String referenceType;
038    
039        /**
040         * Type of the proxy injected into the bean.
041         */
042        private final String proxyType;
043    
044        /**
045         * Name of the setter method.
046         */
047        private final String setterName;
048    
049        /**
050         * String for type component when constructing reference patterns. For jsr-77 this maps to j2eeType=nameTypeName
051         */
052        private final String nameTypeName;
053    
054        public GReferenceInfo(String name, String referenceType, String proxyType, String setterName, String nameTypeName) {
055            this.name = name;
056            this.referenceType = referenceType;
057            this.setterName = setterName;
058            this.proxyType = proxyType;
059            this.nameTypeName = nameTypeName;
060        }
061    
062        public String getName() {
063            return name;
064        }
065    
066        public String getReferenceType() {
067            return referenceType;
068        }
069    
070        public String getProxyType() {
071            return proxyType;
072        }
073    
074        public String getSetterName() {
075            return setterName;
076        }
077    
078        public String getNameTypeName() {
079            return nameTypeName;
080        }
081    
082        public String toString() {
083            return "[GReferenceInfo: name=" + name +
084                    " referenceType=" + referenceType +
085                    " proxyType=" + proxyType +
086                    " setterName=" + setterName +
087                    " naming system type name= " + nameTypeName +
088                    "]";
089        }
090        
091        public String toXML() {
092            StringBuilder xml = new StringBuilder();
093            
094            xml.append("<gReferenceInfo ");
095            xml.append("name='" + name + "' ");
096            xml.append("referenceType='" + referenceType + "' ");
097            xml.append("proxyType='" + proxyType + "' ");
098            xml.append("setterName='" + setterName + "' ");
099            xml.append("namingSystem='" + nameTypeName + "' ");
100            xml.append("/>");
101            
102            return xml.toString();
103        }
104    }