1 package org.simantics.databoard.annotations;
3 import java.lang.annotation.Annotation;
4 import java.lang.reflect.Array;
5 import java.util.Arrays;
7 public class ArgumentImpl implements Arguments {
12 public ArgumentImpl(Class<?>...args) {
13 hash = Arrays.hashCode(args);
19 * Drop first arguments from an argument list.
20 * If all were dropped, null is returned.
22 * @param src source argument or null
23 * @param count argument count
24 * @return Argument or null.
26 public static Arguments dropArguments(Arguments src, int count) {
27 if (src==null) return null;
28 int newLen = src.value().length - count;
29 if (newLen<=0) return null;
30 Class<?>[] newList = (Class<?>[]) Array.newInstance(Class.class, newLen);
31 System.arraycopy(src.value(), count, newList, 0, newLen);
32 return new ArgumentImpl(newList);
36 public Class<? extends Annotation> annotationType() {
37 return Arguments.class;
41 public Class<?>[] value() {
46 public int hashCode() {
51 public boolean equals(Object obj) {
52 if ( obj instanceof Arguments == false ) return false;
53 Arguments other = (Arguments) obj;
54 Class<?>[] classArray1 = args;
55 Class<?>[] classArray2 = other.value();
57 return Arrays.deepEquals(classArray1, classArray2);