小编Dro*_*tor的帖子

在Lombok注释上使用验证和其他注释

是否可以在Lombok注释上使用其他注释?

假设有字段名称,并希望确保它在使用注释设置时不为空.

在龙目岛之前

public class Person(){
     String name;

     @NotNull
     public void setName(String newName){
             name = newName;
     }
   }
Run Code Online (Sandbox Code Playgroud)

龙目岛之后

public class Person(){
     @NotNull
     @Setter
     String name;
   }
Run Code Online (Sandbox Code Playgroud)

我知道这是一个非常简单的例子但这样的事情可能吗?

java annotations lombok

6
推荐指数
1
解决办法
6783
查看次数

运行apache作为服务的好处?

我刚刚安装了XAMPP,只是想知道运行Apache作为服务有什么好处?

apache xampp

5
推荐指数
2
解决办法
5284
查看次数

Android文件写入只读文件系统警告

我正在尝试使用FileOutputStream和写一个文件,OutputStreamWriter但我一直收到只读警告.

这是我正在使用的代码

FileOutputStream fw = new FileOutputStream((trackName.replaceAll(" ", ""))+".gpx", true);
    OutputStreamWriter osw = new OutputStreamWriter(fw);
    osw.write(XML_HEADER+"\n");
    osw.write(TAG_GPX+"\n");


    writeTrackPoints(trackName, osw, locations, time, trackDescp);
    writeWayPoints(osw, locations,time);
    osw.flush();
    osw.close();
Run Code Online (Sandbox Code Playgroud)

Logcat输出

java.io.FileNotFoundException: /test.gpx (Read-only file system)
at org.apache.harmony.luni.platform.OSFileSystem.openImpl(Native Method)
at org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java:152)
at java.io.FileOutputStream.<init>(FileOutputStream.java:97)
at java.io.FileOutputStream.<init>(FileOutputStream.java:168)
at java.io.FileOutputStream.<init>(FileOutputStream.java:147)
at com.fyp.run_race.GPXFileWriter.<init>(GPXFileWriter.java:25)
at com.fyp.run_race.GPSTrackDetails$1.onClick(GPSTrackDetails.java:58)
at android.view.View.performClick(View.java:2408)
at android.view.View$PerformClick.run(View.java:8816)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Run Code Online (Sandbox Code Playgroud)

我确定问题是什么.

android android-file

5
推荐指数
2
解决办法
1万
查看次数

Mockito GregorianCalendate.getTime() 导致错误

我试图模拟应该是 Date() 的 GregorianCalendar.getTime() 的返回。但是我收到这个错误

org.mockito.exceptions.misusing.WrongTypeOfReturnValue: 
Date$$EnhancerByMockitoWithCGLIB$$91e3d4b7 cannot be returned by getTimeInMillis()
getTimeInMillis() should return long

Mockito.when(gregorianCalendar.getTime()).thenReturn(date);
Run Code Online (Sandbox Code Playgroud)

gregorianCalendar 和 date 都是模拟对象。

关于如何解决这个问题的任何建议?非常感谢所有帮助

java junit mockito

5
推荐指数
1
解决办法
1488
查看次数

Sqlite是否支持弱实体?

Sqlite是否支持弱实体或具有复合键的表,其中许多外键构成主键?

sqlite

1
推荐指数
1
解决办法
522
查看次数

提交前验证表格(输入所有字段)

我正在尝试检查下面表单中的字段是否已填充,然后才能将其插入数据库,例如显示弹出的字段尚未填写.这只是一个简单的注册表单.

<form name="form1" method="post" action="signup_ac.php">
<strong>Sign up</strong>
Username:<input name="username" type="text" id="username" size="30">
Password:<input name="password" type="password" id="password" size="15">
Name:<input name="name" type="text" id="name" size="30">
<select name="Month">
<option selected>Month</option>
<option value="January">January</option>
<option value="Febuary">Febuary</option
  </select> 
<select name=Year>
<option selected>Year</option>
<option value="2012">2012</option>
<option value="2011">2011</option>
 </select>
<input type="submit" name="Submit" value="Submit"> &nbsp;
<input type="reset" name="Reset" value="Reset">
</form>
Run Code Online (Sandbox Code Playgroud)

我如何使用JavaScript或jQuery执行此操作.

html javascript php jquery

0
推荐指数
1
解决办法
7598
查看次数

标签 统计

java ×2

android ×1

android-file ×1

annotations ×1

apache ×1

html ×1

javascript ×1

jquery ×1

junit ×1

lombok ×1

mockito ×1

php ×1

sqlite ×1

xampp ×1