Return an ImmutableDescriptor
whose contents are the union of
the given descriptors. Every field name that appears in any of
the descriptors will appear in the result with the
value that it has when the method is called. Subsequent changes
to any of the descriptors do not affect the ImmutableDescriptor
returned here.
In the simplest case, there is only one descriptor and the
returned ImmutableDescriptor
is a copy of its fields at the
time this method is called:
Descriptor d = something();
ImmutableDescriptor copy = ImmutableDescriptor.union(d);
Returns:
an {@code ImmutableDescriptor} that is the union of the given
descriptors. The returned object may be identical to one of the
input descriptors if it is an ImmutableDescriptor that contains all of
the required fields.
Parameters:
-
descriptors - the descriptors to be combined. Any of the
descriptors can be null, in which case it is skipped.
Throws:
-
IllegalArgumentException - if two Descriptors contain the
same field name with different associated values. Primitive array
values are considered the same if they are of the same type with
the same elements. Object array values are considered the same if
{@link Arrays#deepEquals(Object[],Object[])} returns true.