001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
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    
054                            return true;
055                    }
056    
057                    return false;
058            }
059    
060            public String getDomainName() {
061                    return _domainName;
062            }
063    
064            public List<MBean> getMBeans() {
065                    return _mBeans;
066            }
067    
068            @Override
069            public int hashCode() {
070                    HashCode hashCode = HashCodeFactoryUtil.getHashCode();
071    
072                    hashCode.append(_domainName);
073    
074                    return hashCode.toHashCode();
075            }
076    
077            public boolean isLoaded() {
078                    return _loaded;
079            }
080    
081            private String _domainName;
082            private boolean _loaded;
083            private List<MBean> _mBeans;
084    
085    }