Skip navigation links

Package com.github.protobufel.el

Enables the ProtoBuf Messages and Builders in JSR-341 EL 3.0 language.

See: Description

Package com.github.protobufel.el Description

Enables the ProtoBuf Messages and Builders in JSR-341 EL 3.0 language.

Use ProtoELProcessorEx in place of the original ELProcessor for processing both regular objects and ProtoBuf Messages and Builders.

The following rules apply to any ProtoBuf Message and Builder:

  1. all non-overloaded and distinct overloaded public methods are available as-is
  2. overloaded methods with the same number of arguments should be avoided, as the common EL rule
  3. the fields are treated similarly to EL map properties, by name or FieldDescriptor as the key
  4. the repeated fields, like EL lists, can be accessed by index
  5. in addition, Builder's repeated fields have all the additional methods of
  6. ProtoLists.IRepeatedFieldMessageBuilder - for the Message type repeated field:
    1. add() - adds and returns the empty field Builder
    2. add(value) - adds the MessageOrBuilder value and returns the builder
    3. add(index, value) - adds the MessageOrBuilder value at index and returns the builder
    4. addAll(Collection values) - adds all MessageOrBuilder values and returns the builder
    5. set(index, value) - sets the MessageOrBuilder value at index and returns the builder
    6. remove(index) - removes the item at index and returns the builder
    7. clear() - clears the repeated field and returns the builder
    8. getParent() - returns this builder's parent, if any
    9. newInstance() - returns a new empty standalone Builder for the field's MessageType
    10. size() - returns the size of the field
    11. get(index) - returns a field Builder at index
    12. getChangedIndex() - returns the last changed item's index
    13. getChanged(index) - returns the field Builder at index if it changed recently, or null otherwise
    14. getLast() - returns the last field Builder
    15. getList() - returns the entire field's Message list
    16. getFieldDescriptor() - returns the field's FieldDescriptor
    17. getType() - returns JavaType.Message
    18. getBuilders() - returns the entire field's Builder list , for the Builder only
    19. getMessage(index) - returns the Message at index
  7. ProtoLists.IRepeatedFieldValueBuilder - for any other repeated field
    1. add() - adds a default value and returns it
    2. add(value) - adds the value and returns the builder
    3. add(index, value) - adds the value at index and returns the builder
    4. addAll(Collection values) - adds all values and returns the builder
    5. set(index, value) - sets the value at index and returns the builder
    6. remove(index) - removes the item at index and returns the builder
    7. clear() - clears the repeated field and returns the builder
    8. getParent() - returns this builder's parent, if any
    9. newInstance() - returns a new default value of the field type
    10. size() - returns the size of the field
    11. get(index) - returns the item at index
    12. getChangedIndex() - returns the last changed item's index
    13. getChanged(index) - returns the item at index if it changed recently, or null otherwise
    14. getLast() - returns the last item
    15. getList() - returns the entire field's list of items
    16. getFieldDescriptor() - returns the field's FieldDescriptor
    17. getType() - returns the JavaType of the field

Examples of usage in EL expressions:

  1. galaxy.name
  2. galaxy['name']
  3. galaxyBuilder.name = 'Silky Way'
  4. galaxyBuilder['name'] = 'E Bay'
  5. galaxy.star - returns the list of Star(-s)
  6. galaxy.star[1].name
  7. galaxyBuilder.star - returns the repeated field Star's special wrapper
  8. galaxyBuilder.star[0].name
  9. galaxyBuilder.star.add() - returns the new empty star added to the Star field
  10. sun=galaxyBuilder.star.newInstance(); sun.name='Sun'; galaxyBuilder.star.add(1, sun) .size()
  11. galaxyBuilder.star.remove(1).getLast()
  12. galaxyBuilder.star.remove(1).toParent().color = 'RED' - galaxy color set to RED
  13. galaxyBuilder.star.getBuilders()
  14. galaxyBuilder.star.getList() - returns list of Stars
  15. galaxyBuilder.keyword[0] == 'my keyword'
See Also:
Examples.java, galaxy.proto sample, JSR-000341 Expression Language 3.0, Protocol Buffers
Skip navigation links