运行此代码时,我有以下代码,不确定为什么软件包名称与此一起
com.heiler.ppm.fulltextsearch.object.FullTextSearchConfigModel@5c3bd550[indexName=Items_AllSupplierCatalogs_en,indexLabel=Items (All Supplier Catalogs) en,alias=,catalogs=[SupplierCatalog1, SupplierCatalog2],rootEntities=[com.heiler.ppm.fulltextsearch.object.RootEntity@6a41eaa2[entityIdentifier=Article,fields=[com.heiler.ppm.fulltextsearch.object.Field@7cd62f43[name=Article.SupplierAID,type=text,searchable=true,sortable=true,facetable=false,additionalProperties={}]],subEntities=
public class ExportToESMappingCreator {
public static void main(String[] args) {
ObjectMapper objectMapper = new ObjectMapper();
FullTextSearchConfigModel searchConfig= null;
try {
searchConfig= objectMapper.readValue(new File("src\\main\\resources\\indexconfig.json"), FullTextSearchConfigModel.class);
// System.out.println(searchConfig.toString());
// String json=objectMapper.writeValueAsString(searchConfig);
System.out.println(searchConfig);
} catch (JsonParseException e) {
e.printStackTrace();
} catch (JsonMappingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
答案 0 :(得分:1)
就像FullTextSearchConfigModel的toString()方法(在打印对象时将被调用)一样,它使用getClass()构建对象的String表示形式,该表示形式返回完全限定的类名(即包括包名)。参见https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--