本文整理汇总了Java中com.vectorprint.configuration.EnhancedMap类的典型用法代码示例。如果您正苦于以下问题:Java EnhancedMap类的具体用法?Java EnhancedMap怎么用?Java EnhancedMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EnhancedMap类属于com.vectorprint.configuration包,在下文中一共展示了EnhancedMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildSettings
import com.vectorprint.configuration.EnhancedMap; //导入依赖的package包/类
private EnhancedMap buildSettings() throws IOException {
ParsingProperties eh = new ParsingProperties(new SortedProperties(new Settings()));
stylesheet.getText().clear();
defaults.stream().forEach((DefaultValue def) -> {
printComment(def.clazz + "." + def.key + '.' + def.suffix.name(), eh);
eh.put(def.clazz + "." + def.key + '.' + def.suffix.name(), def.value);
});
for (Map.Entry<String, List<Parameterizable>> e : stylingConfig.entrySet()) {
printComment(e.getKey(), eh);
toConfigString(e.getKey(), e.getValue(), eh);
}
extraSettings.entrySet().stream().map((e) -> {
printComment(e.getKey(), eh);
return e;
}).forEach((e) -> {
eh.put(e.getKey(), e.getValue());
});
return eh;
}
示例2: isStyler
import com.vectorprint.configuration.EnhancedMap; //导入依赖的package包/类
public static boolean isStyler(String key, EnhancedMap settings) {
String[] classes = null;
try {
classes = settings.getStringProperties(null, key);
} catch (VectorPrintRuntimeException e) {
if (!e.getMessage().contains("this does not match requested class")) {
throw e;
}
}
if (classes == null) {
return false;
}
for (String s : classes) {
try {
Class.forName(AbstractStyler.class.getPackage().getName() + "." + s.split("\\(")[0]);
} catch (ClassNotFoundException ex) {
return false;
}
}
return true;
}
示例3: isCondition
import com.vectorprint.configuration.EnhancedMap; //导入依赖的package包/类
public static boolean isCondition(String key, EnhancedMap settings) {
String[] classes = null;
try {
classes = settings.getStringProperties(null, key);
} catch (VectorPrintRuntimeException e) {
if (!e.getMessage().contains("this does not match requested class")) {
throw e;
}
}
if (classes == null) {
return false;
}
for (String s : classes) {
try {
Class.forName(AbstractCondition.class.getPackage().getName() + "." + s.split("\\(")[0]);
} catch (ClassNotFoundException ex) {
return false;
}
}
return true;
}
示例4: initSettings
import com.vectorprint.configuration.EnhancedMap; //导入依赖的package包/类
/**
* Look for annotated fields in the Object class, use settings argument to apply settings. NOTE that the settings
* argument may be wrapped, you should always use the {@link Settings#getOutermostDecorator() }
* in that case, and not call the settings argument directly after initialization is performed. When the Object
* argument is a class only static fields will be processed, otherwise only instance fields.
*
* @param o
* @param settings when null create a new {@link Settings} instance.
*/
@Override
public boolean initSettings(Object o, EnhancedMap settings) {
if (settings == null || settings.isEmpty()) {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine("settings null or empty, no initialization");
}
return false;
}
if (settingsUsed == null) {
settingsUsed = settings;
} else if (o instanceof Class && objects.contains(o) && settingsUsed.equals(settings)) {
// only check for classes, because equals of objects may be very expensive
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine(String.format("assuming, based on equals, settings for %s already initialized with %s", o, settings));
}
return false;
}
initSettings(o instanceof Class ? (Class) o : o.getClass(), o instanceof Class ? null : o, settings == null ? new Settings() : settings, settings != null);
if (o instanceof Class) {
objects.add(o);
}
return true;
}
示例5: findKey
import com.vectorprint.configuration.EnhancedMap; //导入依赖的package包/类
/**
* looks for a default value for a key based on the simpleName of a class suffixed by .key and .suffix. This method
* will traverse all Parameterizable superclasses in search of a default.
* @param key the key to find
* @param clazz
* @param settings
* @param suffix
* @return the key pointing to default setting or null
*/
public static String findKey(String key, Class<? extends Parameterizable> clazz, EnhancedMap settings, SUFFIX suffix) {
String simpleName = clazz.getSimpleName() + "." + key + "." + suffix;
while (!settings.containsKey(simpleName)) {
Class c = clazz.getSuperclass();
if (!Parameterizable.class.isAssignableFrom(c)) {
return null;
}
clazz=c;
if (clazz == null) {
return null;
}
simpleName = clazz.getSimpleName() + "." + key + "." + suffix;
}
if (log.isLoggable(Level.FINE)) {
log.fine("found default " + simpleName + ": " + Arrays.toString(settings.get(simpleName)));
}
return simpleName;
}
示例6: buildStylesheet
import com.vectorprint.configuration.EnhancedMap; //导入依赖的package包/类
@FXML
private void buildStylesheet(ActionEvent event) {
try {
EnhancedMap eh = buildSettings();
StringWriter sw = new StringWriter(eh.size() * 30);
SettingsBindingService.getInstance().getFactory().getSerializer().serialize(eh, sw);
stylesheet.getText().appendText(sw.toString());
styleTab.getTabPane().getSelectionModel().select(styleTab);
} catch (Exception ex) {
ViewHelper.toError(ex, error);
}
}
示例7: getDefaults
import com.vectorprint.configuration.EnhancedMap; //导入依赖的package包/类
private void getDefaults(Collection<? extends Parameterizable> l, EnhancedMap settings) {
l.stream().forEach((pz) -> {
pz.getParameters().values().stream().forEach((p) -> {
String key = ParameterHelper.findKey(p.getKey(), pz.getClass(), settings, ParameterHelper.SUFFIX.set_default);
if (key != null) {
DefaultValue defaultValue = new DefaultValue(pz.getClass().getSimpleName(), p.getKey(), settings.get(key)[0], ParameterHelper.SUFFIX.set_default);
defaults.remove(defaultValue);
defaults.add(defaultValue);
processed.add(pz.getClass().getSimpleName() + "." + p.getKey() + '.' + ParameterHelper.SUFFIX.set_default);
}
});
});
}
示例8: testStyleSheet
import com.vectorprint.configuration.EnhancedMap; //导入依赖的package包/类
public void testStyleSheet(String stylesheet) throws Exception {
EnhancedMap settings = new CachingProperties(new ParsingProperties(new Settings(), new StringReader(stylesheet)));
settings.put(ReportConstants.REPORTCLASS, getClass().getName());
ByteArrayOutputStream out = new ByteArrayOutputStream();
new ReportRunner(settings).buildReport(null, out);
controller.openPdf(new ByteArrayInputStream(out.toByteArray()), "test stylesheet in pdf");
}
示例9: ThreadBoundProperties
import com.vectorprint.configuration.EnhancedMap; //导入依赖的package包/类
public ThreadBoundProperties(EnhancedMap properties) {
super(properties);
if (properties == null) {
throw new IllegalArgumentException("properties may not be null");
}
propsFromThread = new InheritableThreadLocal<>();
propsFromThread.set(properties);
}
示例10: ParsingProperties
import com.vectorprint.configuration.EnhancedMap; //导入依赖的package包/类
/**
* Calls {@link #loadFromReader(java.io.Reader) }, does not set {@link #getPropertyUrls() } and {@link #setId(java.lang.String) }.
* @param properties
* @param in
* @throws IOException
*/
public ParsingProperties(EnhancedMap properties, Reader... in) throws IOException {
super(properties);
for (Reader r : in) {
loadFromReader(r);
}
}
示例11: addCommentBeforeKey
import com.vectorprint.configuration.EnhancedMap; //导入依赖的package包/类
public EnhancedMap addCommentBeforeKey(String key, String comment) {
if (!commentBeforeKeys.containsKey(key)) {
commentBeforeKeys.put(key, new ArrayList<>(1));
}
commentBeforeKeys.get(key).add(comment);
return this;
}
示例12: clone
import com.vectorprint.configuration.EnhancedMap; //导入依赖的package包/类
@Override
public EnhancedMap clone() {
ParsingProperties parsingProperties = (ParsingProperties) super.clone();
parsingProperties.commentBeforeKeys.putAll(commentBeforeKeys);
parsingProperties.propertyUrls = propertyUrls;
parsingProperties.trailingComment.addAll(trailingComment);
return parsingProperties;
}
示例13: init
import com.vectorprint.configuration.EnhancedMap; //导入依赖的package包/类
private void init(EnhancedMap settings) throws VectorPrintException {
if (findableProperties.containsKey(settings.getId())) {
throw new VectorPrintException("Already known: " + settings.getId());
} else if (settings.getId() == null) {
throw new VectorPrintException("Id is null");
}
findableProperties.put(settings.getId(), settings);
}
示例14: findContains
import com.vectorprint.configuration.EnhancedMap; //导入依赖的package包/类
/**
* return the first properties whose id contains the argument id
*
* @param id
* @return
*/
public static EnhancedMap findContains(String id) {
for (EnhancedMap em : findableProperties.values()) {
if (em.getId().contains(id)) {
return em;
}
}
return null;
}
示例15: setStaticReference
import com.vectorprint.configuration.EnhancedMap; //导入依赖的package包/类
/**
* sets a static reference
*
* @param em
* @throws VectorPrintException when the reference exists
*/
public static void setStaticReference(EnhancedMap em) throws VectorPrintException {
if (findableProperties.containsKey(em.getId())) {
throw new VectorPrintException("Already known: " + em.getId());
}
findableProperties.put(em.getId(), em);
}