public class LookupAttributes extends Object
| Modifier and Type | Class and Description |
|---|---|
private static class |
LookupAttributes.FieldComparator
Comparator for sorting fields.
|
| Modifier and Type | Field and Description |
|---|---|
private static LookupAttributes.FieldComparator |
comparator
Comparator for sorting fields
|
private static Class[] |
noArg |
| Modifier | Constructor and Description |
|---|---|
private |
LookupAttributes() |
| Modifier and Type | Method and 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. |
private static void |
check(Entry e)
Throws a
SecurityException if parameter e
is instanceof ServiceControlled. |
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). |
private static Entry[] |
concat(Entry[] attrs1,
Entry[] attrs2)
Return a concatenation of the two arrays.
|
private static boolean |
contains(Entry[] eSet,
Entry e)
Returns
true if the Entry parameter
e is an element of the Entry[] array
parameter eSet; returns false otherwise. |
private static boolean |
contains(Entry[] eSet1,
Entry[] eSet2)
Returns
true if the Entry[] array parameter
eSet1 contains the Entry[] array parameter
eSet2; returns false otherwise. |
private static Entry[] |
delete(Entry[] attrs,
int i)
Return a new array containing all but the given element.
|
private static boolean |
equal(Class c1,
Class c2)
Tests if two classes are equal, using the class equivalence
semantics of the lookup service: same name.
|
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.
|
private static boolean |
equal(Object o1,
Object o2)
Returns
true if the two input objects are the same in
MarshalledInstance form, false otherwise. |
private static Field[] |
getFields(Entry e)
Returns public fields, in super to subclass order, sorted
alphabetically within a given class.
|
private static Field[] |
getFields(Entry e,
Entry oe,
Field[] ofields)
Returns the public fields of the parameter
e. |
private static boolean |
isAssignableFrom(Class c1,
Class c2)
Tests if class
c1 is equal to, or a superclass of,
class c2, using the class equivalence semantics of
the lookup service: same name. |
private static boolean |
isDup(Entry[] attrs,
int index)
Test if the set at the given
index is equal to any
other set earlier in the Entry[] array parameter. |
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. |
private static Entry |
update(Entry e,
Entry mods)
Return a new entry that, for each non-
null field of
the parameter mods, has the same field value as
mods, else the same field value as the parameter
e. |
private static final LookupAttributes.FieldComparator comparator
private static final Class[] noArg
public static Entry[] add(Entry[] attrSets, Entry[] addAttrSets)
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).
public static Entry[] add(Entry[] attrSets, Entry[] addAttrSets, boolean checkSC)
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
MarshalledInstance.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).
public static Entry[] modify(Entry[] attrSets, Entry[] attrSetTmpls, Entry[] modAttrSets)
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).
public static Entry[] modify(Entry[] attrSets, Entry[] attrSetTmpls, Entry[] modAttrSets, boolean checkSC)
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).
public static boolean equal(Entry e1, Entry e2)
MarshalledObject.equals on field values.public static boolean equal(Entry[] attrSet1, Entry[] attrSet2)
Entry[] arrays are the same.public static boolean matches(Entry tmpl, Entry e)
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.public static void check(Entry[] attrs, boolean nullOK)
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.private static void check(Entry e)
SecurityException if parameter e
is instanceof ServiceControlled.private static boolean isDup(Entry[] attrs, int index)
index is equal to any
other set earlier in the Entry[] array parameter.private static Entry update(Entry e, Entry mods)
null field of
the parameter mods, has the same field value as
mods, else the same field value as the parameter
e.private static boolean equal(Object o1, Object o2)
true if the two input objects are the same in
MarshalledInstance form, false otherwise.private static boolean equal(Class c1, Class c2)
private static boolean isAssignableFrom(Class c1, Class c2)
c1 is equal to, or a superclass of,
class c2, using the class equivalence semantics of
the lookup service: same name.private static Field[] getFields(Entry e)
private static Field[] getFields(Entry e, Entry oe, Field[] ofields)
e. If
e and parameter oe have the same class,
then returns parameter ofields, otherwise ensures that
e has at least as many fields as does parameter
ofields.private static Entry[] concat(Entry[] attrs1, Entry[] attrs2)
private static Entry[] delete(Entry[] attrs, int i)
private static boolean contains(Entry[] eSet, Entry e)
true if the Entry parameter
e is an element of the Entry[] array
parameter eSet; returns false otherwise.Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.