/** * Create a MetaInformation with homogeneous arguments (e.g. 1 argument or an argument array). In * this case we assume arguments do not need names (there is only one argument or one array of * arguments with the same type). * * @param annotationClass * @param argsInArray * @param args */ public MetaInformation( Class<? extends Annotation> annotationClass, boolean argsInArray, Object... args) { this(annotationClass); this.argsInArray = argsInArray; this.args = new ArrayList<Argument>(args.length); for (Object arg : args) { Argument a = new Argument(); a.value = arg; a.typeName = arg.getClass().getName(); a.simpleTypeName = arg.getClass().getSimpleName(); this.args.add(a); } }
/** * Create a MetaInformation with named heterogeneous arguments. * * @param annotationClass * @param argNames * @param argValues */ public MetaInformation( Class<? extends Annotation> annotationClass, String[] argNames, Object[] argValues) { this(annotationClass); assert argNames.length == argValues.length : "Different number of argument names and values!"; this.argsNamed = true; this.args = new ArrayList<Argument>(argNames.length); for (int i = 0; i < argNames.length; ++i) { Argument a = new Argument(); a.name = argNames[i]; a.value = argValues[i]; a.typeName = a.value.getClass().getName(); a.simpleTypeName = a.value.getClass().getSimpleName(); this.args.add(a); } }