- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一个包含 3 种不同类型节点的 JSON 字符串,自动生成器不允许我处理它。
如何将此结构构建到类中以反序列化?
{
"answers": [
{
"answerText": "No",
"section": "52.209-5.a.1.i.A"
},
{
"answerText": "No",
"section": "52.209-5.a.1.i.B"
},
{
"answerText": "No",
"section": "52.209-5.a.1.i.D"
},
{
"answerText": "No",
"section": "52.209-5.a.1.i.C"
},
{
"answerText": "No",
"section": "52.209-5.a.1.ii"
}
],
"id": "FAR 52.209-5"
},
{
"answers": {
"SamPointOfContact": {
"firstName": "Catherine",
"lastName": "Kuenzel",
"title": "VP of Public Sector US Enterprise Services"
},
"section": "52.203-2.b.2.i"
},
"id": "FAR 52.203-2"
},
{
"answers": [
{
"section": "52.212-3.c",
"naics": [
{
"naicsName": "Other Computer Related Services",
"hasSizeChanged": "null",
"isPrimary": false,
"ExcpCounter": 1,
"isSmallBusiness": "N",
"naicsCode": 541519
},
{
"naicsName": "Information Technology Value Added Resellers",
"hasSizeChanged": "null",
"isPrimary": false,
"ExcpCounter": 2,
"isSmallBusiness": "N",
"naicsCode": 541519
},
{
"naicsName": "Engineering Services",
"hasSizeChanged": "null",
"isPrimary": false,
"ExcpCounter": 1,
"isSmallBusiness": "N",
"naicsCode": 541330
},
{
"naicsName": "Military and Aerospace Equipment and Military Weapons",
"hasSizeChanged": "null",
"isPrimary": false,
"ExcpCounter": 2,
"isSmallBusiness": "N",
"naicsCode": 541330
},
{
"naicsName": "Contracts and Subcontracts for Engineering Services Awarded Under the National Energy Policy Act of 1992",
"hasSizeChanged": "null",
"isPrimary": false,
"ExcpCounter": 3,
"isSmallBusiness": "N",
"naicsCode": 541330
},
{
"naicsName": "Marine Engineering and Naval Architecture",
"hasSizeChanged": "null",
"isPrimary": false,
"ExcpCounter": 4,
"isSmallBusiness": "N",
"naicsCode": 541330
},
{
"naicsName": "Software Publishers",
"hasSizeChanged": "null",
"isPrimary": true,
"isSmallBusiness": "N",
"naicsCode": 511210
},
{
"naicsName": "Wired Telecommunications Carriers",
"hasSizeChanged": "null",
"isPrimary": false,
"isSmallBusiness": "N",
"naicsCode": 517311
},
{
"naicsName": "Data Processing, Hosting, and Related Services",
"hasSizeChanged": "null",
"isPrimary": false,
"isSmallBusiness": "N",
"naicsCode": 518210
},
{
"naicsName": "Custom Computer Programming Services",
"hasSizeChanged": "null",
"isPrimary": false,
"isSmallBusiness": "N",
"naicsCode": 541511
},
{
"naicsName": "Computer Systems Design Services",
"hasSizeChanged": "null",
"isPrimary": false,
"isSmallBusiness": "N",
"naicsCode": 541512
},
{
"naicsName": "Computer Facilities Management Services",
"hasSizeChanged": "null",
"isPrimary": false,
"isSmallBusiness": "N",
"naicsCode": 541513
},
{
"naicsName": "Other Scientific and Technical Consulting Services",
"hasSizeChanged": "null",
"isPrimary": false,
"isSmallBusiness": "N",
"naicsCode": 541690
},
{
"naicsName": "All Other Professional, Scientific, and Technical Services",
"hasSizeChanged": "null",
"isPrimary": false,
"isSmallBusiness": "N",
"naicsCode": 541990
}
]
}
据我所知,每个答案都有:
部分
和以下之一:answerText、SamPointOfContact 或 NAICS
来自 API 的完整 JSON 字符串:
{"sam_data":{"registration":{"pscCodes":"null","dodaac":"null","pastPerformancePoc":{"nonUsPhone":"null","firstName":"MELISSA","lastName":"RANSLEM","middleInitial":"null","address":{"zip":"20190","city":"Reston","countryCode":"USA","stateorProvince":"VA","line2":"null","line1":"12012 Sunset Hills RD","zipPlus4":"null"},"notes":"null","usPhoneExt":"null","title":"null","fax":"null","usPhone":"5713532701","email":"MELR@MICROSOFT.COM"},"lastUpdateDate":"2019-10-02 11:42:00.2","businessStartDate":"1981-06-25","congressionalDistrict":"WA 01","corporateUrl":"http://www.microsoft.com","samAddress":{"zip":"98052","city":"Redmond","countryCode":"USA","stateorProvince":"WA","line2":"null","line1":"1 Microsoft Way","zipPlus4":"8300"},"electronicBusinessPoc":{"nonUsPhone":"null","firstName":"MELISSA","lastName":"RANSLEM","middleInitial":"null","address":{"zip":"20190","city":"RESTON","countryCode":"USA","stateorProvince":"VA","line2":"null","line1":"12012 SUNSET HILLS ROAD","zipPlus4":"null"},"notes":"null","usPhoneExt":"null","title":"CONTRACTS MANAGER","fax":"4257086748","usPhone":"5713532701","email":"MELR@MICROSOFT.COM"},"corporateStructureCode":"2L","certificationsURL":{"pdfUrl":"https://sam.gov/SAM/filedownload?reportType=2&orgId=cjtAmfDzDsaKTO8U4n1UKUa2KrXbqstk%2BO0iASuNgvum%2B4NlFkRiGprZhIF96imb&pitId=49aNpMKWuSvejCJ3Wvi2DUfJJpLdlhT66P77hYyLHlRhcYGmjXFFJHD2XTuRV2vTUaRmz8pvfeEH%0Av7KcTAhZQg%3D%3D&requestId=mAs0396QKDkznCr"},"bondingInformation":{"serviceAggregate":"null","servicePerContract":"null","constructionAggregate":"null","constructionPerContract":"null"},"dunsPlus4":"0000","correspondenceFlag":"null","debtSubjectToOffset":false,"qualifications":{"pdfUrl":"null","acass":{"answers":{"answerText":"No","section":"SF330.1"},"id":"SF330"}},"cage":"60128","fiscalYearEndCloseDate":"06/30","publicDisplay":true,"ncage":"null","altGovtBusinessPoc":{"nonUsPhone":"null","firstName":"MELISSA","lastName":"RANSLEM","middleInitial":"null","address":{"zip":"20190","city":"RESTON","countryCode":"USA","stateorProvince":"VA","line2":"null","line1":"12012 SUNSET HILLS ROAD","zipPlus4":"null"},"notes":"null","usPhoneExt":"null","title":"null","fax":"null","usPhone":"5713532701","email":"MELR@MICROSOFT.COM"},"registrationDate":"2001-05-24 00:00:00.0","govtBusinessPoc":{"nonUsPhone":"null","firstName":"MELISSA","lastName":"RANSLEM","middleInitial":"null","address":{"zip":"20190","city":"RESTON","countryCode":"USA","stateorProvince":"VA","line2":"null","line1":"12012 SUNSET HILLS ROAD","zipPlus4":"null"},"notes":"null","usPhoneExt":"null","title":"CONTRACTS MANAGER","fax":"4257086748","usPhone":"5713532701","email":"MELR@MICROSOFT.COM"},"expirationDate":"2020-10-01 10:48:36.71","altElectronicBusinessPoc":{"nonUsPhone":"null","firstName":"MELISSA","lastName":"RANSLEM","middleInitial":"null","address":{"zip":"20190","city":"RESTON","countryCode":"USA","stateorProvince":"VA","line2":"null","line1":"12012 SUNSET HILLS ROAD","zipPlus4":"null"},"notes":"null","usPhoneExt":"null","title":"null","fax":"null","usPhone":"5713532701","email":"MELR@MICROSOFT.COM"},"purposeOfRegistration":"ALL_AWARDS","companyDivision":"null","financialAssistanceResponse":"No","submissionDate":"2019-10-02 10:48:36.7","creditCardUsage":true,"countryOfIncorporation":"USA","businessTypes":["2X","MF"],"certifications":{"pdfUrl":"https://sam.gov/SAM/filedownload?reportType=2&orgId=U8BeO3GBdtx5C03t2ZZrh09e%2BMOgCT%2F5q6WqC%2BSik3qQgeriyZFR3EyVmYmJJ8KN&pitId=XU%2BuEDYLvXBbO0%2BOG2x1eK2wC0FT4ocU%2Febr%2FvqOZWsbEd5NjPqoozGVWZIGLYHtToL8xJfOkUfk%0A%2BaJmd2jnmw%3D%3D&requestId=FCwZSoGN9o0tAc6","farResponses":[{"answers":[{"answerText":"No","section":"52.209-2.c.1"},{"answerText":"No","section":"52.209-2.c.2"}],"id":"FAR 52.209-2"},{"answers":[{"answerText":"No","section":"52.209-5.a.1.i.A"},{"answerText":"No","section":"52.209-5.a.1.i.B"},{"answerText":"No","section":"52.209-5.a.1.i.D"},{"answerText":"No","section":"52.209-5.a.1.i.C"},{"answerText":"No","section":"52.209-5.a.1.ii"}],"id":"FAR 52.209-5"},{"answers":{"SamPointOfContact":{"firstName":"Catherine","lastName":"Kuenzel","title":"VP of Public Sector US Enterprise Services"},"section":"52.203-2.b.2.i"},"id":"FAR 52.203-2"},{"answers":{"answerText":"No","section":"52.215-6.a"},"id":"FAR 52.215-6"},{"answers":{"answerText":"No","section":"52.214-14.a"},"id":"FAR 52.214-14"},{"answers":{"answerText":"Vendor will provide information with specific offers to the Government","section":"52.223-4"},"id":"FAR 52.223-4"},{"answers":{"answerText":"Vendor will provide information with specific offers to the Government","section":"52.223-9"},"id":"FAR 52.223-9"},{"answers":{"answerText":"No","section":"52.219-2.a"},"id":"FAR 52.219-2"},{"answers":[{"answerText":"TIN ON FILE","section":"52.204-3.d"},{"answerText":"Corporate Entity (Not Tax Exempt)","section":"52.204-3.e"},{"answerText":"No","section":"52.204-3.f"}],"id":"FAR 52.204-3"},{"answers":{"answerText":"No","section":"52.223-22.a"},"id":"FAR 52.223-22"},{"answers":[{"section":"52.212-3.c","naics":[{"naicsName":"Other Computer Related Services","hasSizeChanged":"null","isPrimary":false,"ExcpCounter":1,"isSmallBusiness":"N","naicsCode":541519},{"naicsName":"Information Technology Value Added Resellers","hasSizeChanged":"null","isPrimary":false,"ExcpCounter":2,"isSmallBusiness":"N","naicsCode":541519},{"naicsName":"Engineering Services","hasSizeChanged":"null","isPrimary":false,"ExcpCounter":1,"isSmallBusiness":"N","naicsCode":541330},{"naicsName":"Military and Aerospace Equipment and Military Weapons","hasSizeChanged":"null","isPrimary":false,"ExcpCounter":2,"isSmallBusiness":"N","naicsCode":541330},{"naicsName":"Contracts and Subcontracts for Engineering Services Awarded Under the National Energy Policy Act of 1992","hasSizeChanged":"null","isPrimary":false,"ExcpCounter":3,"isSmallBusiness":"N","naicsCode":541330},{"naicsName":"Marine Engineering and Naval Architecture","hasSizeChanged":"null","isPrimary":false,"ExcpCounter":4,"isSmallBusiness":"N","naicsCode":541330},{"naicsName":"Software Publishers","hasSizeChanged":"null","isPrimary":true,"isSmallBusiness":"N","naicsCode":511210},{"naicsName":"Wired Telecommunications Carriers","hasSizeChanged":"null","isPrimary":false,"isSmallBusiness":"N","naicsCode":517311},{"naicsName":"Data Processing, Hosting, and Related Services","hasSizeChanged":"null","isPrimary":false,"isSmallBusiness":"N","naicsCode":518210},{"naicsName":"Custom Computer Programming Services","hasSizeChanged":"null","isPrimary":false,"isSmallBusiness":"N","naicsCode":541511},{"naicsName":"Computer Systems Design Services","hasSizeChanged":"null","isPrimary":false,"isSmallBusiness":"N","naicsCode":541512},{"naicsName":"Computer Facilities Management Services","hasSizeChanged":"null","isPrimary":false,"isSmallBusiness":"N","naicsCode":541513},{"naicsName":"Other Scientific and Technical Consulting Services","hasSizeChanged":"null","isPrimary":false,"isSmallBusiness":"N","naicsCode":541690},{"naicsName":"All Other Professional, Scientific, and Technical Services","hasSizeChanged":"null","isPrimary":false,"isSmallBusiness":"N","naicsCode":541990}]},{"answerText":"No","section":"52.212-3.q.2.i"},{"answerText":"No","section":"52.212-3.q.2.ii"},{"answerText":"No","section":"52.212-3.c.11.ii"},{"answerText":"Yes","section":"52.212-3.d.1.i"},{"answerText":"Yes","section":"52.212-3.d.1.ii"},{"answerText":"Microsoft Corporation has developed and has on file affirmative action programs required by Secretary of Labor regulations.","section":"52.212-3.d.2.i"},{"answerText":"Vendor will provide information with specific offers to the Government","section":"52.212-3.f"},{"answerText":"No","section":"52.212-3.h.1"},{"answerText":"No","section":"52.212-3.h.2"},{"answerText":"No","section":"52.212-3.h.4"},{"answerText":"No","section":"52.212-3.h.3"},{"answerText":"No","section":"52.212-3.h.5"},{"answerText":"No","section":"52.212-3.i.2.i"},{"section":"52.212-3.j"},{"answerText":"Vendor will provide information with specific offers to the Government","section":"52.212-3.k.1.2.i"},{"answerText":"Vendor will provide information with specific offers to the Government","section":"52.212-3.k.2.2"},{"answerText":"Corporate Entity (Not Tax Exempt)","section":"52.212-3.l.4"},{"answerText":"No","section":"52.212-3.l.5"},{"answerText":"No","section":"52.212-3.n.2.i"},{"answerText":"No","section":"52.212-3.n.2.ii"},{"answerText":"No","section":"52.212-3.p.1"},{"answerText":"No","section":"52.212-3.r.1"},{"answerText":"No","section":"52.226-2.b.1"},{"answerText":"No","section":"52.226-2.b.2"}],"id":"FAR 52.212-3"},{"answers":[{"section":"52.219-1.b","naics":[{"naicsName":"Other Computer Related Services","hasSizeChanged":"null","isPrimary":false,"ExcpCounter":1,"isSmallBusiness":"N","naicsCode":541519},{"naicsName":"Information Technology Value Added Resellers","hasSizeChanged":"null","isPrimary":false,"ExcpCounter":2,"isSmallBusiness":"N","naicsCode":541519},{"naicsName":"Engineering Services","hasSizeChanged":"null","isPrimary":false,"ExcpCounter":1,"isSmallBusiness":"N","naicsCode":541330},{"naicsName":"Military and Aerospace Equipment and Military Weapons","hasSizeChanged":"null","isPrimary":false,"ExcpCounter":2,"isSmallBusiness":"N","naicsCode":541330},{"naicsName":"Contracts and Subcontracts for Engineering Services Awarded Under the National Energy Policy Act of 1992","hasSizeChanged":"null","isPrimary":false,"ExcpCounter":3,"isSmallBusiness":"N","naicsCode":541330},{"naicsName":"Marine Engineering and Naval Architecture","hasSizeChanged":"null","isPrimary":false,"ExcpCounter":4,"isSmallBusiness":"N","naicsCode":541330},{"naicsName":"Software Publishers","hasSizeChanged":"null","isPrimary":true,"isSmallBusiness":"N","naicsCode":511210},{"naicsName":"Wired Telecommunications Carriers","hasSizeChanged":"null","isPrimary":false,"isSmallBusiness":"N","naicsCode":517311},{"naicsName":"Data Processing, Hosting, and Related Services","hasSizeChanged":"null","isPrimary":false,"isSmallBusiness":"N","naicsCode":518210},{"naicsName":"Custom Computer Programming Services","hasSizeChanged":"null","isPrimary":false,"isSmallBusiness":"N","naicsCode":541511},{"naicsName":"Computer Systems Design Services","hasSizeChanged":"null","isPrimary":false,"isSmallBusiness":"N","naicsCode":541512},{"naicsName":"Computer Facilities Management Services","hasSizeChanged":"null","isPrimary":false,"isSmallBusiness":"N","naicsCode":541513},{"naicsName":"Other Scientific and Technical Consulting Services","hasSizeChanged":"null","isPrimary":false,"isSmallBusiness":"N","naicsCode":541690},{"naicsName":"All Other Professional, Scientific, and Technical Services","hasSizeChanged":"null","isPrimary":false,"isSmallBusiness":"N","naicsCode":541990}]},{"answerText":"No","section":"52.219-1.b.8.ii"}],"id":"FAR 52.219-1"},{"answers":{"answerText":"Vendor will provide information with specific offers to the Government","section":"52.227-15.b.2"},"id":"FAR 52.227-15"},{"answers":{"answerText":"No","section":"52.204-17.b"},"id":"FAR 52.204-17"},{"answers":{"answerText":"No","section":"FAR 52.204-20.b"},"id":"FAR 52.204-20"},{"answers":{"answerText":"No","section":"52.222-18.c.1"},"id":"FAR 52.222-18"},{"answers":[{"answerText":"Yes","section":"52.222-22.a"},{"answerText":"Yes","section":"52.222-22.b"}],"id":"FAR 52.222-22"},{"answers":{"answerText":"Microsoft Corporation has developed and has on file affirmative action programs required by Secretary of Labor regulations.","section":"52.222-25"},"id":"FAR 52.222-25"},{"answers":[{"answerText":"No","section":"52.209-11.b.1"},{"answerText":"No","section":"52.209-11.b.2"}],"id":"FAR 52.209-11"},{"answers":{"answerText":"Vendor will provide information with specific offers to the Government","section":"52.225-2.a"},"id":"FAR 52.225-2"},{"answers":{"answerText":"Vendor will provide information with specific offers to the Government","section":"52.225-4.a"},"id":"FAR 52.225-4"},{"answers":{"answerText":"Vendor will provide information with specific offers to the Government","section":"52.225-6.a"},"id":"FAR 52.225-6"},{"answers":{"answerText":"Vendor will provide information with specific offers to the Government","section":"52.222-48.a.1"},"id":"FAR 52.222-48"},{"answers":{"answerText":"Vendor will provide information with specific offers to the Government","section":"52.222-52.a.1.1"},"id":"FAR 52.222-52"},{"answers":{"answerText":"No","section":"SF330.1"},"id":"SF330"}],"dfarResponses":[{"answers":{"answerText":"No","section":"252.225-7022.b"},"id":"DFAR 252.225-7022"},{"answers":{"answerText":"No","section":"DFAR 252.216-7008.a"},"id":"DFAR 252.216-7008"},{"answers":{"answerText":"No","section":"DFAR 252.209-7002.1"},"id":"DFAR 252.209-7002"},{"answers":{"answerText":"Vendor will provide information with specific offers to the Government","section":"252.225-7000.c.1"},"id":"DFAR 252.225-7000"},{"answers":{"answerText":"Vendor will provide information with specific offers to the Government","section":"252.225-7020.c.1"},"id":"DFAR 252.225-7020"},{"answers":{"answerText":"Vendor will provide information with specific offers to the Government","section":"252.225-7022.c.1"},"id":"DFAR 252.225-7022"},{"answers":{"answerText":"Vendor will provide information with specific offers to the Government","section":"252.225-7035.c.1"},"id":"DFAR 252.225-7035"},{"answers":[{"answerText":"No","section":"252.225-7049.c.1"},{"answerText":"No","section":"252.225-7049.c.2"},{"answerText":"No","section":"252.225-7049.c.3"},{"answerText":"No","section":"252.225-7049.c.4"}],"id":"DFAR 252.225-7049"}]},"corporateStructureName":"Corporate Entity (Not Tax Exempt)","statusMessage":"Active","stateOfIncorporation":"WA","disasterRelief":"null","doingBusinessAsName":"Microsoft","mailingAddress":{"zip":"98052","city":"REDMOND","countryCode":"USA","stateorProvince":"WA","line2":"null","line1":"ONE MICROSOFT WAY","zipPlus4":"null"},"hasKnownExclusion":false,"altPastPerformancePoc":{"nonUsPhone":"null","firstName":"MELISSA","lastName":"RANSLEM","middleInitial":"null","address":{"zip":"20190","city":"RESTON","countryCode":"USA","stateorProvince":"VA","line2":"null","line1":"12012 SUNSET HILLS ROAD","zipPlus4":"null"},"notes":"null","usPhoneExt":"null","title":"CONTRACTS MANAGER","fax":"4257086748","usPhone":"5713532701","email":"MELR@MICROSOFT.COM"},"legalBusinessName":"Microsoft Corporation","duns":"081466849","divisionNumber":"null","activationDate":"2019-10-02 11:00:10.02812","naics":[{"naicsName":"Custom Computer Programming Services","isPrimary":false,"naicsCode":"541511"},{"naicsName":"Other Scientific and Technical Consulting Services","isPrimary":false,"naicsCode":"541690"},{"naicsName":"Computer Systems Design Services","isPrimary":false,"naicsCode":"541512"},{"naicsName":"Data Processing, Hosting, and Related Services","isPrimary":false,"naicsCode":"518210"},{"naicsName":"Other Computer Related Services","isPrimary":false,"naicsCode":"541519"},{"naicsName":"Computer Facilities Management Services","isPrimary":false,"naicsCode":"541513"},{"naicsName":"Software Publishers","isPrimary":true,"naicsCode":"511210"},{"naicsName":"All Other Professional, Scientific, and Technical Services","isPrimary":false,"naicsCode":"541990"},{"naicsName":"Engineering Services","isPrimary":false,"naicsCode":"541330"},{"naicsName":"Wired Telecommunications Carriers","isPrimary":false,"naicsCode":"517311"}],"status":"ACTIVE"}}}
最佳答案
您需要一个自定义转换器。
您正在尝试转换复杂类型,结果 Newtonsoft 不知道该怎么做。修复相当简单,记录在此处:Using a Custom JsonConverter to fix bad JSON results .
因为链接坏了,你需要的是:
class SingleValueArrayConverter<T> : JsonConverter
{
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
throw new NotImplementedException();
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
object retVal = new Object();
if (reader.TokenType == JsonToken.StartObject)
{
T instance = (T)serializer.Deserialize(reader, typeof(T));
retVal = new [] { instance };
}
else if (reader.TokenType == JsonToken.StartArray)
{
retVal = serializer.Deserialize(reader, objectType);
}
return retVal;
}
public override bool CanConvert(Type objectType) => objectType == typeof(T);
}
然后,您可以创建一些对象来表示您的数据:
class SamPointOfContact
{
public string firstName { get; set; }
public string lastName { get; set; }
public string title { get; set; }
}
class Naics
{
public string naicsName { get; set; }
public string hasSizeChanged { get; set; }
public bool isPrimary { get; set; }
public int ExcpCounter { get; set; }
public string isSmallBusiness { get; set; }
public int naicsCode { get; set; }
}
class Answer
{
public string answerText { get; set; }
public string section { get; set; }
public SamPointOfContact samPointOfContact { get; set; }
public Naics[] naics { get; set; }
}
class AnswerNode
{
[JsonConverter(typeof(SingleValueArrayConverter<Answer>))]
public Answer[] answers { get; set; }
public string id { get; set; }
}
class Root
{
public AnswerNode[] listOfAnswers { get; set; }
}
此外,我使用了数组而不是 List
,而链接的博客使用了 List
。如果您愿意,可以更改。
最后,像往常一样使用 Newtonsoft 反序列化:
Root result =
JsonConvert.DeserializeObject<Root>(
System.IO.File.ReadAllText("test.json"));
现在我通过获取你的 JSON 并将其放入快速数组 { "listOfAnswers": [ ... your original JSON ... ] }
,您需要对其进行修改以适合您的实际数据。
关于c# - 从具有不同类型节点的 JSON 创建类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58454504/
我正在使用 JavaFX 8 创建一个应用程序。我使用拖/放动态更改网格 Pane 的内容。我希望每行或每行/列迭代 GridPane 内容。JavaFX 允许通过指定行和列在 GridPane 中添
我正在尝试将图像拖放到div上。图像没有被拖到div上并给出以下错误 Uncaught TypeError: Failed to execute 'appendChild' on 'Node': pa
我正在 android studio 中创建内部构建 AR 导航。我正在寻找一种方法将 anchor 与其他 anchor 或 anchor 节点/节点“连接”起来。我不确定使用哪一个。基于我将强制用
我在 Hive 上运行一些作业:首先是 4 节点,然后是 2 节点。令我惊讶的是,我的 2 节点性能比我的 4 节点更好。 首先,我在一个 4 节点(4 个事件节点)上运行查询,然后关闭 2 个节点(
我有 Node* current ,我在其中存储指向列表“顶部”当前节点的指针。当我将一个新节点设置为当前节点时,出现错误: '=' : cannot convert from 'CircularDo
我是 dcos Mesos 的新手,在本地 Ubuntu 机器上安装了 dc os。 我可以查看 dcos 仪表板。 但我无法使用 dcos node ssh --master-proxy --lea
在 JavaFX 中,是否有类似 setLayout(); 的东西?或 setBounds(); ? 例如,我想将按钮定位到我想要的位置。 最佳答案 JavaFX 场景图上的所有内容都是 Node .
我正在开发一个 JavaFX 应用程序,其中我开发的类(从 javafx.scene.Parent 扩展)是根据用户在 ListView 控件中单击的条目动态创建的。 只是要清楚这个节点,它不是使用像
我正在尝试为节点-边缘关系创建一个类图,因为它可以在有向图中找到。我想传达的是,Nodes 引用了 Edges,Edges 也引用了 Nodes。每个 Edge 都恰好需要两个 Node(源和目标)。
在mapreduce作业期间,单个任务将在随机节点上运行,是否有任何方法限制应在其中运行任务的节点? 最佳答案 Hadoop不会选择节点来随机运行任务。考虑到数据局部性,否则将有很多网络开销。 任务与
有什么区别: a) nodetool 重建 b) nodetool 修复 [-pr] 换句话来说,各个命令到底是做什么的? 最佳答案 nodetool重建:类似于引导过程(当您向集群添加新节点时),但
我已将第一个 OneToMany 关系添加到我的 hibernate 3.6.10 项目中。这是一个类: /** * */ package com.heavyweightsoftware.leal
是否有可能找到正在监听触发当前函数的事件的元素? 在下面的代码中,event.target 返回 #xScrollPane 和 event.currentTarget 和 event 的最低子节点.f
我正在尝试覆盖我数据库中的一些数据。结构很简单,就是: recipes { user_1{ recipe_1{data} recipe_2{data} } user_2{
我使用 setInterval 来运行该函数,但它会多次执行函数 2... 如何在输入中插入一个值后执行函数 第一个输入与其余输入的距离不同 如何在插入 val(tab 选项)后将插入从 1 个输入移
我不知道代码有什么问题,但在 visual studio 中不断收到这些错误消息。 Error 18 error C1903: unable to recover from previous e
我正在尝试从其类中获取 SharePoint 搜索导航节点的对象。 var nodes = $("div.ms-qSuggest-listItem"); 我正在获取节点对象,现在想要获取“_promp
D:\nodeP>node main.js module.js:327 抛出错误; ^ 错误:在 Function.Module 的 Function.Module._resolveFilename
struct node{ int key, prior, cnt, val; node *l, *r; node(){} node(int nkey) : key(nkey),
我有以下代码使用迭代器将项目插入双链表。这就是我们被要求这样做的方式。代码有效,但问题是我有 24 字节的绝对内存泄漏。 NodeIterator insert(NodeIterator & itrP
我是一名优秀的程序员,十分优秀!