在java中
有一些不//或者/* */的注释
直接用@ 在后面写 写出来时灰色的
比如:@ChannelPipelineCoverage("all")
@Override
@Inherited
@Documented
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)这种注释是什么意思啊 有什么用?
小弟实在不懂,谢谢!
有一些不//或者/* */的注释
直接用@ 在后面写 写出来时灰色的
比如:@ChannelPipelineCoverage("all")
@Override
@Inherited
@Documented
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)这种注释是什么意思啊 有什么用?
小弟实在不懂,谢谢!
@Inherited 继承...
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
{
}
这段代码为什么编译器提示有错啊 我现在在用NETTY框架
谢谢
@Override 表示覆盖方法
@Inherited 表示继承的方法
不一一列举了,自己去查吧
举例:方法标记也可以结合/***/一起用来给类注释
/**
* 雇员类
*
* @author Jhon
* @version [版本号, 2010-2-27]
* @see [相关类/方法]
* @since [产品/模块版本]
*/
public class Emploee
{
}
* 雇员类
*
* @author Jhon
* @version [版本号, 2010-2-27]
* @see [相关类/方法]
* @since [产品/模块版本]
*/都是些注释
*
*/这种方式的我比较清楚 可以用JAVADOC来生成文档
我刚刚查了一下java annotation
说是可以自定义注释,我看了下 不知道自定义这些注释,有什么作用和好处,刚刚想了一下 没想明白
比如:
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
/*
* 定义注解 Test
* 注解中含有两个元素 id 和 description
* description 元素 有默认值 "no description"
*/
public @interface Test {
public int id();
public String description() default "no description";
}