public static void ensureIsAllowableType(DataType dt, AllowedDataTypes allowedTypes)
			throws InvalidDataTypeException {
		if (dt instanceof BitFieldDataType) {
			if (allowedTypes != AllowedDataTypes.SIZABLE_DYNAMIC_AND_BITFIELD) {
				throw new InvalidDataTypeException("Bitfield data-type not allowed");
			}
			return;
		}
		switch (allowedTypes) {
			case DYNAMIC:
				if (dt instanceof FactoryDataType) {
					throw new InvalidDataTypeException("Factory data-type not allowed");
				}
				break;
			case SIZABLE_DYNAMIC:
			case SIZABLE_DYNAMIC_AND_BITFIELD:
				if (dt instanceof FactoryDataType) {
					throw new InvalidDataTypeException("Factory data-type not allowed");
				}
				if (dt instanceof Dynamic && !((Dynamic) dt).canSpecifyLength()) {
					throw new InvalidDataTypeException("non-sizable data-type not allowed");
				}
				break;
			case FIXED_LENGTH:
				if (dt.getLength() < 0) {
					throw new InvalidDataTypeException("Fixed-length data-type required");
				}
				break;
			case STRINGS_AND_FIXED_LENGTH:
				if (dt.getLength() < 0 && !(dt instanceof AbstractStringDataType)) {
					throw new InvalidDataTypeException("Fixed-length or string data-type required");
				}
				break;
			case BITFIELD_BASE_TYPE:
				if (!BitFieldDataType.isValidBaseDataType(dt)) {
					throw new InvalidDataTypeException(
						"Enum or integer derived data-type required");
				}
				break;
			case ALL:
				// do nothing
				break;
			default:
				throw new InvalidDataTypeException(
					"Unknown data type allowance specified: " + allowedTypes);
		}
	}
Throws exception if the data type does not match the specified {@link AllowedDataTypes}.

@param dt {@link DataType} to check
@param allowedTypes {@link AllowedDataTypes enum} specifying what category of data types are ok
@throws InvalidDataTypeException if dt violates the specified allowedTypes
Ghidra/Features/Base/src/main/java/ghidra/util/data/DataTypeParser.java