Returns mapped type, spawns a new one from a prototype,
or infers a new one using default mapping.
493844
public JaversType getJaversType(Type javaType) {
        argumentIsNotNull(javaType);

        if (javaType == Object.class) {
            return OBJECT_TYPE;
        }

        return engine.computeIfAbsent(javaType, j -> typeFactory.infer(j, findPrototype(j)));
    }
1023513
function mapping (type, stateDefinitions, contractName) {
  var match = type.match(/mapping\((.*?)=>(.*)\)$/)
  var keyTypeName = match[1].trim()
  var valueTypeName = match[2].trim()

  var keyType = parseType(keyTypeName, stateDefinitions, contractName, 'storage')
  var valueType = parseType(valueTypeName, stateDefinitions, contractName, 'storage')

  var underlyingTypes = {
    'keyType': keyType,
    'valueType': valueType
  }
  return new MappingType(underlyingTypes, 'location', util.removeLocation(type))
}
166178
private @Nullable ProtoType importedType(ProtoType type) {
    // Map key type is always scalar.
    if (type.isMap()) type = type.valueType();
    return type.isScalar() ? null : type;
  }
900753
public @Nonnull ContentMapping getMappingOrCreate(@Nonnull String original, @Nonnull Function<String, ContentMapping> generator) {
        boolean isNew = !mappings.containsKey(original);
        ContentMapping mapping = mappings.computeIfAbsent(original, generator);
        try {
            if (isNew) {
                save();
            }
        } catch (IOException e) {
            LOGGER.log(Level.WARNING, "Could not save mappings file", e);
        }
        return mapping;
    }
524598
def build(self) -> type:
        
        def _get_property_mappings(encoder: MappingJSONEncoder) -> List[JsonPropertyMapping]:
            return _get_all_property_mappings(encoder, self.mappings, self.superclasses)

        def get_serializable_cls(encoder: MappingJSONEncoder) -> type:
            return self.target_cls

        def default(encoder: MappingJSONEncoder, serializable):
            if serializable is None:
                # Fix for #18
                return None
            elif isinstance(serializable, List):
                # Fix for #8
                return [encoder.default(item) for item in serializable]
            else:
                # Sort subclasses so subclass' default method is called last
                superclasses_as_list = list(self.superclasses)
                superclasses_as_list.sort(key=lambda superclass: 1 if superclass == MappingJSONEncoder else -1)

                encoded_combined = {}
                for superclass in superclasses_as_list:
                    encoded = superclass.default(encoder, serializable)
                    encoded_combined.update(encoded)

                return encoded_combined

        return type(
            "%sDynamicMappingJSONEncoder" % self.target_cls.__name__,
            self.superclasses,
            {
                "_get_property_mappings": _get_property_mappings,
                "_get_serializable_cls": get_serializable_cls,
                "default": default
            }
        )
441212
@SuppressWarnings("unchecked")
	public static <K, V> Map<K, V> createMap(Class<?> mapType) {
		if (mapType.isAssignableFrom(AbstractMap.class)) {
			return new HashMap<>();
		} else {
			return (Map<K, V>) ReflectUtil.newInstance(mapType);
		}
	}
958011
public <T extends Mapping> T findMapping(MappingType type, Predicate<T> predicate)
    {
        T mapping = getMapping(type);
        if (mapping != null)
        {

            // check predicate: can invalidate the local mapping
            if (predicate != null)
            {
                mapping = (predicate.appliesTo(mapping)) ? mapping : null;
            }

            // complement the mapping (i.e. resource address at a higher level)
            if(mapping!=null && parent!=null)
            {
                Mapping parentMapping = parent.findMapping(type, predicate);
                if(parentMapping!=null)
                {
                    mapping.complementFrom(parentMapping);
                }
            }

        }

        if (mapping == null && parent != null)
        {
            mapping = (T) parent.findMapping(type, predicate);
        }

        return mapping;
    }
146632
@Nullable
	@Override
	public String getMapping(Class<?> type) {

		String key = key(type, null);

		return MAPPINGS.computeIfAbsent(key, __ -> delegate.getMapping(type));
	}
950817
private static Map<TypeVariable<?>, Type> getTypeVariableMap(Class<?> type) {
        return getTypeVariableMap(type, new HashSet<Type>());
    }
1323088
function getPrototype(value) {
    let prototype;

    if (!_.isUndefined(value) && !_.isNull(value)) {
        if (!_.isObject(value)) {
            prototype = value.constructor.prototype;
        }
        else if (_.isFunction(value)) {
            prototype = value.prototype;
        }
        else {
            prototype = Object.getPrototypeOf(value);
        }
    }

    return prototype;
}
707727
public <T extends Mapping> T findMapping(MappingType type)
    {
        return (T) this.findMapping(type, DEFAULT_PREDICATE);
    }
697390
def new(cls, **kwargs):
        
        kwargs = cls.preprocess_kwargs_before_new(kwargs)
        if cls.__mapper__.polymorphic_on is not None:
            discriminator_key = cls.__mapper__.polymorphic_on.name
            discriminator_val = kwargs.get(discriminator_key)
            if discriminator_val is not None and discriminator_val in cls.__mapper__.polymorphic_map:
                actual_cls = cls.__mapper__.polymorphic_map[discriminator_val].class_
                return actual_cls(
                    **subdict(
                        actual_cls._preprocess_params(kwargs),
                        actual_cls.all_settable_keys())
                )
        return cls(**subdict(cls._preprocess_params(kwargs), cls.all_settable_keys()))
1007025
private static Map<TypeVariable<?>, Type> mergeMaps(TypeDiscoverer<?> parent, Map<TypeVariable<?>, Type> map) {

        Map<TypeVariable<?>, Type> typeVariableMap = new HashMap<TypeVariable<?>, Type>();
        typeVariableMap.putAll(map);
        typeVariableMap.putAll(parent.getTypeVariableMap());

        return typeVariableMap;
    }
1015743
def _constructor(cls, mapping, configuration):
        
        sequence_type, default_factory, pass_key = configuration
        return cls(default_factory, mapping, sequence_type=sequence_type,
                   pass_key=pass_key)
831499
def clone(self, spawn_mapping=None):
        
        c = self.spawn(spawn_mapping)
        self.register_clone(c)
        c.register_parent(self)
        return c
1157211
function instance(schema, defaults, options) {
  const name = 'instance'
  const type = `instance<${schema.name}>`
  const validate = (value = resolveDefaults(defaults)) => {
    return value instanceof schema
      ? [undefined, value]
      : [{ data: value, path: [], value, type }]
  }

  return new Kind(name, type, validate)
}
114054
def dbType(self, typ):
        
        return self.TypeMap.get(typ, self.TypeMap.get('Default'))