class DefaultX9RecordFactoryStrategy implements X9RecordFactoryStrategy {

    public X9RecordFactory factory(X937FileHeaderRecord fileHeaderRecord) {
        String standardIdentifier = null;
        int standardLevel = 0;
        try {
            standardLevel = fileHeaderRecord.standardLevelAsInt();
        } catch (InvalidDataException e) {
            throw new InvalidStandardLevelException();
        }
        String encoding = fileHeaderRecord.record().getEncoding();
        if (standardLevel == X9Record.STANDARD_LEVEL_DSTU) {
            standardIdentifier = X937_STANDARD_DSTU;
        } else if (standardLevel == X9Record.STANDARD_LEVEL_SVPCO) {
            standardIdentifier = X937_STANDARD_SVPCO;
        } else if (standardLevel == X9Record.STANDARD_LEVEL_2001) {
            standardIdentifier = X937_STANDARD_2001;
        } else if (standardLevel == X9Record.STANDARD_LEVEL_1994) {
            standardIdentifier = X937_STANDARD_1994;
        } else {
            throw new InvalidStandardLevelException();
        }
        X9RecordFactory factory = factory(standardIdentifier, encoding);
        return factory;
    }

}