@Test public void noTargetField() { final Record record = newRecord(A_VARIABLE_FIELD_NAME, '#', '#', 'a'); final VariableFieldExpression expression = new VariableFieldExpression(A_VARIABLE_FIELD_NAME + "a"); assertNull(expression.evaluate(record)); }
@Override public String evaluate(final Record target) { final List<VariableField> fields = target.getVariableFields(fieldNumber); if (fields == null || fields.isEmpty()) { return null; } for (final VariableField field : fields) { final DataField dataField = (DataField) field; if (hasIndicatorPattern) { if (!(matches(firstIndicatorPattern, dataField.getIndicator1()) && matches(secondIndicatorPattern, dataField.getIndicator2()))) { continue; } } final List<Subfield> subfields = dataField.getSubfields(subfieldCode); if (subfields == null || subfields.isEmpty()) { continue; } for (final Subfield subfield : subfields) { final String data = subfield.getData(); if (data != null) { return data; } } } return null; }
VariableFieldExpression implements Expression<String, Record> { @Override public String evaluate(final Record target) { final List<VariableField> fields = target.getVariableFields(fieldNumber); if (fields == null || fields.isEmpty()) { return null; } for (final VariableField field : fields) { final DataField dataField = (DataField) field; if (hasIndicatorPattern) { if (!(matches(firstIndicatorPattern, dataField.getIndicator1()) && matches(secondIndicatorPattern, dataField.getIndicator2()))) { continue; } } final List<Subfield> subfields = dataField.getSubfields(subfieldCode); if (subfields == null || subfields.isEmpty()) { continue; } for (final Subfield subfield : subfields) { final String data = subfield.getData(); if (data != null) { return data; } } } return null; } }
VariableFieldExpression implements Expression<String, Record> { @Override public String evaluate(final Record target) { final List<VariableField> fields = target.getVariableFields(fieldNumber); if (fields == null || fields.isEmpty()) { return null; } for (final VariableField field : fields) { final DataField dataField = (DataField) field; if (hasIndicatorPattern) { if (!(matches(firstIndicatorPattern, dataField.getIndicator1()) && matches(secondIndicatorPattern, dataField.getIndicator2()))) { continue; } } final List<Subfield> subfields = dataField.getSubfields(subfieldCode); if (subfields == null || subfields.isEmpty()) { continue; } for (final Subfield subfield : subfields) { final String data = subfield.getData(); if (data != null) { return data; } } } return null; } VariableFieldExpression(final String specs); }
VariableFieldExpression implements Expression<String, Record> { @Override public String evaluate(final Record target) { final List<VariableField> fields = target.getVariableFields(fieldNumber); if (fields == null || fields.isEmpty()) { return null; } for (final VariableField field : fields) { final DataField dataField = (DataField) field; if (hasIndicatorPattern) { if (!(matches(firstIndicatorPattern, dataField.getIndicator1()) && matches(secondIndicatorPattern, dataField.getIndicator2()))) { continue; } } final List<Subfield> subfields = dataField.getSubfields(subfieldCode); if (subfields == null || subfields.isEmpty()) { continue; } for (final Subfield subfield : subfields) { final String data = subfield.getData(); if (data != null) { return data; } } } return null; } VariableFieldExpression(final String specs); @Override String evaluate(final Record target); @Override String specs(); }
VariableFieldExpression implements Expression<String, Record> { @Override public String evaluate(final Record target) { final List<VariableField> fields = target.getVariableFields(fieldNumber); if (fields == null || fields.isEmpty()) { return null; } for (final VariableField field : fields) { final DataField dataField = (DataField) field; if (hasIndicatorPattern) { if (!(matches(firstIndicatorPattern, dataField.getIndicator1()) && matches(secondIndicatorPattern, dataField.getIndicator2()))) { continue; } } final List<Subfield> subfields = dataField.getSubfields(subfieldCode); if (subfields == null || subfields.isEmpty()) { continue; } for (final Subfield subfield : subfields) { final String data = subfield.getData(); if (data != null) { return data; } } } return null; } VariableFieldExpression(final String specs); @Override String evaluate(final Record target); @Override String specs();  }