Examples of MethodDesc


Examples of net.jini.constraint.BasicMethodConstraints.MethodDesc

                name = "someMethod";
                Class[] types2 = new Class[types.length];
                for (int j = 0; j < types.length; ++j) {
                    types2[j] = types[j];
                }
                MethodDesc md1 =
                    callConstructor(testCase, name, types, constraints);
                MethodDesc md2 =
                    callConstructor(testCase, name, types2, constraints);
                if (!md1.equals(md2)) {
                    throw new TestException(
                            "MethodDesc objects should be equal");
                }
                types2[0] = long.class;
                if (!md1.equals(md2)) {
                    throw new TestException(
                            "MethodDesc objects should be equal");
                }
            }
           
            // 6
            name = "someMethod";
            InvocationConstraints emptyConstraints = new InvocationConstraints(
                    (InvocationConstraint) null, null);
            MethodDesc md1 =
                callConstructor(testCase, name, types, emptyConstraints);
            MethodDesc md2 =
                callConstructor(testCase, name, types, null);
            if (!md1.equals(md2)) {
                throw new TestException(
                        "MethodDesc objects should be equal");
            }
View Full Code Here

Examples of net.jini.constraint.BasicMethodConstraints.MethodDesc

public class Ordering {

    static MethodDesc desc(String n, Class[] t) {
  if (t == null) {
      return new MethodDesc(n, null);
  } else {
      return new MethodDesc(n, t, null);
  }
    }
View Full Code Here

Examples of net.jini.constraint.BasicMethodConstraints.MethodDesc

  legal(n1, n2);
  illegal(n2, n1);
    }

    static void def(String n) {
  MethodDesc d = new MethodDesc(null);
  legal(desc(n, null), d);
  illegal(d, desc(n, null));
  if (n.indexOf('*') < 0) {
      legal(desc(n, types1), d);
      illegal(d, desc(n, types1));
View Full Code Here

Examples of net.jini.constraint.BasicMethodConstraints.MethodDesc

        "constraints cannot be empty");
  check(new BMC(null), null);
  check(new BMC(new MethodDesc[0]),
        "must have at least one descriptor");
  check(new BMC(new MethodDesc[]{
      new MethodDesc(null),
      new MethodDesc("foo", null)}),
        "default descriptor must be last");
  check(new BMC(new MethodDesc[]{
      new MethodDesc("foo*", null),
      new MethodDesc("foo", null)}),
        "foo* cannot precede foo");
  check(new BMC(new MethodDesc[]{
      new MethodDesc("foo", null),
      new MethodDesc("foo", noClasses, null)}),
        "foo cannot precede foo()");
  check(new BMC(new MethodDesc[]{
      new MethodDesc("*bar", null),
      new MethodDesc("*foobar", null)}),
        "*bar cannot precede *foobar");
    }
View Full Code Here

Examples of net.jini.constraint.BasicMethodConstraints.MethodDesc

  int count = mappings.length / 2;
  MethodDesc[] descs = new MethodDesc[count];
  for (int i = mappings.length - 1; i >= 0; i-= 2) {
      Method from = mappings[i - 1];
      Method to = mappings[i];
      descs[--count] = new MethodDesc(
    to.getName(), to.getParameterTypes(),
    methodConstraints.getConstraints(from));
  }
  return new BasicMethodConstraints(descs);
    }
View Full Code Here

Examples of net.jini.constraint.BasicMethodConstraints.MethodDesc

    static final InvocationConstraints sc =
      new InvocationConstraints(Integrity.YES, null);

    static MethodDesc desc(String n) {
  return new MethodDesc(n, sc);
    }
View Full Code Here

Examples of net.jini.constraint.BasicMethodConstraints.MethodDesc

    static MethodDesc desc(String n) {
  return new MethodDesc(n, sc);
    }

    static MethodDesc desc(String n, Class[] t) {
  return new MethodDesc(n, t, sc);
    }
View Full Code Here

