Gets the first value of the given data type.
@param dataType the data type to look for or null for the "unknown" data
type
@return the value or null if not found
3412
public String first(ICalDataType dataType) {
		String dataTypeStr = toLocalName(dataType);
		return first(dataTypeStr);
	}
792685
public Object parseAs(Type dataType) throws IOException {
    if (!hasMessageBody()) {
      return null;
    }
    return request.getParser().parseAndClose(getContent(), getContentCharset(), dataType);
  }
137170
public static Type typeFromString(String type) {
        final PrimitiveType primitive = PrimitiveType.fromName(type);
        if (primitive != null) {
            return primitive.getKeyClass();
        }
        try {
            return loadClassByName(type);
        } catch (Exception e) {
            //LOGGER.error(String.format("Failed to resolve '%s' into class", type), e);
        }
        return null;
    }
170811
public String getFirstValue() {
        CharSequence firstValue;

        synchronized (values) {
            if (values.isEmpty()) {
                return null;
            }
            firstValue = values.get(0);
        }

        return firstValue.toString();
    }
807729
public String getTypeName() {
		String type = null;
		if (dataType != null) {
			type = dataType.name();
		}
		return type;
	}
838188
public Object getFirstValue(String key) {
    List values = fields.get(key);
    return values.size() > 0 ? values.get(0) : null;
  }
1177609
public static String getExample(TypeDeclaration type) {
		if (type == null || type.example() == null) {
			return null;
		} else {
			return type.example().value();
		}
	}
558506
@Pure
	public String getDefaultValueForType(String type) {
		//TODO: Check if a similar function exists in the Xbase library.
		String defaultValue = "";
		if (!Strings.isEmpty(type) && !"void".equals(type)) {
			switch (type) {
			case "boolean":
				defaultValue = "true";
				break;
			case "double":
				defaultValue = "0.0";
				break;
			case "float":
				defaultValue = "0.0f";
				break;
			case "int":
				defaultValue = "0";
				break;
			case "long":
				defaultValue = "0";
				break;
			case "byte":
				defaultValue = "(0 as byte)";
				break;
			case "short":
				defaultValue = "(0 as short)";
				break;
			case "char":
				defaultValue = "(0 as char)";
				break;
			default:
				defaultValue = "null";
				break;
			}
		}
		return defaultValue;
	}
195214
@Override
    public Type getType() {
        ParameterizedType type = (ParameterizedType) field.getGenericType();
        if (type.getActualTypeArguments()[0] instanceof ParameterizedType) {
            ParameterizedType first = (ParameterizedType) type.getActualTypeArguments()[0];
            return first.getRawType();
        } else {
            return type.getActualTypeArguments()[0];
        }
    }
386830
public XCalValue firstValue() {
		for (Element child : children()) {
			String childNamespace = child.getNamespaceURI();
			if (XCAL_NS.equals(childNamespace)) {
				ICalDataType dataType = toDataType(child.getLocalName());
				String value = child.getTextContent();
				return new XCalValue(dataType, value);
			}
		}

		return new XCalValue(null, element.getTextContent());
	}
1052710
protected synchronized HierarchicalType getDataType(String type) {
        HierarchicalType dataType = typeInstances.get(type);
        //todo: are there still cases where type can be null?
        if (dataType == null) {
            dataType = createDataType(type);
            typeInstances.put(type, dataType);
        }
        return dataType;
    }
49113
public static Class<?> getFirstTypeArgument(Type type) {
        if (type instanceof ParameterizedType) {
            ParameterizedType p = (ParameterizedType) type;
            return getRawClass(p.getActualTypeArguments()[0]);
        } else {
            return null;
        }
    }
849782
protected Datatype updateDtrDatatype(Datatype datatype) {
		// 
		assert (dtrMapInUse);

		// // QNameContext qncSchemaType = datatype.getSchemaType();
		// QNameContext qncBase = qncSchemaType.getSimpleBaseType();
		// assert(qncSchemaType != null);
		//
		//
		// // // special integer handling
		// // if (dtrDatatype.getBuiltInType() == BuiltInType.INTEGER
		// // && (datatype.getBuiltInType() == BuiltInType.NBIT_UNSIGNED_INTEGER
		// || datatype
		// // .getBuiltInType() == BuiltInType.UNSIGNED_INTEGER)) {
		// // dtrDatatype = datatype;
		// // }
		//
		// Datatype dt = dtrMap.get(qncBase.getQName());
		//
		// if (dt == null) {
		// // dt = updateDtrDatatype(simpleBaseType);
		// // dt = updateDtrDatatype(qncSchemaType.getSimpleBaseDatatype());
		// dt = updateDtrDatatype(qncBase); //baseDatatype);
		// // dtrMap.put(qncBase.getQName(), dt);
		// } else {
		// // save new mapping in map
		// // dtrMap.put(qncSchemaType.getQName(), dt);
		// }
		//
		// return dt;

		Datatype baseDatatype = datatype.getBaseDatatype();
		// QNameContext qncSchemaType = datatype.getSchemaType();
		// QNameContext simpleBaseType =
		// qncSchemaType.getSimpleBaseDatatype().getSchemaType();
		QNameContext simpleBaseType = baseDatatype.getSchemaType();

		Datatype dtrDatatype = dtrMap.get(simpleBaseType.getQName());

		if (dtrDatatype == null) {
			// dt = updateDtrDatatype(simpleBaseType);
			// dt = updateDtrDatatype(qncSchemaType.getSimpleBaseDatatype());
			dtrDatatype = updateDtrDatatype(baseDatatype);
		}

		// special integer handling
		if ((dtrDatatype.getBuiltInType() == BuiltInType.INTEGER || dtrDatatype
				.getBuiltInType() == BuiltInType.UNSIGNED_INTEGER)
				&& (datatype.getBuiltInType() == BuiltInType.NBIT_UNSIGNED_INTEGER || datatype
						.getBuiltInType() == BuiltInType.UNSIGNED_INTEGER)) {
			dtrDatatype = datatype;
		}

		// save new mapping in map
		dtrMap.put(datatype.getSchemaType().getQName(), dtrDatatype);

		return dtrDatatype;
	}
372335
public <T> T dataToType(Class<T> type) {
        return Reflection.toType(data, type);
    }
355448
private String getTypeString(final Type type) {
        if (type == null) return null;
        switch (type) {
            case ERROR:
                return "ERROR";
            case INFO:
                return "INFO";
            case WARN:
                return "WARN";
            case DEBUG:
                return "DEBUG";
        }
        return null;
    }
905644
@Nonnull
  public TypeaheadRemote setDataType (@Nonnull @Nonempty final String sDataType)
  {
    m_sDataType = ValueEnforcer.notEmpty (sDataType, "DataType");
    return this;
  }
715924
@Override
   public final DATATYPE getData() {
      return (data != null) ? data : convert(getValue(DATA, String.class));
   }