001    /**
002     * Copyright (c) 2000-2013 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                            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    }