Commons Attributes
本文导语: Commons Attributes enables Java programmers to use C#/.Net-style attributes in their code. 示例代码: /** * Make this attribute inheritable... * * @@Inheritable() */public class MyAttribute { private final float value; public MyAttribute( float value ) { ...
Commons Attributes enables Java programmers to use C#/.Net-style attributes in their code.
示例代码:
/**
* Make this attribute inheritable...
*
* @@Inheritable()
*/
public class MyAttribute {
private final float value;
public MyAttribute( float value ) {
this.value = value;
}
public float getValue() {
return value;
}
}
/**
* Add a MyAttribute with value 0.8.
*
* @@MyAttribute( 0.8 )
*/
public class MyClass {
public static void main( String[] args ) {
System.out.println( "MyClass has the following attributes:" +
Attributes.getAttributes( MyClass.class ) );
}
}
您可能感兴趣的文章:
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。