001    /**
002     * Copyright (c) 2000-2013 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            @Override
041            public boolean equals(Object obj) {
042                    if (this == obj) {
043                            return true;
044                    }
045    
046                    if (!(obj instanceof Domain)) {
047                            return false;
048                    }
049    
050                    Domain domain = (Domain)obj;
051    
052                    if (Validator.equals(_domainName, domain._domainName)) {
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            @Override
068            public int hashCode() {
069                    HashCode hashCode = HashCodeFactoryUtil.getHashCode();
070    
071                    hashCode.append(_domainName);
072    
073                    return hashCode.toHashCode();
074            }
075    
076            public boolean isLoaded() {
077                    return _loaded;
078            }
079    
080            private String _domainName;
081            private boolean _loaded;
082            private List<MBean> _mBeans;
083    
084    }