List<Future<Boolean>> tasks = new ArrayList<>(); for (Record record: file.getRecords()) { Executor executorForRecord = executors.get(record.getRecordType()); tasks.add(executor.submit(new RecordProcessor(record))); }
/** * Return the value type for reporting a data quality result. * * <div class="section">Default value</div> * If no type has been set but all {@linkplain #getValues() values} are of the same type, * then this method defaults to that type. Otherwise this method returns {@code null}. * * @return value type for reporting a data quality result, or {@code null}. */ @Override @XmlElement(name = "valueRecordType") public RecordType getValueType() { RecordType type = valueType; if (type == null && values != null) { for (final Record value : values) { if (value != null) { final RecordType t = value.getRecordType(); if (t == null) { return null; } else if (type == null) { type = t; } else if (type != t) { return null; } } } } return type; }
/** * Return the value type for reporting a data quality result. * * <div class="section">Default value</div> * If no type has been set but all {@linkplain #getValues() values} are of the same type, * then this method defaults to that type. Otherwise this method returns {@code null}. * * @return value type for reporting a data quality result, or {@code null}. */ @Override @XmlElement(name = "valueType") public RecordType getValueType() { RecordType type = valueType; if (type == null && values != null) { for (final Record value : values) { if (value != null) { final RecordType t = value.getRecordType(); if (t == null) { return null; } else if (type == null) { type = t; } else if (type != t) { return null; } } } } return type; }
/** * Creates a new record initialized to a shallow copy of the given record. * The members contained in the given record are <strong>not</strong> recursively copied. * * @param record the record to copy (can not be null). * * @since 0.8 */ @SuppressWarnings("SuspiciousSystemArraycopy") public DefaultRecord(final Record record) { this(record.getRecordType()); if (record instanceof DefaultRecord) { final Object source = ((DefaultRecord) record).values; System.arraycopy(source, 0, values, 0, Array.getLength(source)); } else { for (final Map.Entry<MemberName,Integer> entry : definition.memberIndices().entrySet()) { final MemberName name = entry.getKey(); final Object value = record.locate(name); if (value != null) { final int index = entry.getValue(); final Class<?> valueClass = definition.getValueClass(index); if (valueClass != null && !valueClass.isInstance(value)) { throw new ClassCastException(Errors.format(Errors.Keys.IllegalPropertyValueClass_3, name, valueClass, value.getClass())); } Array.set(values, index, value); } } } }
for (Record record : slide.getSlideRecord().getChildRecords()) { if (record instanceof UnknownRecordPlaceholder && record.getRecordType() == RecordTypes.SSSlideInfoAtom.typeID) { UnknownRecordPlaceholder urp = (UnknownRecordPlaceholder)record;
/** * Creates a new record initialized to a shallow copy of the given record. * The members contained in the given record are <strong>not</strong> recursively copied. * * @param record the record to copy (can not be null). * * @since 0.8 */ @SuppressWarnings("SuspiciousSystemArraycopy") public DefaultRecord(final Record record) { this(record.getRecordType()); if (record instanceof DefaultRecord) { final Object source = ((DefaultRecord) record).values; System.arraycopy(source, 0, values, 0, Array.getLength(source)); } else { for (final Map.Entry<MemberName,Integer> entry : definition.memberIndices().entrySet()) { final MemberName name = entry.getKey(); final Object value = record.locate(name); if (value != null) { final int index = entry.getValue(); final Class<?> valueClass = definition.getValueClass(index); if (valueClass != null && !valueClass.isInstance(value)) { throw new ClassCastException(Errors.format(Errors.Keys.IllegalPropertyValueClass_3, name, valueClass, value.getClass())); } Array.set(values, index, value); } } } }