public MetaData getMetaData(int index) { if (indexMap == null || indexMap.length < index + 1) { int startFrom = 0; int lastIndex = index; if (indexMap != null) { startFrom = indexMap.length; indexMap = Arrays.copyOf(indexMap, index + 1); } else { String[] headers = context.headers(); if (headers != null && lastIndex < headers.length) { lastIndex = headers.length; } int[] indexes = context.extractedFieldIndexes(); if (indexes != null) { for (int i = 0; i < indexes.length; i++) { if (lastIndex < indexes[i]) { lastIndex = indexes[i]; } } } indexMap = new MetaData[lastIndex + 1]; } for (int i = startFrom; i < lastIndex + 1; i++) { indexMap[i] = new MetaData(i); } } return indexMap[index]; }
private MetaData getMetaData(String name) { int index = context.indexOf(name); if (index == -1) { getValidatedHeaders(); throw new IllegalArgumentException( "Header name '" + name + "' not found. Available columns are: " + Arrays.asList(headers())); } return getMetaData(index); }
<T> Annotation buildAnnotation(Class<T> type, final String args1, final String... args2) { Integer hash = (type.hashCode() * 31) + String.valueOf(args1).hashCode() + (31 * Arrays.toString(args2).hashCode()); Annotation out = annotationHashes.get(hash); if (out == null) { if (type == Boolean.class || type == boolean.class) { out = buildBooleanStringAnnotation(args1 == null ? null : new String[] {args1}, args2); } else { out = newFormatAnnotation(args1, args2); } annotationHashes.put(hash, out); } return out; }