@Override public synchronized Object get(Object key) { return getProperty(String.valueOf(key)); }
/** * 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); }
@Override public String getProperty(String key) { String value = super.getProperty(keyWithContext(key)); return applyReplacements(value); }
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; }
private STGroupFile openGroupFile(URL templateUrl) throws ResourcesException { String encoding; char startChar; char stopChar; encoding = properties.getProperty(ENCODING_PROPERTY); startChar = properties.getCharProperty(DELIMITER_START_CHAR_PROPERTY); stopChar = properties.getCharProperty(DELIMITER_STOP_CHAR_PROPERTY); try { return new STGroupFile(templateUrl, encoding, startChar, stopChar); } catch (STException e) { throw log.errorOpenGroupFile(e); } }
public List<Color> retrieveColors(String name) throws ParseException { return get().getTypedListProperty(name, colorFormat); } }
/** * Returns the constant with the specified name. * * @param name * the constant name. * * @return the physical {@link Measure} constant. * * @throws ParseException * if there was an error parse the physical constant. */ public Measure<?> getConstant(String name) throws ParseException { return resource.get().getTypedProperty(name, format); } }
/** * 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); }
this.valuesDelimeter = p.getProperty(VALUES_DELIMITER_PROPERTY, VALUES_DELIMITER_DEFAULT); this.lineSeparator = p.getProperty(LINE_SEPARATOR_PROPERTY, LINE_SEPARATOR); this.nullString = p.getProperty(NULL_STRING_PROPERTY, NULL_STRING_DEFAULT);
@Override public String getProperty(String key, String defaultValue) { String value = super.getProperty(keyWithContext(key), defaultValue); return applyReplacements(value); }
/** * 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); } }
private String getSeparators() { return properties.get().getProperty("list_separators"); } }
/** * 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(); }
/** * 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); }