OpenSplice Java 5 DCPS  v6.x
OpenSplice Java 5 OpenSplice Data Distribution Service Data-Centric Publish-Subscribe API
GroupDataImpl.java
Go to the documentation of this file.
1 /*
2  * Vortex OpenSplice
3  *
4  * This software and documentation are Copyright 2006 to 2024 ADLINK
5  * Technology Limited, its affiliated companies and licensors. All rights
6  * reserved.
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 package org.opensplice.dds.core.policy;
22 
23 import java.util.Arrays;
24 
28 
29 public class GroupDataImpl extends QosPolicyImpl implements GroupData {
30  private static final long serialVersionUID = -5108639314694283781L;
31  private final byte[] value;
32 
34  super(environment);
35  this.value = new byte[0];
36  }
37 
39  super(environment);
40 
41  if(value != null){
42  this.value = value.clone();
43  } else {
44  this.value = new byte[0];
45  }
46  }
47 
48  @Override
49  public byte[] getValue() {
50  if (this.value == null) {
51  return null;
52  }
53  return this.value.clone();
54  }
55 
56  @Override
57  public GroupData withValue(byte[] value, int offset, int length) {
58  return new GroupDataImpl(this.environment, value);
59  }
60 
61  @Override
62  public Class<? extends QosPolicy> getPolicyClass() {
63  return GroupData.class;
64  }
65 
66  @Override
67  public boolean equals(Object other) {
68  if (!(other instanceof GroupDataImpl)) {
69  return false;
70  }
71  return Arrays.equals(this.value, ((GroupDataImpl) other).value);
72  }
73 
74  @Override
75  public int hashCode(){
76  final int prime = 31;
77  int result = 17;
78 
79  for (byte b : this.value) {
80  result = prime * result + b;
81  }
82  return result;
83  }
84 }
byte [] getValue()
Get a copy of the data.
GroupData withValue(byte[] value, int offset, int length)
GroupDataImpl(OsplServiceEnvironment environment, byte[] value)
User data not known by the middleware, but distributed by means of built-in topics.
Definition: GroupData.java:44
This class is the abstract root for all the QoS policies.
Definition: QosPolicy.java:118
Class<? extends QosPolicy > getPolicyClass()
GroupDataImpl(OsplServiceEnvironment environment)