001    /**
002     * Copyright (c) 2000-present 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                    _loaded = false;
034                    _mBeans = null;
035            }
036    
037            public Domain(String domainName, List<MBean> mBeans) {
038                    _domainName = domainName;
039                    _mBeans = mBeans;
040    
041                    _loaded = true;
042            }
043    
044            @Override
045            public boolean equals(Object obj) {
046                    if (this == obj) {
047                            return true;
048                    }
049    
050                    if (!(obj instanceof Domain)) {
051                            return false;
052                    }
053    
054                    Domain domain = (Domain)obj;
055    
056                    if (Validator.equals(_domainName, domain._domainName)) {
057                            return true;
058                    }
059    
060                    return false;
061            }
062    
063            public String getDomainName() {
064                    return _domainName;
065            }
066    
067            public List<MBean> getMBeans() {
068                    return _mBeans;
069            }
070    
071            @Override
072            public int hashCode() {
073                    HashCode hashCode = HashCodeFactoryUtil.getHashCode();
074    
075                    hashCode.append(_domainName);
076    
077                    return hashCode.toHashCode();
078            }
079    
080            public boolean isLoaded() {
081                    return _loaded;
082            }
083    
084            private final String _domainName;
085            private final boolean _loaded;
086            private final List<MBean> _mBeans;
087    
088    }