/** * Adds instances of {@link CustomDataStoreFactory} that should be used by uniVocity to read any * custom {@link DataStoreConfiguration}, provided by the user in the constructor of this class, * to properly create instances of {@link CustomDataStore}. * * @param customFactories the factories that process user-provided data store configurations and * generate custom data store instances. */ public final void addCustomDataStoreFactories(CustomDataStoreFactory<?>... customFactories) { Args.notEmpty(customFactories, "Custom data store factories"); for (CustomDataStoreFactory<?> customFactory : customFactories) { Args.notNull(customFactory, "Custom data store factory"); customDataStoreFactories.add(customFactory); } }
/** * Adds the configurations for data stores whose entities will be mapped using the engine created * by this class. * * @param dataStores configurations of data stores that will have their entities mapped through * this engine. */ public final void addDataStoreConfigurations(DataStoreConfiguration... dataStores) { Args.notEmpty(dataStores, "Data stores"); for (DataStoreConfiguration config : dataStores) { Args.notNull(config, "Data store configuration"); dataStoreConfigurations.add(config); } }
/** * Converts the specified string to a byte array. If the charset is not supported the default * system charset is used. * * @param data the string to be encoded * @param charset the desired character encoding * @return The resulting byte array. */ public static byte[] getBytes(final String data, final String charset) { Args.notNull(data, "Input"); Args.notEmpty(charset, "Charset"); try { return data.getBytes(charset); } catch (final UnsupportedEncodingException e) { return data.getBytes(); } }
/** * Converts the byte array of HTTP content characters to a string. If the specified charset is not * supported, default system encoding is used. * * @param data the byte array to be encoded * @param offset the index of the first byte to encode * @param length the number of bytes to encode * @param charset the desired character encoding * @return The result of the conversion. */ public static String getString( final byte[] data, final int offset, final int length, final String charset) { Args.notNull(data, "Input"); Args.notEmpty(charset, "Charset"); try { return new String(data, offset, length, charset); } catch (final UnsupportedEncodingException e) { return new String(data, offset, length); } }
public static AttributeAppender prepend(final String attributeName, final IModel<?> value) { Args.notEmpty((CharSequence) attributeName, "attributeName"); return new AttributeAppender(attributeName, value) { private static final long serialVersionUID = 1L; protected String newValue(final String currentValue, final String replacementValue) { return super.newValue(replacementValue, currentValue); } }.setSeparator(" "); }
public static AttributeModifier replace(final String attributeName, final IModel<?> value) { Args.notEmpty((CharSequence) attributeName, "attributeName"); return new AttributeModifier(attributeName, value); }
public static AttributeModifier remove(final String attributeName) { Args.notEmpty((CharSequence) attributeName, "attributeName"); return replace(attributeName, Model.of(AttributeModifier.VALUELESS_ATTRIBUTE_REMOVE)); }
public static AttributeAppender prepend(final String attributeName, final Serializable value) { Args.notEmpty((CharSequence) attributeName, "attributeName"); return prepend(attributeName, Model.of(value)); }
public static AttributeAppender append(final String attributeName, final IModel<?> value) { Args.notEmpty((CharSequence) attributeName, "attributeName"); return new AttributeAppender(attributeName, value).setSeparator(" "); }