All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.protobufel.el.package-info Maven / Gradle / Ivy

The newest version!
//
// Copyright © 2014, David Tesler (https://github.com/protobufel)
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the  nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL  BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//

/**
 * 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 {@link Message} and {@link 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. {@link 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. {@link 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. {@code galaxy.name} *
  2. {@code galaxy['name']} *
  3. {@code galaxyBuilder.name = 'Silky Way'} *
  4. {@code galaxyBuilder['name'] = 'E Bay'} *
  5. {@code galaxy.star} - returns the list of Star(-s) *
  6. {@code galaxy.star[1].name} *
  7. {@code galaxyBuilder.star} - returns the repeated field Star's special wrapper *
  8. {@code galaxyBuilder.star[0].name} *
  9. {@code galaxyBuilder.star.add()} - returns the new empty star added to the Star field *
  10. {@code sun=galaxyBuilder.star.newInstance(); sun.name='Sun'; galaxyBuilder.star.add(1, sun) * .size()} *
  11. {@code galaxyBuilder.star.remove(1).getLast()} *
  12. {@code galaxyBuilder.star.remove(1).toParent().color = 'RED'} - galaxy color set to RED *
  13. {@code galaxyBuilder.star.getBuilders()} *
  14. {@code galaxyBuilder.star.getList()} - returns list of {@code Star}s *
  15. {@code galaxyBuilder.keyword[0] == 'my keyword'} *
* * @see Examples.java * @see galaxy.proto sample * @see JSR-000341 * Expression Language 3.0 * @see Protocol Buffers * * @author [email protected] David Tesler */ package com.github.protobufel.el;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy