public static Object convert(String t, String s) { if (s == null) return null; Type type = toType(t); if (type == null) return s; return convert(type, s); }
public static Object convert(String t, String s) { if (s == null) return null; Type type = toType(t); if (type == null) return s; return convert(type, s); }
public static Object convert(String t, String s) { if (s == null) return null; Type type = toType(t); if (type == null) return s; return convert(type, s); }
public static Object convert(String t, String s) { if (s == null) return null; Type type = toType(t); if (type == null) return s; return convert(type, s); }
private void parseAttribute(CapReqBuilder capReqBuilder) throws Exception { String attributeName = reader.getAttributeValue(null, ATTR_NAME); String attributeValue = reader.getAttributeValue(null, ATTR_VALUE); String attributeType = reader.getAttributeValue(null, ATTR_TYPE); if (isContent(capReqBuilder) && attributeName.equals("url")) { attributeValue = url.resolve(attributeValue) .toString(); } Object value = Attrs.convert(attributeType, attributeValue); capReqBuilder.addAttribute(attributeName, value); }
private void parseAttribute(CapReqBuilder capReqBuilder) throws Exception { String attributeName = reader.getAttributeValue(null, ATTR_NAME); String attributeValue = reader.getAttributeValue(null, ATTR_VALUE); String attributeType = reader.getAttributeValue(null, ATTR_TYPE); if (isContent(capReqBuilder) && attributeName.equals("url")) { attributeValue = url.resolve(attributeValue) .toString(); } Object value = Attrs.convert(attributeType, attributeValue); capReqBuilder.addAttribute(attributeName, value); }
public Object getTyped(String adname) { String s = get(adname); if (s == null) return null; Type t = getType(adname); return convert(t, s); }
public Object getTyped(String adname) { String s = get(adname); if (s == null) return null; Type t = getType(adname); return convert(t, s); }
public static Object convert(Type t, String s) { if (t.sub == null) { switch (t) { case STRING : return s; case LONG : return Long.parseLong(s.trim()); case VERSION : return Version.parseVersion(s); case DOUBLE : return Double.parseDouble(s.trim()); case DOUBLES : case LONGS : case STRINGS : case VERSIONS : // Cannot happen since the sub is null return null; } return null; } List<Object> list = new ArrayList<>(); List<String> split = splitListAttribute(s); for (String p : split) list.add(convert(t.sub, p)); return list; }
public Object getTyped(String adname) { String s = get(adname); if (s == null) return null; Type t = getType(adname); return convert(t, s); }
public Object getTyped(String adname) { String s = get(adname); if (s == null) return null; Type t = getType(adname); return convert(t, s); }
public Object getTyped(String adname) { String s = get(adname); if (s == null) return null; Type t = getType(adname); return convert(t, s); }
public Object getTyped(String adname) { String s = get(adname); if (s == null) return null; Type t = getType(adname); return convert(t, s); }
public Object getTyped(String adname) { String s = get(adname); if (s == null) return null; Type t = getType(adname); return convert(t, s); }
@SuppressWarnings("unchecked") public <T> T getTyped(DataType<T> type, String adname) { String s = get(adname); if (s == null) return null; Type t = getType(adname); if (t != type.type()) throw new IllegalArgumentException( "For key " + adname + ", expected " + type.type() + " but had a " + t + ". Value is " + s); return (T) convert(t, s); }
@SuppressWarnings("unchecked") public <T> T getTyped(DataType<T> type, String adname) { String s = get(adname); if (s == null) return null; Type t = getType(adname); if ( t != type.type()) throw new IllegalArgumentException("For key " + adname + ", expected " + type.type() + " but had a " + t +". Value is " + s); return (T) convert(t, s); }
@SuppressWarnings("unchecked") public <T> T getTyped(DataType<T> type, String adname) { String s = get(adname); if (s == null) return null; Type t = getType(adname); if (t != type.type()) throw new IllegalArgumentException( "For key " + adname + ", expected " + type.type() + " but had a " + t + ". Value is " + s); return (T) convert(t, s); }
@SuppressWarnings("unchecked") public <T> T getTyped(DataType<T> type, String adname) { String s = get(adname); if (s == null) return null; Type t = getType(adname); if (t != type.type()) throw new IllegalArgumentException( "For key " + adname + ", expected " + type.type() + " but had a " + t + ". Value is " + s); return (T) convert(t, s); }
@SuppressWarnings("unchecked") public <T> T getTyped(DataType<T> type, String adname) { String s = get(adname); if (s == null) return null; Type t = getType(adname); if (t != type.type()) throw new IllegalArgumentException( "For key " + adname + ", expected " + type.type() + " but had a " + t + ". Value is " + s); return (T) convert(t, s); }
@SuppressWarnings("unchecked") public <T> T getTyped(DataType<T> type, String adname) { String s = get(adname); if (s == null) return null; Type t = getType(adname); if ( t != type.type()) throw new IllegalArgumentException("For key " + adname + ", expected " + type.type() + " but had a " + t +". Value is " + s); return (T) convert(t, s); }