/*
 * Copyright (c) 2004-2017, by Alex Leigh.
 * All rights reserved.
 *
 * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE
 * The copyright notice above does not evidence any
 * actual or intended publication of such source code.
 */

package leigh.eo.schema.dao;

import leigh.eo.EO;

/**
 * This is a dynamically generated DAO class for accessing objects within an ESP graph. This class
 * has been generated by <code>DAOGenerator</code> and should not be modified.
 *
 * @author DAOGenerator (synthetically generated class)
 */
public final class TextElementDAO {
    public static final String API_TYPE = "leigh.esp.eo.schema.Text";

    public static EO create() {
        EO eo = new EO(API_TYPE);
        return eo;
    }

    public static boolean assertType(final EO eo) {
        return eo.getApiType().equals(API_TYPE);
    }

    public static final String KEY_LOCALE = "locale";
    public static final String KEY_TEXT = "text";

    public static String apiType(final EO eo) {
        return eo.getApiType();
    }


    /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=locale, label=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.Text', data={text=Locale, locale=en}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@346bd10b]} org.a6v.esp.eo.EOLoop@346bd12a, type=locale}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@7fe4174f */


    public static java.util.Locale getLocale(EO eo) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        return eo.getValueLocale(KEY_LOCALE);

    }

    public static void setLocale(final EO eo, java.util.Locale value) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        eo.setValue(KEY_LOCALE, value);
    }


    /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=text, label=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.Text', data={text=Text, locale=en}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@acb10e14]} org.a6v.esp.eo.EOLoop@acb10e33, type=string}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@66010f4c */


    public static java.lang.String getText(EO eo) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        return eo.getValueString(KEY_TEXT);

    }

    public static void setText(final EO eo, java.lang.String value) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        eo.setValue(KEY_TEXT, value);
    }


}