Can you do loops in code templates, e.g I want to print all the fields in a class. Is there a template for that?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Since I didn't find what I was looking for, I put it in my plugin. It supports variations. If you have
class
calledCompany
with fieldscompanyName
,companyType
, etc. it will generate print statements as shown below if you select logger.debug variation :Eclipse can generate
toString()
, which includes a print out of all fields and their string values, if that's what you are after.Assuming you're talking about
Java > Editor > Templates
a reference (maybe outdated) is hereThis SO question useful-eclipse-java-code-templates containes some examples.
To iterate over class members using a toString() style generator you may find this useful: toString() Generator: Format Templates