解析为指定对象

@param text  json字符串
@param clazz 指定类
@param <T>   指定对象
@return 指定对象
335274
public static <T> T parseObject(String text, Class<T> clazz) {
        Object obj = JSONSerializer.deserialize(text);
        return BeanSerializer.deserializeByType(obj, clazz);
    }
1155175
public static Object parse(String data, Class<?> clazz) {

        if (data == null) {
            return null;
        }
        if (clazz.equals(byte.class) || clazz.equals(Byte.class)) {
            return parseByte(data);
        }
        if (clazz.equals(short.class) || clazz.equals(Short.class)) {
            return parseShort(data);
        }
        if (clazz.equals(long.class) || clazz.equals(Long.class)) {
            return parseLong(data);
        }
        if (clazz.equals(int.class) || clazz.equals(Integer.class)) {
            return parseInt(data);
        }
        if (clazz.equals(float.class) || clazz.equals(Float.class)) {
            return parseFloat(data);
        }
        if (clazz.equals(double.class) || clazz.equals(Double.class)) {
            return parseDouble(data);
        }
        if (clazz.equals(boolean.class) || clazz.equals(Boolean.class)) {
            return parseBoolean(data);
        }
        if (clazz.equals(char.class) || clazz.equals(Character.class)) {
            return parseChar(data);
        }
        if (clazz.equals(CmsUUID.class)) {
            return parseUUID(data);
        }
        if (clazz.equals(Date.class)) {
            return parseDate(data);
        }
        return data;
    }
1073664
protected <T> T fromJsonString(String json, Class<T> clazz) {
		return _gsonParser.fromJson(json, clazz);
	}
343
@Override
	public <T> T toObject(String json, Class<T> clazz) {
		return toObject(json, clazz, false);
	}
25032
public <T> T toObject(String jsonString, Class<T> clazz) {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}

		try {
			return mapper.readValue(jsonString, clazz);
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}
175398
public String match(String text){
		if(null == text){
			return null;
		}
		List<String> matchAll = matchAll(text, 1);
		if(CollectionUtil.isNotEmpty(matchAll)){
			return matchAll.get(0);
		}
		return null;
	}
222016
public T find(String text)
    {
        T match = matcher.match(text, true);
        if (match != null)
        {
            String name = match.name();
            if (name.substring(0, Math.min(name.length(), text.length())).equalsIgnoreCase(text))
            {
                return match;
            }
        }
        return null;
    }
819396
static Command parse(String text) throws ParseException {
        Parser parser = new Parser(text);
        return parser.parse();
    }
1166205
public static Instant instantUtc(String text) {
		Instant result = null;
		try {
			ZonedDateTime zdt = ZonedDateTime.parse(text, getFormater(DATE_FORMAT_UTC, "UTC"));
			//LocalDateTime ldt = LocalDateTime.parse(text, getFormater(DATE_FORMAT_UTC, "UTC"));
			result = zdt.toInstant();
		}
		catch (DateTimeParseException ex) {
			Say.warn("Instant not constructable {}", ex, text);
		}
		return result;
	}
946556
@Pure
	public static String toHTML(String text) {
		if (text == null) {
			return null;
		}
		final Map<Character, String> transTbl = getJavaToHTMLTranslationTable();
		assert transTbl != null;
		if (transTbl.isEmpty()) {
			return text;
		}
		final StringBuilder patternStr = new StringBuilder();
		for (final Character c : transTbl.keySet()) {
			if (patternStr.length() > 0) {
				patternStr.append("|"); //$NON-NLS-1$
			}
			patternStr.append(Pattern.quote(c.toString()));
		}
		final Pattern pattern = Pattern.compile(patternStr.toString());
		final Matcher matcher = pattern.matcher(text);
		final StringBuilder result = new StringBuilder();
		String character;
		String entity;
		int lastIndex = 0;
		while (matcher.find()) {
			final int idx = matcher.start();
			result.append(text.substring(lastIndex, idx));
			lastIndex = matcher.end();
			character = matcher.group();
			if (character.length() == 1) {
				entity = transTbl.get(Character.valueOf(character.charAt(0)));
				if (entity != null) {
					entity = "&" + entity + ";"; //$NON-NLS-1$ //$NON-NLS-2$
				} else {
					entity = character;
				}
			} else {
				entity = character;
			}
			result.append(entity);
		}
		if (lastIndex < text.length()) {
			result.append(text.substring(lastIndex));
		}
		return result.toString();
	}
477347
public long text(int group, String text) {
		return send(new Filter(false, String.valueOf(group)), null, "text", text);
	}
252368
public <T> T parse(String input, Class<T> clazz) {
		try {
			if (String.class.equals(clazz)) {
				return (T) input;
			}

			StringParser<T> parser = getParser(clazz, input);
			if (parser == null) {
				throw new ParserException(String.format("Cannot parse to %s : %s", clazz.getName(), input));
			}

			return parser.parse(input);
		}
		catch (NumberFormatException e) {
			throw new ParserException(e.getMessage());
		}
	}
1157365
public <V> V convertFrom(final char[] text) {
        if (text == null) return null;
        return (V) convertFrom(text, 0, text.length);
    }
237275
public Match find(String text) {

		if (regexp == null)
			return null;

		Matcher m = regexp.matcher(text);
		if (m.find()) {
			Match match = new Match();
			match.setText(text);
			match.match = m;
			match.start = m.start(0);
			match.end = m.end(0);
			match.line = text;
			return match;
		}
		else {
			return null;
		}
	}
542907
public static JsonStructure decode(String text) {
        if (text == null) throw new IllegalArgumentException("text cannot be null");
        StringReader sr = new StringReader(text);
        JsonReader r = new JsonReader(sr);
        return decodeFully(r);
    }
1053176
@SuppressWarnings("unchecked")
    public Collection<Emit> parseText(String text)
    {
        checkForConstructedFailureStates();

        int position = 0;
        State currentState = this.rootState;
        List<Emit> collectedEmits = new ArrayList<Emit>();
        for (int i = 0; i < text.length(); ++i)
        {
            currentState = getState(currentState, text.charAt(i));
            storeEmits(position, currentState, collectedEmits);
            ++position;
        }

        if (!trieConfig.isAllowOverlaps())
        {
            IntervalTree intervalTree = new IntervalTree((List<Intervalable>) (List<?>) collectedEmits);
            intervalTree.removeOverlaps((List<Intervalable>) (List<?>) collectedEmits);
        }

        if (trieConfig.remainLongest)
        {
            remainLongest(collectedEmits);
        }

        return collectedEmits;
    }
930068
public <T> T read(Class<T> clazz) {
        try {
            return readInternal(clazz);
        } catch (Exception e) {
            if (e instanceof RuntimeException) {
                throw (RuntimeException) e;
            }
            if (e instanceof IOException) {
                throw new UncheckedIOException((IOException) e);
            }
            throw new RuntimeException(e);
        }
    }