class InputAssignmentReader {

    public static Optional<InputAssignmentReader> fromAssociation(DataInputAssociation in) {
        List<ItemAwareElement> sourceList = in.getSourceRef();
        List<Assignment> assignmentList = in.getAssignment();
        String targetName = ((DataInput) in.getTargetRef()).getName();
        if (isReservedIdentifier(targetName)) {
            return Optional.empty();
        }

        if (!sourceList.isEmpty()) {
            return Optional.of(new InputAssignmentReader(sourceList.get(0), targetName));
        } else if (!assignmentList.isEmpty()) {
            return Optional.of(new InputAssignmentReader(assignmentList.get(0), targetName));
        } else {
            logger.log(Level.SEVERE, MarshallingMessage.builder().message("Cannot find SourceRef or Assignment for Target ").toString() + targetName);
            return Optional.empty();
        }
    }

      InputAssignmentReader(Assignment assignment, String targetName);
      InputAssignmentReader(ItemAwareElement source, String targetName);

}