@@ -40,7 +40,7 @@ private EntityUtil() {}
4040 * @param entities The set of entities the resource needs.
4141 * @return A constructed resource.
4242 */
43- public static final Resource createResource (Collection <Entity > entities ) {
43+ public static Resource createResource (Collection <Entity > entities ) {
4444 return createResourceRaw (
4545 Attributes .empty (), EntityUtil .mergeResourceSchemaUrl (entities , null , null ), entities );
4646 }
@@ -53,7 +53,7 @@ public static final Resource createResource(Collection<Entity> entities) {
5353 * @param entities The set of entities the resource needs.
5454 * @return A constructed resource.
5555 */
56- static final Resource createResourceRaw (
56+ static Resource createResourceRaw (
5757 Attributes attributes , @ Nullable String schemaUrl , Collection <Entity > entities ) {
5858 try {
5959 Method method =
@@ -79,7 +79,7 @@ static final Resource createResourceRaw(
7979 }
8080
8181 /** Appends a new entity on to the end of the list of entities. */
82- public static final ResourceBuilder addEntity (ResourceBuilder rb , Entity e ) {
82+ public static ResourceBuilder addEntity (ResourceBuilder rb , Entity e ) {
8383 try {
8484 Method method = ResourceBuilder .class .getDeclaredMethod ("add" , Entity .class );
8585 if (method != null ) {
@@ -97,7 +97,7 @@ public static final ResourceBuilder addEntity(ResourceBuilder rb, Entity e) {
9797 }
9898
9999 /** Appends a new collection of entities on to the end of the list of entities. */
100- public static final ResourceBuilder addAllEntity (ResourceBuilder rb , Collection <Entity > e ) {
100+ public static ResourceBuilder addAllEntity (ResourceBuilder rb , Collection <Entity > e ) {
101101 try {
102102 Method method = ResourceBuilder .class .getDeclaredMethod ("addAll" , Collection .class );
103103 if (method != null ) {
@@ -120,7 +120,7 @@ public static final ResourceBuilder addAllEntity(ResourceBuilder rb, Collection<
120120 * @return a collection of entities.
121121 */
122122 @ SuppressWarnings ("unchecked" )
123- public static final Collection <Entity > getEntities (Resource r ) {
123+ public static Collection <Entity > getEntities (Resource r ) {
124124 try {
125125 Method method = Resource .class .getDeclaredMethod ("getEntities" );
126126 if (method != null ) {
@@ -142,7 +142,7 @@ public static final Collection<Entity> getEntities(Resource r) {
142142 *
143143 * @return a map of attributes.
144144 */
145- public static final Attributes getRawAttributes (Resource r ) {
145+ public static Attributes getRawAttributes (Resource r ) {
146146 try {
147147 Method method = Resource .class .getDeclaredMethod ("getRawAttributes" );
148148 if (method != null ) {
@@ -160,16 +160,15 @@ public static final Attributes getRawAttributes(Resource r) {
160160 }
161161
162162 /** Returns true if any entity in the collection has the attribute key, in id or description. */
163- public static final <T > boolean hasAttributeKey (
164- Collection <Entity > entities , AttributeKey <T > key ) {
163+ public static <T > boolean hasAttributeKey (Collection <Entity > entities , AttributeKey <T > key ) {
165164 return entities .stream ()
166165 .anyMatch (
167166 e -> e .getId ().asMap ().containsKey (key ) || e .getDescription ().asMap ().containsKey (key ));
168167 }
169168
170169 /** Decides on a final SchemaURL for OTLP Resource based on entities chosen. */
171170 @ Nullable
172- static final String mergeResourceSchemaUrl (
171+ static String mergeResourceSchemaUrl (
173172 Collection <Entity > entities , @ Nullable String baseUrl , @ Nullable String nextUrl ) {
174173 // Check if entities all share the same URL.
175174 Set <String > entitySchemas =
@@ -228,8 +227,7 @@ static final RawAttributeMergeResult mergeRawAttributes(
228227 additional .forEach (
229228 (key , value ) -> {
230229 for (Entity e : entities ) {
231- if (e .getId ().asMap ().keySet ().contains (key )
232- || e .getDescription ().asMap ().keySet ().contains (key )) {
230+ if (e .getId ().get (key ) != null || e .getDescription ().get (key ) != null ) {
233231 // Remove the entity and push all attributes as raw,
234232 // we have an override.
235233 conflicts .add (e );
@@ -249,7 +247,7 @@ static final RawAttributeMergeResult mergeRawAttributes(
249247 * @param additional Additional entities to merge with base set.
250248 * @return A new set of entities with no duplicate types.
251249 */
252- public static final Collection <Entity > mergeEntities (
250+ public static Collection <Entity > mergeEntities (
253251 Collection <Entity > base , Collection <Entity > additional ) {
254252 if (base .isEmpty ()) {
255253 return additional ;
0 commit comments