Examples of net.jini.constraint.BasicMethodConstraints.MethodDesc

  match(m, desc("length"));
  match(m, desc("*length"));
  match(m, desc("length*"));
  match(m, desc("*th"));
  match(m, desc("le*"));
  match(m, new MethodDesc(sc));
  nomatch(m, desc("lengt", new Class[0]));
  nomatch(m, desc("ength", new Class[0]));
  nomatch(m, desc("length", new Class[]{String.class}));
  nomatch(m, desc("get*"));
  nomatch(m, desc("*bar"));
  Class[] t = new Class[]{int.class, String.class, int.class, int.class};
  m = String.class.getMethod("regionMatches", t);
  match(m, desc("regionMatches", t));
  match(m, desc("regionMatches"));
  match(m, desc("*Matches"));
  match(m, desc("region*"));
  match(m, new MethodDesc(sc));
  nomatch(m, desc("regionMatches", new Class[0]));
  nomatch(m, desc("regionMatches",
      new Class[]{boolean.class, String.class,
            int.class, int.class}));
    }
View Full Code Here

Examples of net.jini.constraint.BasicMethodConstraints.MethodDesc

        // 1
        String name = "someMethod";
        InvocationConstraint ic = Delegation.YES;
        InvocationConstraints constraints = new InvocationConstraints(
                ic, null);
        MethodDesc methodDesc1 = new MethodDesc(name, constraints);
        MethodDesc methodDesc2 = new MethodDesc(constraints);
        MethodDesc [] descs = {methodDesc1, methodDesc2};
        BasicMethodConstraints bmc1 = new BasicMethodConstraints(descs);
        BasicMethodConstraints bmc2 = new BasicMethodConstraints(descs);
        if (!bmc1.equals(bmc2)) {
            throw new TestException(
                    "equals method should return true");
        }
       
        // 2
        bmc1 = new BasicMethodConstraints(constraints);
        bmc2 = new BasicMethodConstraints(constraints);
        if (!bmc1.equals(bmc2)) {
            throw new TestException(
                    "equals method should return true");
        }
       
        // 3
        MethodDesc [] simpleDescs = {methodDesc2};
        bmc1 = new BasicMethodConstraints(constraints);
        bmc2 = new BasicMethodConstraints(simpleDescs);
        if (!bmc1.equals(bmc2) || !bmc2.equals(bmc1)) {
            throw new TestException(
                    "equals method should return true");
        }
       
        // 4
        String name2 = "someDifferentMethod";
        MethodDesc methodDesc3 = new MethodDesc(name2, constraints);
        MethodDesc [] descs2 = {methodDesc3, methodDesc2};
        bmc1 = new BasicMethodConstraints(descs);
        bmc2 = new BasicMethodConstraints(descs2);
        if (bmc1.equals(bmc2)) {
            throw new TestException(
View Full Code Here

Examples of net.jini.constraint.BasicMethodConstraints.MethodDesc

        // 1
        String name = "someMethod";
        InvocationConstraint ic = Delegation.YES;
        InvocationConstraints constraints = new InvocationConstraints(
                ic, null);
        MethodDesc methodDesc1 = new MethodDesc(name, constraints);
        MethodDesc methodDesc2 = new MethodDesc(constraints);
        MethodDesc [] descs = {methodDesc1, methodDesc2};
        new BasicMethodConstraints(descs);

        // 2
        MethodDesc [] storedDescs = {methodDesc1, methodDesc2};
        MethodDesc [] passedDescs = {methodDesc1, methodDesc2};
        new BasicMethodConstraints(passedDescs);
        for (int j = 0; j < passedDescs.length; ++j) {
            if (storedDescs[j] != passedDescs[j]) {
                throw new TestException(
                        "MethodDesc array was modified");
            }
        }

        // 3
        String name2 = "*someMethod";
        MethodDesc methodDesc3 = new MethodDesc(name2, constraints);
        MethodDesc [] descs1 = {methodDesc1, methodDesc2};
        MethodDesc [] descs2 = {methodDesc1, methodDesc2};
        BasicMethodConstraints bmc1 = new BasicMethodConstraints(descs1);
        BasicMethodConstraints bmc2 = new BasicMethodConstraints(descs2);
        descs2[1] = methodDesc3;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.