001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.jmx.model;
016    
017    import com.liferay.portal.kernel.util.HashCode;
018    import com.liferay.portal.kernel.util.HashCodeFactoryUtil;
019    import com.liferay.portal.kernel.util.Validator;
020    
021    import java.io.Serializable;
022    
023    import java.util.List;
024    
025    /**
026     * @author Shuyang Zhou
027     */
028    public class Domain implements Serializable {
029    
030            public Domain(String domainName) {
031                    _domainName = domainName;
032            }
033    
034            public Domain(String domainName, List<MBean> mBeans) {
035                    _domainName = domainName;
036                    _mBeans = mBeans;
037                    _loaded = true;
038            }
039    
040            public boolean equals(Object obj) {
041                    if (this == obj) {
042                            return true;
043                    }
044    
045                    if (!(obj instanceof Domain)) {
046                            return false;
047                    }
048    
049                    Domain domain = (Domain)obj;
050    
051                    if (Validator.equals(_domainName, domain._domainName)) {
052    
053                            return true;
054                    }
055    
056                    return false;
057            }
058    
059            public String getDomainName() {
060                    return _domainName;
061            }
062    
063            public List<MBean> getMBeans() {
064                    return _mBeans;
065            }
066    
067            public int hashCode() {
068                    HashCode hashCode = HashCodeFactoryUtil.getHashCode();
069    
070                    hashCode.append(_domainName);
071    
072                    return hashCode.toHashCode();
073            }
074    
075            public boolean isLoaded() {
076                    return _loaded;
077            }
078    
079            private String _domainName;
080            private boolean _loaded;
081            private List<MBean> _mBeans;
082    
083    }