jsr-283
  1. jsr-283
  2. JSR_283-799

Session.hasCapability(): arguments should be passed as Object[]

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: current
    • Fix Version/s: milestone 1
    • Component/s: javadoc/api
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      799

      Description

      Session.hasCapability(String, Object, Map):

      method arguments are passed as name/value pairs in a map. while this approach would be probably
      fine for an interpreted scripting language, it's IMO not suitable for a compiled language like java.
      an implementation would need to hard-code every argument name of every jcr api method in order to
      properly identify the method in question and evaluate the arguments.

      a more java-like approach would be to pass the arguments as array of objects, like e.g. in the
      java.lang.reflection.Method#invoke() method. this would allow to use reflection to identify the method.

      i therefore suggest to change the signature to

      public boolean hasCapability(String methodName, Object target, Object[] arguments) throws
      RepositoryException;

      The arguments parameter is an Object array containing the values of the formal parameters, in declared
      order.

        Activity

        Hide
        Peeter Piegaze added a comment -

        Unless someone objects I will make the change suggested by Angela

        Show
        Peeter Piegaze added a comment - Unless someone objects I will make the change suggested by Angela
        Hide
        Peeter Piegaze added a comment -

        Fixed as suggested

        Show
        Peeter Piegaze added a comment - Fixed as suggested
        Hide
        stefan_guggisberg added a comment -

        api java source still needs to be fixed.

        sample code in spec is incorrect:

        boolean b = S.hasCapability("addNode", N, "foo");

        should be

        boolean b = S.hasCapability("addNode", N, new Object[]

        {"foo"}

        );

        Show
        stefan_guggisberg added a comment - api java source still needs to be fixed. sample code in spec is incorrect: boolean b = S.hasCapability("addNode", N, "foo"); should be boolean b = S.hasCapability("addNode", N, new Object[] {"foo"} );
        Hide
        Peeter Piegaze added a comment -

        code example fixed

        Show
        Peeter Piegaze added a comment - code example fixed

          People

          • Assignee:
            jsr-283-issues
            Reporter:
            stefan_guggisberg
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: