📄 attr.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 < @ 2.0 >
*
*/
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 + -