A text value in a specific language.

@see {@link https://github.com/FamilySearch/gedcomx/blob/master/specifications/json-format-specification.md#text-value|GEDCOM X JSON Spec}

@class
@extends Base
@apram {Object} [json]
481113
function(json){
  
  // Protect against forgetting the new keyword when calling the constructor
  if(!(this instanceof TextValue)){
    return new TextValue(json);
  }
  
  // If the given object is already an instance then just return it. DON'T copy it.
  if(TextValue.isInstance(json)){
    return json;
  }
  
  this.init(json);
}
1237038
@Override
    public String getValue() {
        String value = attrMixin.getAttribute(VALUE);
        return value.isEmpty() ? getText() : value;
    }
468038
public MonolingualTextValue copy(MonolingualTextValue object) {
		return dataObjectFactory.getMonolingualTextValue(object.getText(), object.getLanguageCode());
	}
1200872
private static String getJsonValueAsString(JsonValue value) {
        return (value != null && value.getValueType() == ValueType.STRING) ? ((JsonString) value).getString() : null;
    }
362450
public JSONStringer value(boolean value) throws JSONException {
		if (this.stack.isEmpty()) {
			throw new JSONException("Nesting problem");
		}
		beforeValue();
		this.out.append(value);
		return this;
	}
1020049
public PactDslJsonArray stringValue(String value) {
      if (value == null) {
        body.put(JSONObject.NULL);
      } else {
        body.put(value);
      }
      return this;
    }
1254716
function (value) {
    var parsedValue;
    if (typeof value !== 'string') { return value; }
    if (this.isSingleProperty) {
      parsedValue = this.schema.parse(value);
      /**
       * To avoid bogus double parsings. Cached values will be parsed when building
       * component data. For instance when parsing a src id to its url, we want to cache
       * original string and not the parsed one (#monster -> models/monster.dae)
       * so when building data we parse the expected value.
       */
      if (typeof parsedValue === 'string') { parsedValue = value; }
    } else {
      // Parse using the style parser to avoid double parsing of individual properties.
      utils.objectPool.clearObject(this.parsingAttrValue);
      parsedValue = styleParser.parse(value, this.parsingAttrValue);
    }
    return parsedValue;
  }
1170050
function(value) {

			var container = this.get('element'),
				text = Lang.substitute(this.get(ARIA_TEXT_TEMPLATE),{
					value:value,
					minValue:this.get(MIN_VALUE),
					maxValue:this.get(MAX_VALUE)
				});
			container.setAttribute('aria-valuenow',value);
			container.setAttribute('aria-valuetext',text);
		}
705899
function doParse(value) {
    try {
      return JSON.parse(value);
    }
    catch(ex) {
      verbose.writeln('The value was not parsed properly. Returning it as text, ' + ex.message + ', ' + value);
      return value;
    }
  }
242577
public JsonWriter value(Object value) throws IOException {
      Preconditions.checkArgument(inArray() || writeStack.peek() == JsonTokenType.NAME,
                                  "Expecting an array or a name, but found " + writeStack.peek());
      writeObject(value);
      popIf(JsonTokenType.NAME);
      return this;
   }
707263
public Object nextValue() throws JSONException {
		int c = nextCleanInternal();
		switch (c) {
		case -1:
			throw syntaxError("End of input");

		case '{':
			return readObject();

		case '[':
			return readArray();

		case '\'':
		case '"':
			return nextString((char) c);

		default:
			this.pos--;
			return readLiteral();
		}
	}
1114856
public Object nextValue( JsonConfig jsonConfig ) {
      char c = nextClean();
      String s;

      switch( c ){
         case '"':
         case '\'':
            return nextString( c );
         case '{':
            back();
            return JSONObject.fromObject( this, jsonConfig );
         case '[':
            back();
            return JSONArray.fromObject( this, jsonConfig );
         default:
            // empty
      }

      /*
       * Handle unquoted text. This could be the values true, false, or null, or
       * it can be a number. An implementation (such as this one) is allowed to
       * also accept non-standard forms. Accumulate characters until we reach
       * the end of the text or a formatting character.
       */

      StringBuffer sb = new StringBuffer();
      char b = c;
      while( c >= ' ' && ",:]}/\\\"[{;=#".indexOf( c ) < 0 ){
         sb.append( c );
         c = next();
      }
      back();

      /*
       * If it is true, false, or null, return the proper value.
       */

      s = sb.toString()
            .trim();
      if( s.equals( "" ) ){
         throw syntaxError( "Missing value." );
      }
      if( s.equalsIgnoreCase( "true" ) ){
         return Boolean.TRUE;
      }
      if( s.equalsIgnoreCase( "false" ) ){
         return Boolean.FALSE;
      }
      if( s.equals( "null" ) || 
          (jsonConfig.isJavascriptCompliant() && s.equals("undefined"))){
         return JSONNull.getInstance();
      }

      /*
       * If it might be a number, try converting it. We support the 0- and 0x-
       * conventions. If a number cannot be produced, then the value will just
       * be a string. Note that the 0-, 0x-, plus, and implied string
       * conventions are non-standard. A JSON parser is free to accept non-JSON
       * forms as long as it accepts all correct JSON forms.
       */

      if( (b >= '0' && b <= '9') || b == '.' || b == '-' || b == '+' ){
         if( b == '0' ){
            if( s.length() > 2 && (s.charAt( 1 ) == 'x' || s.charAt( 1 ) == 'X') ){
               try{
                  return new Integer( Integer.parseInt( s.substring( 2 ), 16 ) );
               }catch( Exception e ){
                  /* Ignore the error */
               }
            }else{
               try{
                  return new Integer( Integer.parseInt( s, 8 ) );
               }catch( Exception e ){
                  /* Ignore the error */
               }
            }
         }

         try{
            return NumberUtils.createNumber(s);
         }catch( Exception e ){
            return s;
         }
      }

      if( JSONUtils.isFunctionHeader( s ) || JSONUtils.isFunction( s ) ){
         return s;
      }
      switch( peek() ){
         case ',':
         case '}':
         case '{':
         case '[':
         case ']':
            throw new JSONException( "Unquotted string '" + s + "'" );
      }

      return s;
   }
1187378
private void setValueForOtherLocales(CmsObject cms, I_CmsXmlContentValue value, String requiredParent) {

        if (!value.isSimpleType()) {
            throw new IllegalArgumentException();
        }
        for (Locale locale : getLocales()) {
            if (locale.equals(value.getLocale())) {
                continue;
            }
            String valuePath = value.getPath();
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(requiredParent) || hasValue(requiredParent, locale)) {
                ensureParentValues(cms, valuePath, locale);
                if (hasValue(valuePath, locale)) {
                    I_CmsXmlContentValue localeValue = getValue(valuePath, locale);
                    localeValue.setStringValue(cms, value.getStringValue(cms));
                } else {
                    int index = CmsXmlUtils.getXpathIndexInt(valuePath) - 1;
                    I_CmsXmlContentValue localeValue = addValue(cms, valuePath, locale, index);
                    localeValue.setStringValue(cms, value.getStringValue(cms));
                }
            }
        }
    }
