/** * Use this variant when you aren't interested in encoding data, and just want to get a suitable * reader for incoming request. * * @param istream See <code>getCharsetAwareReader(InputStream, * EncodingInfo)</code>. */ public static Reader getCharsetAwareReader(InputStream istream) throws IOException, UnsupportedCharsetException { return getCharsetAwareReader(istream, new EncodingInfo()); }
/** * Returns a getter method for a property of java bean. * * @param clazz The type of the bean. * @param property The property name. * @param type The type of the property, may be null. * @return The setter method, or <code>null</code> if not found. */ public static Method getter(Class clazz, String property, Class type) { return classProperties(clazz).getter(property, type); }
/** * Returns a method with a pariticular name of a class, ignoring method paramters. * * @param clazz The class * @param name The name of the method. * @return The method, or <code>null</code> if it could not be found. */ public static Method method(Class clazz, String name) { return classProperties(clazz).method(name); }
/** * Builds and mangles a URL for a schema contained in GeoServer * * @param baseURL the base URL, containing host, port and application * @param path the path inside the schema location (.../geoserver/schemas/...) */ public static String buildSchemaURL(String baseURL, String path) { return buildURL(baseURL, appendPath(SCHEMAS, path), null, URLType.RESOURCE); }
public void testExtended() throws Exception { Bar bar = new Bar(); assertNull(OwsUtils.get(bar, "foo")); assertNull(OwsUtils.get(bar, "foo.a")); Foo foo = new Foo(); bar.setFoo(foo); assertEquals(foo, OwsUtils.get(bar, "foo")); assertNull(OwsUtils.get(bar, "foo.a")); foo.setA("abc"); assertEquals("abc", OwsUtils.get(bar, "foo.a")); OwsUtils.set(bar, "foo.b", 123); assertEquals(123, OwsUtils.get(bar, "foo.b")); }
public void testSimple() throws Exception { Foo foo = new Foo(); foo.setA("a"); assertEquals("a", OwsUtils.get(foo, "a")); assertNull(OwsUtils.get(foo, "b")); OwsUtils.set(foo, "b", 5); assertEquals(5, OwsUtils.get(foo, "b")); assertEquals(0f, OwsUtils.get(foo, "c")); OwsUtils.set(foo, "c", 5f); assertEquals(5f, OwsUtils.get(foo, "c")); }
/** * Reads a tokenized string and turns it into a list. In this method, the tokenizer is quite * flexible. Note that if the list is unspecified (ie. is null) or is unconstrained (ie. is ''), * then the method returns an empty list. * * @param rawList The tokenized string. * @param delimiter The delimeter for the string tokens. * @return A list of the tokenized string. */ protected static List readFlat(String rawList, String delimiter) { return KvpUtils.readFlat(rawList, delimiter); }
/** * Wraps a map in case insensitive one. * * <p>If the instance is already a case insensitive map it is returned as is. */ public static Map wrap(Map other) { if (other instanceof CaseInsensitiveMap) { return other; } return new CaseInsensitiveMap(other); } }
/** * Update method which uses reflection to grab property values from one object and set them on * another. * * <p>Null values from the <tt>update</tt> object are ignored. */ <T> void update(T original, T update, Class<T> clazz) { OwsUtils.copy(update, original, clazz); }
/** @deprecated moved to {@link org.geoserver.ows.util.ResponseUtils#encodeXML(String)}. */ public static String encodeXML(String inData) { return org.geoserver.ows.util.ResponseUtils.encodeXML(inData); }
/** * Tokenize a String using the specified separator character and the backslash as an escape * character (see OGC WFS 1.1.0 14.2.2). Escape characters within the tokens are not resolved. * * @param s the String to parse * @param separator the character that separates tokens * @return list of tokens */ public static List<String> escapedTokens(String s, char separator) { return escapedTokens(s, separator, 0); }
/** Method which reflectively sets all collections when they are null. */ protected void resolveCollections(Object object) { OwsUtils.resolveCollections(object); }
/** * Returns a setter method for a property of java bean. * * <p>The <tt>type</tt> parameter may be <code>null</code> to indicate the the setter for the * property should be returned regardless of the type. If not null it will be used to filter the * returned method. * * @param clazz The type of the bean. * @param property The property name. * @param type The type of the property, may be <code>null</code>. * @return The setter method, or <code>null</code> if not found. */ public static Method setter(Class clazz, String property, Class type) { return classProperties(clazz).setter(property, type); }
/** * Copies property values from another <code>EncodingInfo</code> instance. Strange enough, but * sometimes such behavior is preferred to simple assignment or cloning. More specifically, this * method is currently used (at least it was :) in <code> * XmlCharsetDetector.getCharsetAwareReader</code> (other two ways simply don't work). * * @param encInfo source object which properties should be mirrored in this instance */ public void copyFrom(EncodingInfo encInfo) { fEncoding = encInfo.getEncoding(); fIsBigEndian = encInfo.isBigEndian(); fHasBOM = encInfo.hasBOM(); }
/** * Reads a nested tokenized string and turns it into a list. This method is much more specific * to the KVP get request syntax than the more general readFlat method. In this case, the outer * tokenizer '()' and inner tokenizer ',' are both from the specification. Returns a list of * lists. * * @param rawList The tokenized string. * @return A list of lists, containing outer and inner elements. * @throws WfsException When the string structure cannot be read. */ protected static List readNested(String rawList) { return KvpUtils.readNested(rawList); }
/** * @deprecated moved to {@link org.geoserver.ows.util.ResponseUtils#writeEscapedString(Writer, * String)} */ public static void writeEscapedString(Writer writer, String string) throws IOException { org.geoserver.ows.util.ResponseUtils.writeEscapedString(writer, string); }
/** Returns the properties object describing the properties of a class. */ public static ClassProperties getClassProperties(Class clazz) { return classProperties(clazz); }
public String toString() { return getRegExp(); }
/** Calls {@link #readFlat(String)} with the {@link #INNER_DELIMETER}. */ public static List readFlat(String rawList) { return readFlat(rawList, INNER_DELIMETER); }
void resolve(SettingsInfo settings) { resolveCollections(settings); }