📄 attribute.java
字号:
/* Attribute.java -- Copyright (C) 2006 Free Software Foundation, Inc.This file is part of GNU Classpath.GNU Classpath is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version.GNU Classpath is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU Classpath; see the file COPYING. If not, write to theFree Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA02110-1301 USA.Linking this library statically or dynamically with other modules ismaking a combined work based on this library. Thus, the terms andconditions of the GNU General Public License cover the wholecombination.As a special exception, the copyright holders of this library give youpermission to link this library with independent modules to produce anexecutable, regardless of the license terms of these independentmodules, and to copy and distribute the resulting executable underterms of your choice, provided that you also meet, for each linkedindependent module, the terms and conditions of the license of thatmodule. An independent module is a module which is not derived fromor based on this library. If you modify this library, you may extendthis exception to your version of the library, but you are notobligated to do so. If you do not wish to do so, delete thisexception statement from your version. */package javax.management;import java.io.Serializable;/** * Represents an MBean attribute, having the name and the assigned value. The * MBean objects use this class to get and set attributes values. * * @since 1.5 * * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) */public class Attribute implements Serializable{ /** * The attribute name. */ final String m_name; /** * The attribute value. */ final Object m_value; /** * Create the attribute with the given name and value. * * @param name the attribute name * @param value the attribute value */ public Attribute(String name, Object value) { m_name = name; m_value = value; } /** * Compares the attribute with another attribute. * * @param other the other object to compare with * * @return true if both value and object are equal, false otherwise. */ public boolean equals(Object other) { if (other instanceof Attribute) { Attribute oa = (Attribute) other; boolean n, v; if (oa.m_name == null || m_name == null) n = oa.m_name == m_name; else n = oa.m_name.equals(m_name); if (oa.m_value == null || m_value == null) v = oa.m_value == m_value; else v = oa.m_value.equals(m_value); return n && v; } else return false; } /** * Returns the attribute name. * * @return the attribute name */ public String getName() { return m_name; } /** * Returns the attribute value. * * @return the attribute value. */ public Object getValue() { return m_value; } /** * Need to override as {@link #equals} is overridden. * * @return the expression, dependent of the object and name hashcodes. */ public int hashCode() { int n = m_name == null ? 0 : m_name.hashCode(); int v = m_value == null ? 0 : m_value.hashCode(); return n ^ v; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -