Class LookupAttributes

java.lang.Object
com.sun.jini.lookup.entry.LookupAttributes

public class LookupAttributes extends Object
Some simple utilities for manipulating lookup service attributes. These are not high-performance operations; it is expected that they are called relatively infrequently.
Author:
Sun Microsystems, Inc.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Entry[]
    add(Entry[] attrSets, Entry[] addAttrSets)
    Returns a new array containing the elements of the addAttrSets parameter (that are not duplicates of any of the elements already in the attrSets parameter) added to the elements of attrSets.
    static Entry[]
    add(Entry[] attrSets, Entry[] addAttrSets, boolean checkSC)
    Returns a new array containing the elements of the addAttrSets parameter (that are not duplicates of any of the elements already in the attrSets parameter) added to the elements of attrSets.
    static void
    check(Entry[] attrs, boolean nullOK)
    Throws an IllegalArgumentException if any element of the array is not an instance of a valid Entry class (the class is not public, or does not have a no-arg constructor, or has primitive public non-static non-final fields).
    static boolean
    equal(Entry[] attrSet1, Entry[] attrSet2)
    Tests that two Entry[] arrays are the same.
    static boolean
    equal(Entry e1, Entry e2)
    Test that two entries are the same type, with the same public fields.
    static boolean
    matches(Entry tmpl, Entry e)
    Test if the parameter tmpl is the same class as, or a superclass of, the parameter e, and that every non-null public field of tmpl is the same as the corresponding field of e.
    static Entry[]
    modify(Entry[] attrSets, Entry[] attrSetTmpls, Entry[] modAttrSets)
    Returns a new array that contains copies of the attributes in the attrSets parameter, modified according to the contents of both the attrSetTmpls parameter and the modAttrSets parameter.
    static Entry[]
    modify(Entry[] attrSets, Entry[] attrSetTmpls, Entry[] modAttrSets, boolean checkSC)
    Returns a new array that contains copies of the attributes in the attrSets parameter, modified according to the contents of both the attrSetTmpls parameter and the modAttrSets parameter.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • add

      public static Entry[] add(Entry[] attrSets, Entry[] addAttrSets)
      Returns a new array containing the elements of the addAttrSets parameter (that are not duplicates of any of the elements already in the attrSets parameter) added to the elements of attrSets. The parameter arrays are not modified.

      Note that attribute equality is defined in terms of MarshalledObject.equals on field values. The parameter arrays are not modified.

      Throws an IllegalArgumentException if any element of addAttrSets is not an instance of a valid Entry class (the class is not public, or does not have a no-arg constructor, or has primitive public non-static non-final fields).

    • add

      public static Entry[] add(Entry[] attrSets, Entry[] addAttrSets, boolean checkSC)
      Returns a new array containing the elements of the addAttrSets parameter (that are not duplicates of any of the elements already in the attrSets parameter) added to the elements of attrSets. The parameter arrays are not modified.

      Note that attribute equality is defined in terms of MarshalledObject.equals on field values. The parameter arrays are not modified.

      If the checkSC parameter is true, then a SecurityException is thrown if any elements of the addAttrSets parameter are instanceof ServiceControlled.

      Throws an IllegalArgumentException if any element of addAttrSets is not an instance of a valid Entry class (the class is not public, or does not have a no-arg constructor, or has primitive public non-static non-final fields).

    • modify

      public static Entry[] modify(Entry[] attrSets, Entry[] attrSetTmpls, Entry[] modAttrSets)
      Returns a new array that contains copies of the attributes in the attrSets parameter, modified according to the contents of both the attrSetTmpls parameter and the modAttrSets parameter. The parameter arrays and their Entry instances are not modified.

      Throws an IllegalArgumentException if any element of attrSetTmpls or modAttrSets is not an instance of a valid Entry class (the class is not public, or does not have a no-arg constructor, or has primitive public non-static non-final fields).

    • modify

      public static Entry[] modify(Entry[] attrSets, Entry[] attrSetTmpls, Entry[] modAttrSets, boolean checkSC)
      Returns a new array that contains copies of the attributes in the attrSets parameter, modified according to the contents of both the attrSetTmpls parameter and the modAttrSets parameter. The parameter arrays and their Entry instances are not modified.

      If the checkSC parameter is true, then a SecurityException is thrown if any elements of the attrSets parameter that would be deleted or modified are instanceof ServiceControlled.

      Throws an IllegalArgumentException if any element of attrSetTmpls or modAttrSets is not an instance of a valid Entry class (the class is not public, or does not have a no-arg constructor, or has primitive public non-static non-final fields).

    • equal

      public static boolean equal(Entry e1, Entry e2)
      Test that two entries are the same type, with the same public fields. Attribute equality is defined in terms of MarshalledObject.equals on field values.
    • equal

      public static boolean equal(Entry[] attrSet1, Entry[] attrSet2)
      Tests that two Entry[] arrays are the same.
    • matches

      public static boolean matches(Entry tmpl, Entry e)
      Test if the parameter tmpl is the same class as, or a superclass of, the parameter e, and that every non-null public field of tmpl is the same as the corresponding field of e. Attribute equality is defined in terms of MarshalledObject.equals on field values.
    • check

      public static void check(Entry[] attrs, boolean nullOK)
      Throws an IllegalArgumentException if any element of the array is not an instance of a valid Entry class (the class is not public, or does not have a no-arg constructor, or has primitive public non-static non-final fields). If nullOK is false, and any element of the array is null, a NullPointerException is thrown.