java云盘源代码 javaweb源码百度云( 二 )


+ "/" + getLastChar(cName) + "Service.java";
File f = new File(fileName);
FileWriter fw = new FileWriter(f);
fw.write("package "+SERVICE_URL+";"+RT_2+ANNOTATION+"public interface " +
getLastChar(cName) + "Service extends "+BASE_SERVICE_NAME+""+ cName +"{"+RT_2+"}");
fw.flush();
fw.close();
showInfo(fileName);
}
/**
* 创建bean的service的实现类
* @param c
* @throws Exception
*/
public void createBeanServiceImpl(Class c) throws Exception{
String cName = c.getName();
String fileName = System.getProperty("user.dir") + "/src/" + SERVICE_IMPL_PATH
+ "/" +getLastChar(cName)+"ServiceImpl.java";
File f = new File(fileName);
FileWriter fw = new FileWriter(f);
fw.write("package "+SERVICE_IMPL_URL+";"+RT_2+ANNOTATION+"public class "
+ getLastChar(cName) + "ServiceImpl extends "+ABSTRACT_BASE_SERVICE_IMPL_NAME+""+ cName
+ " implements "+SERVICE_URL+"."+getLastChar(cName)+"Service{"+RT_2+BLANK_4
+"private "+DAO_URL+"."+getLastChar(cName)+"Dao "+getLowercaseChar(getLastChar(cName))
+"Dao;"+RT_2+BLANK_4+"public void set"+getLastChar(cName)+"Dao("+DAO_URL+"."+getLastChar(cName)+"Dao "
+getLowercaseChar(getLastChar(cName))+"Dao){"+RT_1+BLANK_8+"this."+getLowercaseChar(getLastChar(cName))+"Dao = "
+getLowercaseChar(getLastChar(cName))+"Dao;"+RT_1+BLANK_4+"}"+RT_2+BLANK_4+"@Override"+RT_1+BLANK_4
+"public "+DAO_URL+"."+"BaseDao"+BEAN_URL+"."+getLastChar(cName)+" getBaseDao(){"+RT_1+BLANK_8
+"return "+getLowercaseChar(getLastChar(cName))+"Dao;"+RT_1+BLANK_4+"}"+RT_2+"}");
fw.flush();
fw.close();
showInfo(fileName);
}
/**
* 获取路径的最后面字符串br
* 如:br
*codestr = "com.b510.base.bean.User"/codebr
*code return "User";code
* @param str
* @return
*/
public String getLastChar(String str) {
if ((str != null)(str.length()0)) {
int dot = str.lastIndexOf('.');
if ((dot-1)(dot(str.length() - 1))) {
return str.substring(dot + 1);
}
}
return str;
}
/**
* 把第一个字母变为小写br
* 如:br
*codestr = "UserDao";/codebr
*codereturn "userDao";/code
* @param str
* @return
*/
public String getLowercaseChar(String str){
return str.substring(0,1).toLowerCase()+str.substring(1);
}
/**
* 显示信息
* @param info
*/
public void showInfo(String info){
System.out.println("创建文件:"+ info+ "成功!");
}
/**
* 获取系统时间
* @return
*/
public static String getDate(){
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
return simpleDateFormat.format(new Date());
}
}
求JAVA源代码java云盘源代码我用了半个小时 帮你写了一个简单java云盘源代码的验证用户名和密码登陆问题 别辜负java云盘源代码我java云盘源代码的好意下面是代码!(建好包和类 代码粘过去就能用)
实体类 包entity
-------------------------------------------------------------
package entity;
/**
* 用户实体类
* @author new
*
*/
public class Users {
private String name;//用户名
private String pass;//用户密码
/**
* 空的构造函数 用户实力化 此类对象
*/
public Users(){
}
/**
* 构造函数 接收用户名和密码
* @param name
* @param pass
*/
public Users(String name, String pass) {
this.name = name;
this.pass = pass;
}
/**
* 下面set和get方法就不用解释了吧
* @return
*/
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;

推荐阅读