生平第一段规范Java代码
下面这段代码是经过代码分析工具Rational Software Analyser 分析过的,该工具关于Java的规则目前是541条,实属苛刻。写段规范点的Java代码容易么!
/**
*
* @author zhp
*
* @version 1.0
*/
package com.rsar;
import java.util.Date;
/**
*
* @author zhp
* @version 1.0
* @invariant
*/
public class StandardCode{
private String name;
private int age;
private Date date;
public String getName() {
return name;
}
/**
*
* @param str1
* @post post
* @pre pre
*/
public void setName(final String name1) {
this.name = name1;
}
/**
*
* @return int
* @post post
* @pre pre
*/
public int getAge() {
return age;
}
/**
*
* @param age1
* @post post
* @pre pre
*/
public void setAge(final int age1) {
this.age = age1;
}
/**
*
* @return int
* @post post
* @pre pre
*/
/**
*
* @return int
* @post post
* @pre pre
*/
public Date getDate() {
return date;
}
/**
*
* @param date1
* @post post
* @pre pre
*/
public void setDate(final Date date1) {
this.date = date1;
}
}
相关文档:
reflection: 指我们可以于java程序执行期载入、探知、使用编译期间完全未知的classes.换句话说,java程序可以载入一个执行期才得知名称的class,获悉其完整构造(但不包括methods定义),并生成实体、或对其fields设值、或唤起其methods。 ......
在Java中,定义函数或者变量的时候,对函数、变量都有一个访问权限问题。
对于函数来说,比如:
public class test {
public static void main(String[] args) {
// TODO Auto-generated method stub
}
public void apublic() {
//public 函数
}
pri ......
在DWR中需要用到session,request等这些东西的时候,可以用以下方法获取:
1. 使用DWR的API (很多人都不推荐这种做法,经测试,使用起来肯定没问题)
import uk.ltd.getahead.dwr.WebContext;
import uk.ltd.getahead.dwr.WebContextFactory;
WebContext ctx = WebContextFactory.get();
ctx.getSession()
ctx.getHttp ......
< type="text/javascript">
document.body.oncopy = function() {
if (window.clipboardData) {
setTimeout(function() {
......