Comments (6)
Hi,
nothing from the public API like @Path
has been deprecated.
This GitHub issue is only about internal code generation and that there could be some optimizations done. I.e. NestedChildElementBinder
is generated at compile time, but the generated code could be optimized further ...
from tikxml.
I have a question for
TypeSpec.anonymousClassBuilder("false")
.addSuperinterface(nestedChildElementBinderType)
.addInitializerBlock(initializerBuilder.build())
.build()
in CodeGeneratorHelper.kt
Should I remove this
addSuperinterface(nestedChildElementBinderType)
line or replace with another variables
from tikxml.
I have no clue 😄 I have to look at the code in more detail,
but basically DelegatingTypeAdapter
and NestedChildElementBinder
should not be used anymore by the generated code and therefore these classes could be removed.
from tikxml.
here is code in question
fun generateNestedChildElementBinder(element: XmlElement): TypeSpec {
val initializerBuilder = CodeBlock.builder()
if (element.hasAttributes()) {
val attributeMapType = ParameterizedTypeName.get(ClassName.get(HashMap::class.java), ClassName.get(String::class.java), attributeBinderType)
initializerBuilder.addStatement("$attributeBindersParam = new \$T()", attributeMapType);
initializerBuilder.add(generateAttributeBinders(element))
}
if (element.hasChildElements()) {
val childBinderTypeMap = ParameterizedTypeName.get(ClassName.get(HashMap::class.java), ClassName.get(String::class.java), childElementBinderType)
initializerBuilder.addStatement("$childElementBindersParam = new \$T()", childBinderTypeMap);
for ((xmlName, xmlElement) in element.childElements) {
initializerBuilder.addStatement("${CodeGeneratorHelper.childElementBindersParam}.put(\$S, \$L)", xmlName, xmlElement.generateReadXmlCode(this))
}
}
// TODO text content?
return TypeSpec.anonymousClassBuilder("false")
.addSuperinterface(nestedChildElementBinderType)
.addInitializerBlock(initializerBuilder.build())
.build()
}
from tikxml.
Sorry,
I haven't had time to look into this. Not sure if I have time the next 2 weeks.
from tikxml.
Hi @sockeqwe ,
I'm using 'com.tickaroo.tikxml:core:0.8.13' & 'com.tickaroo.tikxml:auto-value-tikxml:0.8.13'
and I got auto generated class GetCMSXmlTikXmlValueHolder$$TypeAdapter which has NestedChildElementBinder.
if NestedChildElementBinder is deprecated, does that mean I should not use @'Path' annotation?
public class GetCMSXmlTikXmlValueHolder$$TypeAdapter implements TypeAdapter<GetCMSXmlTikXmlValueHolder> {
....childElementBinders.put("cms:CmsDataSet", new NestedChildElementBinder<GetCMSXmlTikXmlValueHolder>(false) {
....}
}
-- xml pojo --
@Xml(name = "cms:ExchangeData")
@AutoValue
public abstract class GetCMSXml implements Parcelable {
@Path("cms:CmsDataSet")
@Element(name = "cms:CmsData")
public abstract List<CmsData> cmsDataList();
}
from tikxml.
Related Issues (20)
- How to use NameSpace HOT 1
- How to initiate the lib in kotlin HOT 1
- The Future of TikXML HOT 4
- Dynamic root tag name HOT 6
- XML not generate in defined order HOT 2
- Parsing not work HOT 3
- exception while reading rss feed HOT 7
- Type converter for inserting into database HOT 2
- Problemas de parseo con dos objetos y arraylist dentro de cada uno HELP HOT 2
- Support for generic elements
- Support for iso-8859-1 HOT 7
- No TypeAdapter for class HOT 2
- java: incompatible types: java.lang.Object cannot be converted to Book HOT 2
- Docs don't mention how to make a model class for an xml like the following HOT 3
- addTypeConverter
- Support for empty lists HOT 1
- "isXXX: String" compile error
- Plans to release 0.9.x?
- Update versions of okio and guava
- Ksp support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tikxml.