653056
function localizeStrict( i18nValue, optionalFallbackValue, languageTag = tags[ locale ] ) {
         if( !i18nValue || primitives[ typeof i18nValue ] ) {
            // value is not internationalized
            return i18nValue;
         }
         if( !languageTag ) {
            return optionalFallbackValue;
         }

         // Try one direct lookup before scanning the input keys,
         // assuming that language-tags are written in consistent style.
         const value = i18nValue[ languageTag ];
         if( value !== undefined ) {
            return value;
         }

         const lookupKey = normalize( languageTag );
         const availableTags = Object.keys( i18nValue );
         const n = availableTags.length;
         for( let i = 0; i < n; ++i ) {
            const t = availableTags[ i ];
            if( normalize( t ) === lookupKey ) {
               return i18nValue[ t ];
            }
         }

         return optionalFallbackValue;
      }
1201053
def textfield(value)
      if value.is_a? Numeric
        index = value
        raise "#{index} is not a valid index. Must be >= 1" if index <= 0

        index -= 1 # eles_by_json and _textfields_with_predicate is 0 indexed.
        result = eles_by_json(_textfield_visible)[index]
        raise _no_such_element if result.nil?

        return result
      end

      ele_by_json _textfield_contains_string value
    end
999103
private static Object setTextValue(Object entity, Field member, Object retVal)
    {
        if (member != null && member.getType().isEnum())
        {
            EnumAccessor accessor = new EnumAccessor();
            if (member != null)
            {
                retVal = accessor.fromString(member.getType(), (String) retVal);
            }
        }
        else if (member != null
                && (member.getType().isAssignableFrom(char.class) || member.getType().isAssignableFrom(Character.class)))
        {
            retVal = new CharAccessor().fromString(member.getType(), (String) retVal);
        }
        return retVal;
    }
948253
private void ensureTextSet() {
        if (_text.limit() == 0) {
            checkState(_map != null, "Neither JSON text nor map has been set");
            _text.clear();
            // First try reading the JSON directly into be buffer.
            try {
                JsonHelper.writeJson(new ByteBufferOutputStream(_text), _map);
                // Set the limit and move the position back to zero.
                _text.flip();
            } catch (Exception e) {
                if (Iterables.tryFind(Throwables.getCausalChain(e), Predicates.instanceOf(BufferOverflowException.class)).isPresent()) {
                    // Buffer was insufficient.  Allocate a new array and read the bytes into it.
                    byte[] utf8 = JsonHelper.asUtf8Bytes(_map);
                    _text = ByteBuffer.wrap(utf8);
                } else {
                    throw Throwables.propagate(e);
                }
            }
        }
    }