Get default implementation for requested list type.

@param listType raw list type.
@param <T> list type.
@return default implementation for requested list.
425829
@SuppressWarnings("unchecked")
  public static <T extends List<?>> Class<T> getListDefaultImplementation(Type listType)
  {
    return (Class<T>)getImplementation(LISTS, listType);
  }
23622
private static String getGenericTypeData(Type genericType) {
    List<String> types = Lists.newArrayList();
    if (genericType != null && genericType instanceof ParameterizedType) {
      for (Type t : ((ParameterizedType) genericType).getActualTypeArguments()) {
        if (t instanceof ParameterizedType) {
          String nestedGeneric = ((Class<?>) ((ParameterizedType) t).getRawType()).getSimpleName();
          nestedGeneric += getGenericTypeData(t);
          types.add(nestedGeneric);
        } else {
          types.add(((Class<?>) t).getSimpleName());
        }
      }
    }
    return (types.size() > 0) ? "<" + Joiner.on(", ").join(types) + ">" : "";
  }
114054
def dbType(self, typ):
        
        return self.TypeMap.get(typ, self.TypeMap.get('Default'))
401412
public static <T> T isA(Class<T> type) {
        reportMatcher(new InstanceOf(type));
        return defaultValue(type);
    }
321526
@Override
  public <T extends Feature<T>> T get(FeatureType<T> featureType) {
    @SuppressWarnings("unchecked")
    T feature = (T) featuresByType.get(featureType.type());
    if (feature != null) {
      return feature;
    }
    return featureType.testDefault(this);
  }
1267734
def _resolve_default(data_type, listify=False):
    """"""
    if isinstance(data_type, _ATOMIC):
        # A Python's object type needs to be left as is instead of being
        # wrapped into a NumPy type.
        out = (data_type.default if isinstance(data_type, Object)
               else _get_atomic_dtype(data_type)(data_type.default))
    elif isinstance(data_type, Array):
        element_default = _resolve_default(data_type.element_type,
                                           listify=listify)
        Sequence = list if listify else tuple
        shape = ((data_type.shape,) if isinstance(data_type.shape, int)
                 else data_type.shape)
        out = element_default
        for dimension in shape:
            out = Sequence(copy.deepcopy(out) for _ in _range(dimension))
    elif isinstance(data_type, Structure):
        if listify:
            out = [_resolve_default(field.type, listify=listify)
                   for field in data_type.fields]
        else:
            field_defaults = collections.OrderedDict(
                (field.name, _resolve_default(field.type, listify=listify))
                for field in data_type.fields)
            name = ('StructureDefault_%s' % (data_type.name,)
                    if data_type.name else 'StructureDefault')
            struct = collections.namedtuple(name, field_defaults.keys())
            out = struct(**field_defaults)

    return out
389951
@SuppressWarnings("unchecked") // types must agree
  private static List createListObject(ParameterizedType type) {

    Class rawType = (Class) type.getRawType();
    Type[] genericTypes = type.getActualTypeArguments();
    List listObject;

    if (rawType.isInterface()) {
      listObject = new ArrayList(MOCK_LIST_COUNT);
    } else {
      listObject = (List) instantiateObject(rawType);
    }

    for (int i = 0; i < MOCK_LIST_COUNT; i++) {
      listObject.add(generateValue((Class) genericTypes[0]));
    }

    return listObject;
  }
791906
public static String getDefaultMediaType(ResultType expectedType) {
    ResponseFormat format = (expectedType != null) ? defaultTypeFormats.get(expectedType) : null;
    
    // If the expected type is unknown, we should let the server decide, otherwise we could
    // wind up requesting a response type that doesn't match the actual resuts (e.g. xml with CONSTRUCT).
    // TODO: We could include multiple media types in the Accept: field, but that assumes that the
    // server has proper support for content negotiation. Many servers only look at the first value.
    return (format != null) ? format.mimeText : null;
  }
460854
private static Converter<List<String>, Object> createListConverter(Type resultType) {
    // Use boxed type if raw type is primitive type. Otherwise the type won't change.
    Class<?> resultClass = getRawClass(resultType);

    // For string, just return the first value
    if (resultClass == String.class) {
      return new BasicConverter(defaultValue(resultClass)) {
        @Override
        protected Object convert(String value) throws Exception {
          return value;
        }
      };
    }

    // Creates converter based on the type

    // Primitive
    Converter<List<String>, Object> converter = createPrimitiveTypeConverter(resultClass);
    if (converter != null) {
      return converter;
    }

    // String constructor
    converter = createStringConstructorConverter(resultClass);
    if (converter != null) {
      return converter;
    }

    // Static string argument methods
    converter = createStringMethodConverter(resultClass);
    if (converter != null) {
      return converter;
    }

    // Collection
    converter = createCollectionConverter(resultType);
    if (converter != null) {
      return converter;
    }

    throw new IllegalArgumentException("Unsupported type " + resultType + " of type class " + resultType.getClass());
  }
694349
public static String getType(final Type t) {
        switch (t.getSort()) {
        case Type.ARRAY:
            return getType(t.getElementType());
        default:
            return t.getClassName();
        }
    }
972879
protected List<String> defaultParameterTypes(Class<?>[] parameterTypes) {
        List<String> names = new ArrayList<>();
        for (int i = 0; i < parameterTypes.length; i++) {
            names.add("arg" + i);
        }
        return names;
    }
1203698
private static Object defaultForType(Class<?> type)
    {
        if (!type.isPrimitive()) {
            return null;
        }
        if (type.equals(boolean.class)) {
            return false;
        }
        if (type.equals(long.class)) {
            return (long) 0L;
        }
        if (type.equals(int.class)) {
            return (int) 0;
        }
        if (type.equals(short.class)) {
            return (short) 0;
        }
        if (type.equals(byte.class)) {
            return (byte) 0;
        }
        if (type.equals(char.class)) {
            return (char) '\u0000';
        }
        if (type.equals(float.class)) {
            return (float) 0.0f;
        }
        if (type.equals(double.class)) {
            return (double) 0.0d;
        }
        // should never happen
        throw new IllegalStateException("Unknown primitive type: " + type.getName());
    }
451412
public Type elemtype(Type t) {
        switch (t.getTag()) {
        case WILDCARD:
            return elemtype(wildUpperBound(t));
        case ARRAY:
            t = t.unannotatedType();
            return ((ArrayType)t).elemtype;
        case FORALL:
            return elemtype(((ForAll)t).qtype);
        case ERROR:
            return t;
        default:
            return null;
        }
    }
1308189
public static String getDefaultValueForType( JType type ) {
        JPrimitiveType primitiveType = type.isPrimitive();
        if ( null != primitiveType ) {
            return primitiveType.getUninitializedFieldExpression();
        }
        return "null";
    }
713775
public <T> TypeAdapter<T> getAdapter(Class<T> type) {
    return getAdapter(TypeToken.get(type));
  }
217965
private static boolean isLogicalListType(Type listType)
  {
    return !listType.isPrimitive() &&
           listType.getOriginalType() != null &&
           listType.getOriginalType().equals(OriginalType.LIST) &&
           listType.asGroupType().getFieldCount() == 1 &&
           listType.asGroupType().getFields().get(0).isRepetition(Type.Repetition.REPEATED);
  }
373707
public final T getSpecializedOrDefault(T defaultInstance)
  {
    T specialized = getSpecialized();
    return specialized != null ? specialized : defaultInstance;
  }