0

当我运行这个时我有下面的代码,不知道为什么包名会随之而来

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();
        }


    }
}
4

1 回答 1

1

很可能 FullTextSearchConfigModel 的 toString() 方法(当您打印对象时被调用)使用 getClass() 来构建对象的字符串表示,它返回完全限定的类名(即包括包名)。请参阅https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--

于 2019-09-14T10:47:05.480 回答