Returns a new {@link DefaultTupleMapper} that accept String as source field value.
962257
public static final DefaultTupleMapper newStringDefaultTupleMapper( ) {
        return new DefaultTupleMapper(new TupleMapper<String>() {
            @Override
            public String map(Tuple input) {
                return input.getStringByField(FIELD_SOURCE);
            }
        });
    }
164861
private String createValueFromMap(Map<String, String> valueMap) {

        if (valueMap == null) {
            return null;
        }
        StringBuffer result = new StringBuffer(valueMap.size() * 32);
        Iterator<Map.Entry<String, String>> i = valueMap.entrySet().iterator();
        while (i.hasNext()) {
            Map.Entry<String, String> entry = i.next();
            String key = entry.getKey();
            String value = entry.getValue();
            key = replaceDelimiter(key, VALUE_LIST_DELIMITER, VALUE_LIST_DELIMITER_REPLACEMENT);
            key = replaceDelimiter(key, VALUE_MAP_DELIMITER, VALUE_MAP_DELIMITER_REPLACEMENT);
            value = replaceDelimiter(value, VALUE_LIST_DELIMITER, VALUE_LIST_DELIMITER_REPLACEMENT);
            value = replaceDelimiter(value, VALUE_MAP_DELIMITER, VALUE_MAP_DELIMITER_REPLACEMENT);
            result.append(key);
            result.append(VALUE_MAP_DELIMITER);
            result.append(value);
            if (i.hasNext()) {
                result.append(VALUE_LIST_DELIMITER);
            }
        }
        return result.toString();
    }
1289289
public static CsvMapper defaultMapper() {
		final CsvMapper mapper = new CsvMapper();
		mapper.enable(CsvParser.Feature.TRIM_SPACES);
		mapper.enable(CsvParser.Feature.WRAP_AS_ARRAY);
		mapper.configure(JsonParser.Feature.ALLOW_YAML_COMMENTS, true);
		return mapper;
	}
824629
@SuppressWarnings("unchecked")
  public <T> T get(String key, Class<T> type, T defaultValue)
  {
    Objects.requireNonNull(key);
    Objects.requireNonNull(type);

    String value = _map.get(key);

    if (value == null) {
      return defaultValue;
    }

    if (type.equals(String.class)) {
      return (T) value;
    }

    T valueType = _converter.convert(type, value);

    if (valueType != null) {
      return valueType;
    }
    else {
      log.warning(L.l("Unexpected type for key={0} type={1} value={2}",
                      key, type, value));
      /*
      throw new ConfigException(L.l("Unexpected type for key={0} type={1} value={2}",
                                    key, type, value));
                                    */
      return defaultValue;
    }
  }
608152
protected GenericDataSourceBase<OUT, ?> translateToDataFlow() {
		String name = this.name != null ? this.name : this.inputFormat.toString();
		if (name.length() > 100) {
			name = name.substring(0, 100);
		}
		
		@SuppressWarnings({ "unchecked", "rawtypes" })
		GenericDataSourceBase<OUT, ?> source = new GenericDataSourceBase(this.inputFormat,
				new OperatorInformation<OUT>(getType()), name);
		source.setDegreeOfParallelism(dop);
		
		return source;
	}
1206133
def to_map_with_default(value, default_value):
        
        result = MapConverter.to_nullable_map(value)
        return result if result != None else default_value
655401
@SuppressWarnings("unchecked")
  public <S, D> TypeMap<S, D> getOrCreate(S source, Class<S> sourceType, Class<D> destinationType,
      String typeMapName, PropertyMap<S, D> propertyMap, Converter<S, D> converter,
      MappingEngineImpl engine) {
    synchronized (lock) {
      TypePair<S, D> typePair = TypePair.of(sourceType, destinationType, typeMapName);
      TypeMapImpl<S, D> typeMap = (TypeMapImpl<S, D>) typeMaps.get(typePair);

      if (typeMap == null) {
        typeMap = new TypeMapImpl<S, D>(sourceType, destinationType, typeMapName, config, engine);
        if (propertyMap != null)
          typeMap.addMappings(propertyMap);
        if (converter == null && config.isImplicitMappingEnabled()
            && Types.mightContainsProperties(typeMap.getSourceType())
            && Types.mightContainsProperties(typeMap.getDestinationType()))
          ImplicitMappingBuilder.build(source, typeMap, config.typeMapStore, config.converterStore);

        if (typeMap.isFullMatching()) {
          typeMaps.put(typePair, typeMap);
        }
      } else if (propertyMap != null) {
        typeMap.addMappings(propertyMap);
      }

      if (converter != null)
        typeMap.setConverter(converter);
      return typeMap;
    }
  }
744270
static String valueAsString(Map<String, Object> map, Key key, String defaultValue) {
        Validate.notNullOrEmpty(key.key, "Key for plugin configuration must be set");
        if (map.containsKey(key.key)) {
            return map.get(key.key).toString().length() == 0 ? defaultValue : map.get(key.key).toString();
        }
        return defaultValue;
    }
603742
public static final DefaultTupleMapper newBinaryDefaultTupleMapper( ) {
        return new DefaultTupleMapper(new TupleMapper<String>() {
            @Override
            public String map(Tuple input) {
                try {
                    return new String(input.getBinaryByField(FIELD_SOURCE), "UTF-8");
                } catch (UnsupportedEncodingException e) {
                    throw new MappingException("Error while processing source as a byte[]", e);
                }
            }
        });
    }
