|
|||||||||||||||||||
This license of Clover is provided to support the development of JBind only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover. | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
Binary.java | 0% | 28,6% | 50% | 30,8% |
|
1 |
/* |
|
2 |
* JBind |
|
3 |
* |
|
4 |
* Copyright (c) by Stefan Wachter. All rights reserved. |
|
5 |
* |
|
6 |
* Usage, modification, and redistribution is subject to license terms that are |
|
7 |
* available at 'http://www.jbind.org'. The JBind license is like the |
|
8 |
* 'Apache Software License V 1.1'. |
|
9 |
*/ |
|
10 |
package org.jbind.xml.instance.data; |
|
11 |
|
|
12 |
import java.util.Arrays; |
|
13 |
|
|
14 |
import org.jbind.xml.core.data.IBinary; |
|
15 |
|
|
16 |
public abstract class Binary implements IBinary { |
|
17 |
|
|
18 |
protected byte[] myValue = null; |
|
19 |
|
|
20 | 2 |
public Binary(byte[] aBytes) { |
21 | 2 |
myValue = aBytes; |
22 |
} |
|
23 |
|
|
24 | 23 |
public byte[] getBytes() { |
25 | 23 |
return myValue; |
26 |
} |
|
27 |
|
|
28 | 0 |
public boolean equals(Object anObject) { |
29 | 0 |
boolean res = (null != anObject) && (anObject.getClass() == getClass()); |
30 | 0 |
if (res) { |
31 | 0 |
res = Arrays.equals(myValue, ((IBinary)anObject).getBytes()); |
32 |
} |
|
33 | 0 |
return res; |
34 |
} |
|
35 |
|
|
36 | 0 |
public int hashCode() { |
37 | 0 |
return myValue.length; |
38 |
} |
|
39 |
} |
|
40 |
|
|