小编Mar*_*ope的帖子

注释匿名内部类

有没有办法在Java中注释匿名内部类?

在此示例中,您可以向Class2添加类级别注释吗?

public void method1() {
  add(new Class2() {
    public void method3() {}
  });
}
Run Code Online (Sandbox Code Playgroud)

java annotations

32
推荐指数
3
解决办法
9691
查看次数

分享/出口日食工作集

我在我的工作区为项目创建了几个java工作集,并希望与其他人共享(使用不同的工作区).有没有办法出口它们?

eclipse eclipse-indigo

31
推荐指数
3
解决办法
1万
查看次数

有效Java hashCode()实现中的位移

我想知道是否有人可以详细解释什么

(int)(l ^ (l >>> 32));

在下面的hashcode实现中(由eclipse生成,但与Effective Java相同):

private int i;
private char c; 
private boolean b;
private short s;
private long l;
private double d;
private float f;

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + i;
    result = prime * result + s;
    result = prime * result + (b ? 1231 : 1237);
    result = prime * result + c;
    long t = Double.doubleToLongBits(d);
    result …
Run Code Online (Sandbox Code Playgroud)

java hashcode

20
推荐指数
2
解决办法
8775
查看次数

将父子数组转换为树

任何人都可以帮助转换以下父子对象列表:

[
   {
      "name":"root",
      "_id":"root_id",
   },
   {
      "name":"a1",
      "parentAreaRef":{
         "id":"root_id",
      },
      "_id":"a1_id",
   },
   {
      "name":"a2",
      "parentAreaRef":{
         "id":"a1_id",
      },
      "_id":"a2_id",
   },
   {
      "name":"a3",
      "parentAreaRef":{
         "id":"a2_id",
      },
      "_id":"a3_id",
   },
   {
      "name":"b1",
      "parentAreaRef":{
         "id":"root_id",
      },
      "_id":"b1_id",
   },
   {
      "name":"b2",
      "parentAreaRef":{
         "id":"b1_id",
      },
      "_id":"b2_id",
   },
   {
      "name":"b3",
      "parentAreaRef":{
         "id":"b1_id",
      },
      "_id":"b3_id",
   }
]

显示父子关系的树结构:

[
    {
        "name": "root",
        "_id":"root_id",
        "children": [
            {
                "name": "a1",
                "_id":"a1_id",
                "children" : [
                    {
                        "name" : "a2",
                        "_id":"a2_id",
                        "children" : [
                            {
                                "name" : "a3"
                                "_id":"a3_id"
                            }
                        ]
                    } …

javascript algorithm

16
推荐指数
2
解决办法
3万
查看次数

将SoapHeader添加到org.springframework.ws.WebServiceMessage

如何将对象添加到a的soap标头中 org.springframework.ws.WebServiceMessage

这是我希望最终得到的结构:

 <soap:Header>
    <credentials xmlns="http://example.com/auth">
      <username>username</username>
      <password>password</password>
    </credentials>
  </soap:Header>
Run Code Online (Sandbox Code Playgroud)

java spring soap web-services spring-ws

13
推荐指数
4
解决办法
3万
查看次数

将WebServiceTemplate与密钥库一起使用

是否可以使用java密钥库配置WebServiceTemplate?

编辑
我正在寻找一种在spring配置中配置密钥库位置的方法

java ssl spring spring-ws

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

Elasticsearch中带有连字符的索引字段

我正在尝试设计如何配置elasticsearch,以便我可以在包含连字符的字段上使用通配符进行查询字符串搜索.

我的文档看起来像这样:

{
   "tags":[
      "deck-clothing-blue",
      "crew-clothing",
      "medium"
   ],
   "name":"Crew t-shirt navy large",
   "description":"This is a t-shirt",
   "images":[
      {
         "id":"ba4a024c96aa6846f289486dfd0223b1",
         "type":"Image"
      },
      {
         "id":"ba4a024c96aa6846f289486dfd022503",
         "type":"Image"
      }
   ],
   "type":"InventoryType",
   "header":{
   }
}
Run Code Online (Sandbox Code Playgroud)

我试过使用word_delimiter过滤器和空格标记器:

{
"settings" : {
    "index" : {
        "number_of_shards" : 1,
        "number_of_replicas" : 1
    },  
    "analysis" : {
        "filter" : {
            "tags_filter" : {
                "type" : "word_delimiter",
                "type_table": ["- => ALPHA"]
            }   
        },
        "analyzer" : {
            "tags_analyzer" : {
                "type" : "custom",
                "tokenizer" : "whitespace",
                "filter" : ["tags_filter"]
            }
        } …
Run Code Online (Sandbox Code Playgroud)

elasticsearch

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

多个上下文指向单个webapp

无论如何配置tomcat来指向webapp上的多个上下文?

我需要指出这两个网址:

http://server.com/abc
http://server.com/def

到在上下文下运行的webapp abc.

java tomcat web-applications

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

从XML创建HTML表单

我需要从html表单编辑许多不同的xml文件.我希望动态生成表单(文件可以是任何有效的xml结构),我想将修改后的xml内容以相同的结构保存回数据库.

当你知道xml的结构时,我已经看到了一些使用XSLT的例子,但是在这种情况下我没有.

那么,有两个真正的要点:

  1. 如何从未知的xml结构动态创建html表单
  2. 如何将修改后的内容保存回相同的xml结构

html javascript xml

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

使用正则表达式的Apache VFS resolveFile

如果我有一个temp使用以下文件调用的目录:

a_file1.jpg
a_file2.jpg
b_file1.jpg
b_file2.jpg
Run Code Online (Sandbox Code Playgroud)

有可能得到这样的所有文件:

VFS.getManager().resolveFile("temp").getChildren();
Run Code Online (Sandbox Code Playgroud)

但是,我真正想做的是得到a_file1.jpga_file2.jpg.也许喜欢:

VFS.getManager().resolveFile("temp/a*").getChildren();
Run Code Online (Sandbox Code Playgroud)

但这引发了一个例外:

org.apache.commons.vfs.FileSystemException: Could not list the contents of "temp/a*" because it is not a folder.
Run Code Online (Sandbox Code Playgroud)

那么,有没有人知道如何基于VFS的正则表达式解析一组文件?

java apache-commons-vfs

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