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.mobile.device;
016    
017    import com.liferay.portal.kernel.util.StringBundler;
018    import com.liferay.portal.kernel.util.Validator;
019    
020    import java.io.Serializable;
021    
022    /**
023     * @author Milen Dyankov
024     * @author Michael C. Han
025     */
026    public class Capability implements Serializable {
027    
028            public Capability(String name, String value) {
029                    _name = name;
030                    _value = value;
031            }
032    
033            @Override
034            public boolean equals(Object obj) {
035                    if (this == obj) {
036                            return true;
037                    }
038    
039                    if (!(obj instanceof Capability)) {
040                            return false;
041                    }
042    
043                    Capability capability = (Capability)obj;
044    
045                    if (Validator.equals(_name, capability._name) &&
046                            Validator.equals(_value, capability._value)) {
047    
048                            return true;
049                    }
050    
051                    return false;
052            }
053    
054            public String getName() {
055                    return _name;
056            }
057    
058            public String getValue() {
059                    return _value;
060            }
061    
062            @Override
063            public String toString() {
064                    StringBundler sb = new StringBundler(5);
065    
066                    sb.append("{name=");
067                    sb.append(_name);
068                    sb.append(", value=");
069                    sb.append(_value);
070                    sb.append("}");
071    
072                    return sb.toString();
073            }
074    
075            private String _name;
076            private String _value;
077    
078    }