annotations icon indicating copy to clipboard operation
annotations copied to clipboard

Add method getAsString

Open gsouf opened this issue 8 years ago • 4 comments

Currently there is a method AnnotationBag::getAsArray() That's very convenient when we want to make sure to retrieve an array.

What's about adding a method AnnotationBag::getAsString() or AnnotationBag::getAsRawString() to get the annotation value as a string. Even if it's in array or object annotation, we sometime want to get this value as the raw original string.

We could do that by changing the parser. But sometime we can need both of the ouput depending on the annotation name.

What's your opinion ?

gsouf avatar Oct 13 '15 12:10 gsouf

It will depend on how much change it would require on public classes.

marcioAlmada avatar Oct 14 '15 14:10 marcioAlmada

And what's about publishing it for v3 ?

gsouf avatar Oct 14 '15 14:10 gsouf

For v3 it would be ok as long as it's not a huge BC break on the AnnotationsBag public API, which I believe is perfectly possible to do with internal changes only.

marcioAlmada avatar Oct 14 '15 16:10 marcioAlmada

That would actually require to change the constructor and the set methods of the annotation bag, because we need to pass both of the original string and the parsed one.

An other approach would be to pass only the raw string, and the annotationBag would be responsible to transform the raw string into the good type

gsouf avatar Nov 02 '15 08:11 gsouf