本文整理汇总了Java中java.util.Dictionary.get方法的典型用法代码示例。如果您正苦于以下问题:Java Dictionary.get方法的具体用法?Java Dictionary.get怎么用?Java Dictionary.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Dictionary
的用法示例。
在下文中一共展示了Dictionary.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setConfig
import java.util.Dictionary; //导入方法依赖的package包/类
/**
* Updates the connection config based on a discovered configuration.
* @param config The configuration.
*/
public void setConfig(Dictionary<String, String> config) {
this.connectionFactory = new ConnectionFactory();
if (config != null) {
String username = config.get("username");
this.connectionFactory.setUsername(username);
String password = config.get("password");
this.connectionFactory.setPassword(password);
try {
String uri = config.get("uri");
this.connectionFactory.setUri(uri);
this.getLogger().debug("Received configuration, RabbitMQ URI is {}", uri);
} catch (URISyntaxException | NoSuchAlgorithmException | KeyManagementException e) {
this.getLogger().error("Invalid URI found in configuration", e);
}
} else {
this.getLogger().debug("Unset RabbitMQ configuration");
}
}
示例2: isMatch
import java.util.Dictionary; //导入方法依赖的package包/类
@Override
protected boolean isMatch ( final DataSource source, final Dictionary<?, ?> properties )
{
final Object pid = properties.get ( Constants.SERVICE_PID );
if ( ! ( pid instanceof String ) )
{
logger.debug ( "Rejecting datasource - invalid service.pid - {}", pid );
return false;
}
if ( ! ( source instanceof MasterItem ) && this.onlyMaster )
{
logger.debug ( "Rejecting datasource ({}) - class {} but we require master items ", pid, source.getClass () );
return false;
}
if ( this.blacklist.contains ( pid ) )
{
logger.debug ( "Rejecting datasource ({}) - service.pid is blacklisted", pid );
return false;
}
return true;
}
示例3: loadImage
import java.util.Dictionary; //导入方法依赖的package包/类
/**
* Loads the image from the URL <code>getImageURL</code>. This should
* only be invoked from <code>refreshImage</code>.
*/
private void loadImage() {
URL src = getImageURL();
Image newImage = null;
if (src != null) {
Dictionary cache = (Dictionary)getDocument().
getProperty(IMAGE_CACHE_PROPERTY);
if (cache != null) {
newImage = (Image)cache.get(src);
}
else {
newImage = Toolkit.getDefaultToolkit().createImage(src);
if (newImage != null && getLoadsSynchronously()) {
// Force the image to be loaded by using an ImageIcon.
ImageIcon ii = new ImageIcon();
ii.setImage(newImage);
}
}
}
image = newImage;
}
示例4: addSuffixToSliderLabels
import java.util.Dictionary; //导入方法依赖的package包/类
public static void addSuffixToSliderLabels(JSlider slider, String suffix) {
assert (slider != null && suffix != null);
Dictionary oldLabels = slider.getLabelTable();
Enumeration oldKeys = oldLabels.keys();
Hashtable newLabelTable = new Hashtable();
while (oldKeys.hasMoreElements()) {
Object key = oldKeys.nextElement();
Object value = oldLabels.get(key);
assert (value instanceof String);
String str = ((String)value).concat(suffix);
JLabel label = new JLabel(str);
newLabelTable.put(key, label);
}
slider.setLabelTable(newLabelTable);
}
示例5: equals
import java.util.Dictionary; //导入方法依赖的package包/类
private boolean equals(Dictionary<String, ?> d1, Dictionary<String, ?> d2) {
if (d1 == d2) {
return true;
} else if (d1 == null ^ d2 == null) {
return false;
} else if (d1.size() != d2.size()) {
return false;
} else {
for (Enumeration<String> e1 = d1.keys(); e1.hasMoreElements();) {
String key = e1.nextElement();
Object v1 = d1.get(key);
Object v2 = d2.get(key);
if (v1 != v2 && (v2 == null || !v2.equals(v1))) {
return false;
}
}
return true;
}
}
示例6: readComponentConfiguration
import java.util.Dictionary; //导入方法依赖的package包/类
/**
* Extracts properties from the component configuration context.
*
* @param context the component context
*/
private void readComponentConfiguration(ComponentContext context) {
Dictionary<?, ?> properties = context.getProperties();
try {
String strPort = (String) properties.get("bgpPort");
if (strPort != null) {
bgpPort = Integer.parseInt(strPort);
} else {
bgpPort = DEFAULT_BGP_PORT;
}
} catch (NumberFormatException | ClassCastException e) {
bgpPort = DEFAULT_BGP_PORT;
}
log.debug("BGP port is set to {}", bgpPort);
}
示例7: getHeightOfTallestLabel
import java.util.Dictionary; //导入方法依赖的package包/类
protected int getHeightOfTallestLabel() {
Dictionary dictionary = slider.getLabelTable();
int tallest = 0;
if ( dictionary != null ) {
Enumeration keys = dictionary.keys();
while ( keys.hasMoreElements() ) {
JComponent label = (JComponent) dictionary.get(keys.nextElement());
tallest = Math.max( label.getPreferredSize().height, tallest );
}
}
return tallest;
}
示例8: GenerateTermFrequency
import java.util.Dictionary; //导入方法依赖的package包/类
private void GenerateTermFrequency()
{
for(int i=0; i < _numDocs ; i++)
{
String curDoc=_docs[i];
Dictionary freq=GetWordFrequency(curDoc);
Enumeration enums=freq.keys();
while(enums.hasMoreElements()){
String word=(String) enums.nextElement();
int wordFreq=(Integer)freq.get(word);
int termIndex=GetTermIndex(word);
if(termIndex == -1)
continue;
_termFreq [termIndex][i]=wordFreq;
_docFreq[termIndex] ++;
if (wordFreq > _maxTermFreq[i]) _maxTermFreq[i]=wordFreq;
}
//DictionaryEnumerator enums=freq.GetEnumerator() ;
_maxTermFreq[i]=Integer.MIN_VALUE ;
/*freq.elements()
Object ele=null;
while ((ele=enums.nextElement())!=null)
{
String word=(String)ele.
int wordFreq=(int)enums.Value ;
int termIndex=GetTermIndex(word);
if(termIndex == -1)
continue;
_termFreq [termIndex][i]=wordFre/q;
_docFreq[termIndex] ++;
if (wordFreq > _maxTermFreq[i]) _maxTermFreq[i]=wordFreq;
}*/
}
}
示例9: getWidthOfWidestLabel
import java.util.Dictionary; //导入方法依赖的package包/类
protected int getWidthOfWidestLabel() {
Dictionary dictionary = slider.getLabelTable();
int widest = 0;
if ( dictionary != null ) {
Enumeration keys = dictionary.keys();
while ( keys.hasMoreElements() ) {
JComponent label = (JComponent) dictionary.get(keys.nextElement());
widest = Math.max( label.getPreferredSize().width, widest );
}
}
return widest;
}
示例10: reapplyFontSize
import java.util.Dictionary; //导入方法依赖的package包/类
/**
* Apply the font size to the labels of a slider. This must be called after
* the labels of a slider are changed.
*
* First set up the label hash table and add it to the slider. Then, after
* the slider has been added to a parent window and had its UI assigned,
* call this method to change the label sizes.
*
* http://nadeausoftware.com/node/93#Settingsliderlabelfontsizes
*
* @param slider
*/
public static void reapplyFontSize(JSlider slider) {
Font font = slider.getFont();
Dictionary dict = slider.getLabelTable();
Enumeration keys = dict.keys();
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
Component label = (Component) dict.get(key);
label.setFont(font);
label.setSize(label.getPreferredSize());
}
}
示例11: getVersion
import java.util.Dictionary; //导入方法依赖的package包/类
private static Version getVersion(Dictionary headers) {
if (headers != null) {
Object header = headers.get(Constants.BUNDLE_VERSION);
if (header instanceof String) {
return Version.parseVersion((String) header);
}
}
return Version.emptyVersion;
}
示例12: getBlueprintHeader
import java.util.Dictionary; //导入方法依赖的package包/类
/**
* Returns the {@value #BLUEPRINT_HEADER} if present from the given dictionary.
*
* @param headers
* @return
*/
public static String getBlueprintHeader(Dictionary headers) {
Object header = null;
if (headers != null)
header = headers.get(BLUEPRINT_HEADER);
return (header != null ? header.toString().trim() : null);
}
示例13: getWidthOfWidestLabel
import java.util.Dictionary; //导入方法依赖的package包/类
/**
* Returns the width of the widest label.
* @return the width of the widest label
*/
protected int getWidthOfWidestLabel() {
@SuppressWarnings("rawtypes")
Dictionary dictionary = slider.getLabelTable();
int widest = 0;
if ( dictionary != null ) {
Enumeration<?> keys = dictionary.keys();
while ( keys.hasMoreElements() ) {
JComponent label = (JComponent) dictionary.get(keys.nextElement());
widest = Math.max( label.getPreferredSize().width, widest );
}
}
return widest;
}
示例14: paintLabels
import java.util.Dictionary; //导入方法依赖的package包/类
/**
* Paints the labels.
* @param g the graphics
*/
public void paintLabels( Graphics g ) {
Rectangle labelBounds = labelRect;
@SuppressWarnings("rawtypes")
Dictionary dictionary = slider.getLabelTable();
if ( dictionary != null ) {
Enumeration<?> keys = dictionary.keys();
int minValue = slider.getMinimum();
int maxValue = slider.getMaximum();
boolean enabled = slider.isEnabled();
while ( keys.hasMoreElements() ) {
Integer key = (Integer)keys.nextElement();
int value = key.intValue();
if (value >= minValue && value <= maxValue) {
JComponent label = (JComponent) dictionary.get(key);
label.setEnabled(enabled);
if (label instanceof JLabel) {
Icon icon = label.isEnabled() ? ((JLabel) label).getIcon() : ((JLabel) label).getDisabledIcon();
if (icon instanceof ImageIcon) {
// Register Slider as an image observer. It allows to catch notifications about
// image changes (e.g. gif animation)
Toolkit.getDefaultToolkit().checkImage(((ImageIcon) icon).getImage(), -1, -1, slider);
}
}
if ( slider.getOrientation() == JSlider.HORIZONTAL ) {
g.translate( 0, labelBounds.y );
paintHorizontalLabel( g, value, label );
g.translate( 0, -labelBounds.y );
}
else {
int offset = 0;
if (!BasicGraphicsUtils.isLeftToRight(slider)) {
offset = labelBounds.width -
label.getPreferredSize().width;
}
g.translate( labelBounds.x + offset, 0 );
paintVerticalLabel( g, value, label );
g.translate( -labelBounds.x - offset, 0 );
}
}
}
}
}
示例15: activate
import java.util.Dictionary; //导入方法依赖的package包/类
@Override
protected void activate(ComponentContext componentContext) {
super.activate(componentContext);
Dictionary<String, Object> properties = componentContext.getProperties();
callbackUrl = (String) properties.get("callbackUrl");
}