/**
*
* Magnolia and its source-code is licensed under the LGPL.
* You may copy, adapt, and redistribute this file for commercial or non-commercial use.
* When copying, adapting, or redistributing this document in keeping with the guidelines above,
* you are required to provide proper attribution to obinary.
* If you reproduce or distribute the document without making any substantive modifications to its content,
* please use the following attribution line:
*
* Copyright 1993-2005 obinary Ltd. (http://www.obinary.com) All rights reserved.
*
*/package info.magnolia.cms.core;import info.magnolia.cms.security.AccessManager;import org.apache.commons.lang.exception.NestableRuntimeException;
public abstract class ContentHandler implements Cloneable {
public static final int SORT_BY_DATE = 1; public static final int SORT_BY_NAME = 2; public static final int SORT_BY_SEQUENCE = 3; public static final int IGNORE_SORT = -1;
protected AccessManager accessManager;
ContentHandler() {
}
public void setAccessManager(AccessManager manager) {
this.accessManager = manager;
}
public AccessManager getAccessManager() {
return this.accessManager;
}
protected Object clone() {
try {
return super.clone();
}
catch (CloneNotSupportedException e) {
// should never happen
throw new NestableRuntimeException(e);
}
}}问下高手~ 我刚接触 JAVA ~ 能否帮我注释下这个文件~~? 谢谢了~
*
* Magnolia and its source-code is licensed under the LGPL.
* You may copy, adapt, and redistribute this file for commercial or non-commercial use.
* When copying, adapting, or redistributing this document in keeping with the guidelines above,
* you are required to provide proper attribution to obinary.
* If you reproduce or distribute the document without making any substantive modifications to its content,
* please use the following attribution line:
*
* Copyright 1993-2005 obinary Ltd. (http://www.obinary.com) All rights reserved.
*
*/package info.magnolia.cms.core;import info.magnolia.cms.security.AccessManager;import org.apache.commons.lang.exception.NestableRuntimeException;
public abstract class ContentHandler implements Cloneable {
public static final int SORT_BY_DATE = 1; public static final int SORT_BY_NAME = 2; public static final int SORT_BY_SEQUENCE = 3; public static final int IGNORE_SORT = -1;
protected AccessManager accessManager;
ContentHandler() {
}
public void setAccessManager(AccessManager manager) {
this.accessManager = manager;
}
public AccessManager getAccessManager() {
return this.accessManager;
}
protected Object clone() {
try {
return super.clone();
}
catch (CloneNotSupportedException e) {
// should never happen
throw new NestableRuntimeException(e);
}
}}问下高手~ 我刚接触 JAVA ~ 能否帮我注释下这个文件~~? 谢谢了~
package info.magnolia.cms.core; //打包
import info.magnolia.cms.security.AccessManager;
import org.apache.commons.lang.exception.NestableRuntimeException; //导入两个类
public abstract class ContentHandler implements Cloneable {
//声明抽象类ContentHandler 实现Cloneable接口
public static final int SORT_BY_DATE = 1;
public static final int SORT_BY_NAME = 2;
public static final int SORT_BY_SEQUENCE = 3;
public static final int IGNORE_SORT = -1; //几个静态常量
protected AccessManager accessManager; //私有变量 AccessManager类型
ContentHandler() { //无参构造方法
}
public void setAccessManager(AccessManager manager) {
this.accessManager = manager;
}
public AccessManager getAccessManager() { //accessManager属性的set get方法
return this.accessManager;
}
protected Object clone() { //应该是复写接口里的方法 实现克隆功能
try {
return super.clone();
}
catch (CloneNotSupportedException e) { //捕获异常
// should never happen
throw new NestableRuntimeException(e);
}
} } 兄弟,多看点基础知识吧 祝你好运
第一点:要明白什么是抽象类?抽象类的定义是:含有抽象方法的类就是抽象类,当时呢,抽象类不一定含有抽象方法!就像你的这个类,就是没有抽象方法的抽象类。第二点:要明白这个类的本质是什么?除去他是抽象类这点看,基本上和普通JAVABEAN没区别。
这个类的主要作用就是 用来获取(getAccessManager())一个AccessManager对象,或者是设置(setAccessManager)一个AccessManager对象,同事覆盖啦超级父类的clone()方法。