766264
public static String getStringValue(Object newValue, String defaultValue) {
        if (newValue == null)
            return defaultValue;

        return (String) newValue;
    }
214541
static final <T> FieldMap<T> of(Method getter, String defaultName) {
        final Class<T> targetType = (Class<T>)getter.getReturnType();
        final String fieldName = StandardBeanProperties.fieldNameOf(getter);

        Field declaredField = null;
        try {
            declaredField = getter.getDeclaringClass().getDeclaredField(fieldName);
        } catch (final SecurityException e) {
            throw new DynamoDBMappingException("no access to field for " + getter, e);
        } catch (final NoSuchFieldException no) {}

        if (defaultName == null) {
            defaultName = fieldName;
        }

        final FieldMap<T> annotations = new FieldMap<T>(targetType, defaultName);
        annotations.putAll(targetType);
        annotations.putAll(declaredField);
        annotations.putAll(getter);
        return annotations;
    }
188245
public Code toStringWithSourceMap(String file, String sourceRoot) {
        StringBuilder generatedCode = new StringBuilder();
        int[] generatedLine = new int[] { 1 };
        int[] generatedColumn = new int[] { 0 };
        final SourceMapGenerator map = new SourceMapGenerator(file, sourceRoot);
        boolean[] sourceMappingActive = new boolean[] { false };
        String[] lastOriginalSource = new String[1];
        Integer[] lastOriginalLine = new Integer[1];
        Integer[] lastOriginalColumn = new Integer[1];
        String[] lastOriginalName = new String[1];
        this.walk((chunk, original) -> {
            generatedCode.append(chunk);
            if (original.source != null && original.line != null && original.column != null) {
                if (!original.source.equals(lastOriginalSource[0]) || lastOriginalLine[0] != original.line || lastOriginalColumn[0] != original.column
                        || (original.name == null ? lastOriginalName[0] != null : !original.name.equals(lastOriginalName[0]))) {
                    map.addMapping(new Mapping(new Position(generatedLine[0], generatedColumn[0]), new Position(original.line, original.column),
                            original.source, original.name));
                }
                lastOriginalSource[0] = original.source;
                lastOriginalLine[0] = original.line;
                lastOriginalColumn[0] = original.column;
                lastOriginalName[0] = original.name;
                sourceMappingActive[0] = true;
            } else if (sourceMappingActive[0]) {
                map.addMapping(new Mapping(new Position(generatedLine[0], generatedColumn[0])));
                lastOriginalSource[0] = null;
                sourceMappingActive[0] = false;
            }
            for (int idx = 0, length = chunk.length(); idx < length; idx++) {
                if (chunk.charAt(idx) == NEWLINE_CODE) {
                    generatedLine[0]++;
                    generatedColumn[0] = 0;
                    // Mappings end at eol
                    if (idx + 1 == length) {
                        lastOriginalSource[0] = null;
                        sourceMappingActive[0] = false;
                    } else if (sourceMappingActive[0]) {
                        map.addMapping(new Mapping(new Position(generatedLine[0], generatedColumn[0]), new Position(original.line, original.column),
                                original.source, original.name));
                    }
                } else {
                    generatedColumn[0]++;
                }
            }
        });
        this.walkSourceContents((sourceFile, sourceContent) -> {
            map.setSourceContent(sourceFile, sourceContent);
        });

        return new Code(generatedCode.toString(), map);
    }
105651
@Override
	public Tuple createTuple(EntityKeyMetadata entityKeyMetadata, OperationContext operationContext) {
		Tuple tuple = null;
		CreateTuple createTuple = new CreateTupleImpl( entityKeyMetadata );

		try {
			tuple = super.createTuple( entityKeyMetadata, operationContext );
		}
		catch (Exception e) {
			handleException( createTuple, e );
		}

		handleAppliedOperation( createTuple );
		return tuple;
	}
1183940
static JsonSchema initializeFromSource(final Map<String, Object> source) {

		final Object idValue = source.get(JsonSchema.KEY_ID);
		URI id               = null;

		if (idValue != null) {

			try {

				id = new URI(idValue.toString());

			} catch (URISyntaxException ex) {
				logger.warn("", ex);
			}
		}

		final StructrSchemaDefinition schema = new StructrSchemaDefinition(id);
		schema.deserialize(source);

		return schema;
	}
1258512
public org.tensorflow.framework.AttrValue getAttrOrDefault(
      java.lang.String key,
      org.tensorflow.framework.AttrValue defaultValue) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    java.util.Map<java.lang.String, org.tensorflow.framework.AttrValue> map =
        internalGetAttr().getMap();
    return map.containsKey(key) ? map.get(key) : defaultValue;
  }
156048
public static Object getObject(final ResourceBundle source, final String key, final Object defaultValue)
	{
		try
		{
			return source.getObject(key);
		}
		catch (Exception _exception)
		{
			return defaultValue;
		}
	}
477204
public static Map<String, File> loadStringToFileMap(final CharSource source) throws IOException {
    return loadMap(source, Functions.<String>identity(), FileFunction.INSTANCE,
        IsCommentLine.INSTANCE);
  }