// Path: core/src/main/java/fixio/fixprotocol/DataType.java
// public enum DataType {
//     INT,
//     CHAR,
//     MULTIPLECHARVALUE,
//     STRING,
//     FLOAT,
//     BOOLEAN,
//     AMT,
//     QTY,
//     PRICE,
//     PRICEOFFSET,
//     SEQNUM,
//     LENGTH,
//     NUMINGROUP,
//     MONTHYEAR,
//     UTCTIMESTAMP,
//     UTCDATEONLY,
//     UTCTIMEONLY,
//     PERCENTAGE,
//     CURRENCY,
//     COUNTRY,
//     LANGUAGE,
//     EXCHANGE,
//     LOCALMKTDATE,
//     MULTIPLESTRINGVALUE,
//     TZTIMEONLY,
//     TZTIMESTAMP,
//     XMLDATA,
//     DATA
// }


import fixio.fixprotocol.DataType;
import fixio.fixprotocol.FieldType;
import java.text.ParseException;
import java.time.Instant;
import java.time.ZoneOffset;
/*
 * Copyright 2014 The FIX.io Project
 *
 * The FIX.io Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package fixio.fixprotocol.fields;



public class FieldFactory {

    public static <F extends AbstractField> F valueOf(int tagNum, byte[] value) {
        return valueOf(tagNum, value, 0, value.length);
    }

    @SuppressWarnings("unchecked")
    public static <F extends AbstractField> F valueOf(int tagNum, byte[] value, int offset, int length) {
        if (tagNum <= 0) {
            throw new IllegalArgumentException("Invalid tagNum=" + tagNum);
        }
        if (length <= 0) {
            throw new IllegalArgumentException("Value length must be positive but was " + length);
        }
        FieldType fieldType = FieldType.forTag(tagNum);
        try {
// Path: core/src/main/java/fixio/fixprotocol/DataType.java
// public enum DataType {
//     INT,
//     CHAR,
//     MULTIPLECHARVALUE,
//     STRING,
//     FLOAT,
//     BOOLEAN,
//     AMT,
//     QTY,
//     PRICE,
//     PRICEOFFSET,
//     SEQNUM,
//     LENGTH,
//     NUMINGROUP,
//     MONTHYEAR,
//     UTCTIMESTAMP,
//     UTCDATEONLY,
//     UTCTIMEONLY,
//     PERCENTAGE,
//     CURRENCY,
//     COUNTRY,
//     LANGUAGE,
//     EXCHANGE,
//     LOCALMKTDATE,
//     MULTIPLESTRINGVALUE,
//     TZTIMEONLY,
//     TZTIMESTAMP,
//     XMLDATA,
//     DATA
// }


// Path: core/src/main/java/fixio/fixprotocol/fields/FieldFactory.java
import fixio.fixprotocol.DataType;
import fixio.fixprotocol.FieldType;
import java.text.ParseException;
import java.time.Instant;
import java.time.ZoneOffset;

/*
 * Copyright 2014 The FIX.io Project
 *
 * The FIX.io Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package fixio.fixprotocol.fields;



public class FieldFactory {

    public static <F extends AbstractField> F valueOf(int tagNum, byte[] value) {
        return valueOf(tagNum, value, 0, value.length);
    }

    @SuppressWarnings("unchecked")
    public static <F extends AbstractField> F valueOf(int tagNum, byte[] value, int offset, int length) {
        if (tagNum <= 0) {
            throw new IllegalArgumentException("Invalid tagNum=" + tagNum);
        }
        if (length <= 0) {
            throw new IllegalArgumentException("Value length must be positive but was " + length);
        }
        FieldType fieldType = FieldType.forTag(tagNum);
        try {
            final DataType dataType = fieldType.type();