/** * Sets the context and the properties. * * @param context * an {@link Object} that is used as the context. * * @param parentProperties * the {@link Properties} that are returned. */ public ContextProperties create(Object context, Properties parentProperties) { return new ContextProperties(context, parentProperties); }
/** * Sets the context and the properties. * * @param context * an {@link Class} that is used as the context. * * @param parentProperties * the {@link Properties} that are returned. */ public ContextProperties create(Class<?> context, Properties parentProperties) { return new ContextProperties(context, parentProperties); }
/** * Sets the context and the properties. * * @param context * the context. * * @param parentProperties * the {@link Properties} that are returned. */ public ContextProperties create(String context, Properties parentProperties) { return new ContextProperties(context, parentProperties); } }
/** * Sets the properties for the converter and where to append the string * representation. * * @param p * the {@link Properties}: * <dl> * <dt> * {@code com.anrisoftware.globalpom.core.external.strings.values_delimiter} * </dt> * <dd>The string to use to separate the value from the key.</dd> * * <dt>{@code com.anrisoftware.globalpom.core.external.strings.line_separator} * </dt> * <dd>The string to use to separate the entries.</dd> * * <dt>{@code com.anrisoftware.globalpom.core.external.strings.null_string} * </dt> * <dd>The string to use for {@code null} keys or values.</dd> * </dl> * * @param appendable * the {@link Appendable} to append the string representation. * * @since 1.3 */ public MapToTableString(Properties p, Appendable appendable) { this(new ContextProperties(MapToTableString.class, p), appendable); }
/** * Returning the context properties without loading any other resources. * <p> * Useful if we already loaded default properties from shared resource. * * @return the {@link ContextProperties}. * * @since 1.5 */ public ContextProperties fromDefaults() { Properties resourceP = new Properties(defaultProperties); Properties parentP = new Properties(resourceP); parentP.putAll(parentProperties); return new ContextProperties(context, parentP); }
/** * @see STTemplateWorkerFactory#create(URL, Properties, Map) */ @Inject STTemplateWorker(STTemplateWorkerLogger logger, @Assisted URL templateUrl, @Assisted Properties properties, @Assisted Map<Serializable, Serializable> attributes) throws ResourcesException { this.log = logger; this.templateUrl = templateUrl; this.properties = new ContextProperties(this, properties); this.attributes = attributes; createGroupFile(); }
private URL getUserResourceURL(String fileKey, String urlKey) throws MalformedURLException { ContextProperties properties; properties = new ContextProperties(context, getProperties()); File file = properties.getFileProperty(fileKey, null); URL url = properties.getURLProperty(urlKey, null); if (file != null) { url = file.toURI().toURL(); } return url; }
/** * Loads the properties from a resource with a specified character set. * * @param url * the resource {@link URL}. * * @param charset * the {@link Charset} of the resource. * * @return the {@link ContextProperties}. * * @throws IOException * if there was an error loading the resource. */ public ContextProperties fromResource(URL url, Charset charset) throws IOException { InputStream resource = new BufferedInputStream(url.openStream()); Properties properties = loadProperties(resource, charset); return new ContextProperties(context, properties); }
/** * Loads the properties from a resource with a specified character set. * * @param file * the resource {@link File}. * * @param charset * the {@link Charset} of the resource. * * @return the {@link ContextProperties}. * * @throws IOException * if there was an error loading the resource. * * @since 1.1 */ public ContextProperties fromResource(File file, Charset charset) throws IOException { FileInputStream resource = new FileInputStream(file); Properties properties = loadProperties(resource, charset); return new ContextProperties(context, properties); }