Comments (6)
Have you tried:
modules = foo
foo.source = path/to/your/foo.proto
foo.output = path/to/your/foo.java.stg
foo.outputDir = your_output_dir
foo.options = your_options
group foo : java_bean;
message_getters_and_setters(message, options) ::= <<
// getters and setters
<message.fields:field_getters_and_setters(field=it, options=options,
message=message)>
// add your extra methods here.
>>
What you suggested could be easily added ... but then again, I think the above
approach would work fine. Let me know if it that works you?
Original comment by [email protected]
on 25 Jan 2011 at 2:44
- Changed state: Accepted
from protostuff-googlecode-exported.
oh yes that does work for the scenario I have now. Thank you. Out of
interest, why did you choose not to use the builder pattern?
I dont really like mutable objects, and the idea of a builder where I can set
the properties then build an immutable instance is much better (for me :-) ).
Original comment by [email protected]
on 25 Jan 2011 at 3:23
from protostuff-googlecode-exported.
actually, is it possible that rather than:
foo.output = path/to/your/foo.java.stg
then can have a file on the classpath. i want to package the template up in a
jar for other sub components to use, but I cant figure out how to reference the
file on the classpath in the jar.
thanks, for your help!
Original comment by [email protected]
on 25 Jan 2011 at 3:26
from protostuff-googlecode-exported.
Why not the builder pattern?
For one, ser/deser of cyclic references is not possible with the builder
pattern. Protostuff has been built to be as flexible as possible to perform
any kind of serialization.
With regards to immutablility, you can still make your objects immutable by
marking all the fields final.
See
http://groups.google.com/group/protostuff/browse_thread/thread/2bd1299985224d9a
I'll probably add that to protostuff-runtime(as a runtime option) to support
immutable objects.
Btw, if you want to contribute your extra methods, it can be added to
protostuff as a standard option.
With regards to loading from classpath, can you file a new issue for that one?
On the other hand, the imported protos can already be imported from the
classpath (and from a remote http url too).
Original comment by [email protected]
on 25 Jan 2011 at 5:36
- Changed state: Done
from protostuff-googlecode-exported.
Thank you for your reply so quickly! Ok, I understand why you're not using the
builder pattern now. I dont think I will be able to contribute the extra
method, because they are adding compatibility to a framework I am developing so
its not really generic.
Ok, I will raise one for the classpath.
One more question if thats ok. I have a definition in a subfolder importing a
.proto in another folder, e.g.
./subflder2/Bar.proto
In that file it has this:
import "PATH/subfoler1/Foo.proto";
But when I try to generate a class with the protostuff compiler I get this
error:
1/25/11 3:39:26 PM JST: Build error for /myproject/pom.xml;
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal
com.dyuproject.protostuff:protostuff-maven-plugin:1.0.0.M7:compile
(generate-sources) on project my-project: java.lang.RuntimeException:
java.lang.IllegalStateException: Imported proto ./subfolder1/Foo.proto not
found.
The import works fine using the protobuf compiler. I think its a bug, should I
raise a new issue, or do you think I am doing something wrong? I need these
files to compile with the regular protobuf compiler too for now Java components.
thanks again for your help! I really like the product, its cleaner than the
protobuf generated classes.
Original comment by [email protected]
on 25 Jan 2011 at 6:50
from protostuff-googlecode-exported.
is PATH a keyword in protobuf?
It would even be better if you could provide a sample set of protos w/c
replicates the problem (would quicker to fix the bug that way)
Thanks
Original comment by [email protected]
on 25 Jan 2011 at 8:05
from protostuff-googlecode-exported.
Related Issues (20)
- Would like support for repeated accessors with out "List" appeneded
- Enter one-line summary HOT 2
- getSchema() of java.util.Properties fails HOT 2
- optimize xml format
- Enum alias support
- YamlOutput bug on repeated message fields HOT 1
- Deserializing a message which is protostuff-runtime serialized and has custom class as field HOT 3
- Visual disturbance of @Deprecated annotation HOT 12
- Support for newing object instances on Android 4.3+ devices HOT 2
- ConcurrentLinkedDeque support HOT 1
- Produces uncompilable Java when a field is called "default" HOT 4
- 1.0.7 Build error: ProtoParserTest fails HOT 2
- protostuff-parser and protostuff-compiler disagree on required version of antlr
- Optimize ProtobufOuput for small nested messages (max size of 127) HOT 1
- How can I serialize a negative int32 to the protobuf format using zigzag encoding? HOT 2
- How to Ignore Array of Null Values in JSON
- enums_by_name does not seem to be working using maven plugin
- The value of DataInput.readByte() should not be eof-checked since that method throws EOFException HOT 1
- Wrong output path is generated in Windows for .java files HOT 3
- Unable to parse proto enum containing hex constants 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 protostuff-googlecode-exported.