⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 attr.java

📁 Java讲义与实例
💻 JAVA
字号:
//package a;
/**
 *An <code>Attr</code> object defines an attribute as a 
 *name /value pair ,where the name is a <code> String </code>
 *and the value an arbitrary <code> Object </code>.
 *
 *@since &lt &#064 2.0 &gt
 *
 */
public  class Attr{
    /** The attribute name.  */
    private final String name;
    /** The attribute value.*/
    private Object value=null;
    /**
     *Creates a new attribute with the given name and an
     *initial value of <code>null</code>.
     *@see Attr#Attr(String,Object)
     */
     public Attr(String name){
        this.name=name;
        }
     /**
      *Creates a new attribute with the given name and 
      *initial value.
      *@see Attr#Attr(String)
      */
     public Attr(String name,Object value){
        this.name=name;
        this.value=value;
        }
     /**Returns this attribute's name.*/
     public String getName(){
        return name;
        }
     /**Returns this attribute's value.*/
     public Object getValue(){
        return value;
        }
     /**
      *Set the value of this attribute. Changes the 
      *value returned by calls to {@link #getValue}.
      *@param newValue The new value for the attribute.
      *@return The original value.
      *@see #getValue
      */
    public Object setValue(Object newValue){
        Object oldVal=value;
        value=newValue;
        return oldVal;
        }
    /**
     *Returns a String of the from <code>name=value</code>.
     */
     public String toString(){
        return name+"='"+value+"'";
        }
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -