public boolean isEnumField(Field field) {
        if (!(field instanceof TypedField)) {
            return false;
        }
        TypedField typedField = (TypedField) field;
        TypeReference typeReference = typedField.getType();
        if (!typeReference.isNonSimpleTypeReference()) {
            return false;
        }
        TypeDefinition typeDefinition = typeReference.asNonSimpleTypeReference().orElseThrow()
            .getTypeDefinition();
        return typeDefinition instanceof EnumTypeDefinition;
    }
Enums are always based on a main type. This helper accesses this information in a safe manner.

@param typeReference type reference
@return simple type reference for the enum type referenced by the given type reference
code-generation/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/BaseFreemarkerLanguageTemplateHelper.java