本文整理汇总了Java中java.util.Hashtable.get方法的典型用法代码示例。如果您正苦于以下问题:Java Hashtable.get方法的具体用法?Java Hashtable.get怎么用?Java Hashtable.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Hashtable
的用法示例。
在下文中一共展示了Hashtable.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLanguageName
import java.util.Hashtable; //导入方法依赖的package包/类
/**
* Translate the already known language-headers (e. g. 'LANG_EN')
* and give them an proper German expression.
*/
public static String getLanguageName(String langHeader) {
Hashtable<String, String> headDescriptions = new Hashtable<String, String>();
// --- prepare internal language descriptions -----------
headDescriptions.put(Language.DE, translate("Deutsch"));
headDescriptions.put(Language.EN, translate("Englisch"));
headDescriptions.put(Language.IT, translate("Italienisch"));
headDescriptions.put(Language.ES, translate("Spanisch"));
headDescriptions.put(Language.FR, translate("Französisch"));
String langHeaderWork = langHeader.toUpperCase();
String langHeaderD = headDescriptions.get(langHeaderWork);
if ( langHeaderD == null ) {
langHeaderD = langHeaderWork;
}
return langHeaderD;
}
示例2: addSMSParameters
import java.util.Hashtable; //导入方法依赖的package包/类
public static JSONObject addSMSParameters(Hashtable smsData) throws JSONException {
JSONObject json = new JSONObject();
String value = null;
if ((value = (String) smsData.get(JsonTagsZ.GATEWAY_PHONE_NUMBER)) != null && !value
.equals("")) {
json.put(JsonTagsZ.GATEWAY_PHONE_NUMBER, value);
}
if ((value = (String) smsData.get(JsonTagsZ.GATEWAY_ROUTING_KEYWORD)) != null && !value
.equals("")) {
json.put(JsonTagsZ.GATEWAY_ROUTING_KEYWORD, value);
}
if ((value = (String) smsData.get(JsonTagsZ.SENDER_ID)) != null && !value.equals("")) {
json.put(JsonTagsZ.SENDER_ID, value);
}
// Add to container JSON
return json;
}
示例3: standardizeVariablesApart
import java.util.Hashtable; //导入方法依赖的package包/类
/**
* définition de standardizeVariablesApart de Variable: mettre à jour <b>newVars</b>
* @param newVars les variables et leurs binding
* @return retourner le Variable courant
*/
public PCExpression standardizeVariablesApart(Hashtable<Variable, Variable> newVars) {
Variable newVar = newVars.get(this); // Try to see if the current
// expression already has a
// substitute variable.
if (newVar == null) { // if not create one.
newVar = new Variable(this);
newVars.put(this, newVar);
}
return newVar;
}
示例4: ColumnBody
import java.util.Hashtable; //导入方法依赖的package包/类
public ColumnBody(Hashtable<String, String> attributes) {
super(attributes);
String text = attributes.get("Text");
if (text == null)
text = "";
this.text = text;
}
示例5: addRelatedKioskData
import java.util.Hashtable; //导入方法依赖的package包/类
public static void addRelatedKioskData(JSONObject json, Vector relatedKiosks, String type)
throws JSONException {
if (relatedKiosks != null) {
JSONArray relatedKiosksJson = new JSONArray();
// If relatedKiosks is null or empty, send an empty JSONArray in the response.
if (!relatedKiosks.isEmpty()) {
Enumeration en = relatedKiosks.elements();
while (en.hasMoreElements()) {
Hashtable v = (Hashtable) en.nextElement();
JSONObject relatedKioskJson = new JSONObject();
relatedKioskJson.put(JsonTagsZ.KIOSK_ID, (String) v.get(JsonTagsZ.KIOSK_ID));
relatedKioskJson.put(JsonTagsZ.NAME, (String) v.get(JsonTagsZ.NAME));
relatedKioskJson.put(JsonTagsZ.CITY, (String) v.get(JsonTagsZ.CITY));
String value = null;
if ((value = (String) v.get(JsonTagsZ.STATE)) != null && value.length() > 0) {
relatedKioskJson.put(JsonTagsZ.STATE, value);
}
if ((value = (String) v.get(JsonTagsZ.DISTRICT)) != null && value.length() > 0) {
relatedKioskJson.put(JsonTagsZ.DISTRICT, value);
}
if ((value = (String) v.get(JsonTagsZ.TALUK)) != null && value.length() > 0) {
relatedKioskJson.put(JsonTagsZ.TALUK, value);
}
if ((value = (String) v.get(JsonTagsZ.STREET_ADDRESS)) != null && value.length() > 0) {
relatedKioskJson.put(JsonTagsZ.STREET_ADDRESS, value);
}
if ((value = (String) v.get(JsonTagsZ.PINCODE)) != null && value.length() > 0) {
relatedKioskJson.put(JsonTagsZ.PINCODE, value);
}
if ((value = (String) v.get(JsonTagsZ.PAYABLE)) != null && value.length() > 0) {
relatedKioskJson.put(JsonTagsZ.PAYABLE, value);
}
if ((value = (String) v.get(JsonTagsZ.CREDIT_LIMIT)) != null && value.length() > 0) {
relatedKioskJson.put(JsonTagsZ.CREDIT_LIMIT, value);
}
if ((value = (String) v.get(JsonTagsZ.ROUTE_INDEX)) != null) {
relatedKioskJson.put(JsonTagsZ.ROUTE_INDEX, value);
}
if ((value = (String) v.get(JsonTagsZ.ROUTE_TAG)) != null) {
relatedKioskJson.put(JsonTagsZ.ROUTE_TAG, value);
}
if ((value = (String) v.get(JsonTagsZ.LATITUDE)) != null) {
relatedKioskJson.put(JsonTagsZ.LATITUDE, value);
}
if ((value = (String) v.get(JsonTagsZ.LONGITUDE)) != null) {
relatedKioskJson.put(JsonTagsZ.LONGITUDE, value);
}
if ((value = (String) v.get(JsonTagsZ.GEO_ACCURACY)) != null) {
relatedKioskJson.put(JsonTagsZ.GEO_ACCURACY, value);
}
if ((value = (String) v.get(JsonTagsZ.GEO_ERROR_CODE)) != null) {
relatedKioskJson.put(JsonTagsZ.GEO_ERROR_CODE, value);
}
if ((value = (String) v.get(JsonTagsZ.CUSTOM_KIOSKID)) != null) {
relatedKioskJson.put(JsonTagsZ.CUSTOM_KIOSKID, value);
}
if ((value = (String) v.get(JsonTagsZ.DISABLE_BATCH_MGMT)) != null) {
relatedKioskJson.put(JsonTagsZ.DISABLE_BATCH_MGMT, value);
}
// Add users, if any
Vector users = (Vector) v.get(JsonTagsZ.USERS);
if (users != null && !users.isEmpty()) {
addKioskUsers(relatedKioskJson, users);
}
// Add to array
relatedKiosksJson.put(relatedKioskJson);
}
}
// Update kiosk object
json.put(type, relatedKiosksJson);
}
}
示例6: addErrorData
import java.util.Hashtable; //导入方法依赖的package包/类
public static void addErrorData(JSONObject json, Vector errors) throws JSONException {
if (errors == null || errors.isEmpty()) {
throw new JSONException("No error data found");
}
JSONArray array = new JSONArray();
Enumeration en = errors.elements();
while (en.hasMoreElements()) {
Hashtable error = (Hashtable) en.nextElement();
// Form error JSON object
JSONObject e = new JSONObject();
e.put(JsonTagsZ.MATERIAL_ID, (String) error.get(JsonTagsZ.MATERIAL_ID));
e.put(JsonTagsZ.MESSAGE, (String) error.get(JsonTagsZ.MESSAGE));
String value = null;
if ((value = (String) error.get(JsonTagsZ.QUANTITY)) != null && !value.equals("")) {
e.put(JsonTagsZ.QUANTITY, (String) error.get(JsonTagsZ.QUANTITY));
}
if ((value = (String) error.get(JsonTagsZ.ERROR_CODE)) != null && !value.equals("")) {
e.put(JsonTagsZ.ERROR_CODE, (String) error.get(JsonTagsZ.ERROR_CODE));
}
if ((value = (String) error.get(JsonTagsZ.TIMESTAMP)) != null && !value.equals("")) {
e.put(JsonTagsZ.TIMESTAMP, (String) error.get(JsonTagsZ.TIMESTAMP));
}
// Add batches, if any
Vector batches = (Vector) error.get(JsonTagsZ.BATCHES);
if (batches != null && !batches.isEmpty()) {
addBatchErrorData(e, batches);
}
// Add to JSON array
array.put(e);
}
// Add to json object
json.put(JsonTagsZ.ERRORS, array);
}
示例7: getId
import java.util.Hashtable; //导入方法依赖的package包/类
/** Return an int ID for faster access. Will be used for notifications
* and for other operations we want to optimize.
*
* @param domain Namespace
* @param name Type of the notification
* @return An unique id for the domain:name combination
* @since 1.1
*/
@Override
public synchronized int getId( String domain, String name) {
if( domain==null) {
domain="";
}
Hashtable<String,Integer> domainTable = idDomains.get(domain);
if( domainTable == null ) {
domainTable = new Hashtable<String,Integer>();
idDomains.put( domain, domainTable);
}
if( name==null ) {
name="";
}
Integer i = domainTable.get(name);
if( i!= null ) {
return i.intValue();
}
int id[] = ids.get(domain);
if( id == null ) {
id=new int[1];
ids.put( domain, id);
}
int code=id[0]++;
domainTable.put( name, Integer.valueOf( code ));
return code;
}
示例8: getCrosspoint
import java.util.Hashtable; //导入方法依赖的package包/类
private Crosspoint getCrosspoint(final DataPlugin dataPlugin,
final Hashtable<Long, Long> trans, final InputStream stream)
throws IOException {
long id;
Crosspoint c;
id = DataLoader.readLong(stream);
final Long cId = trans.get(id);
if (cId == null) {
c = dataPlugin.createCrosspoint();
trans.put(id, c.getGlobalId());
} else
c = dataPlugin.findCrosspointByGlobalId(cId);
return c;
}
示例9: GetIC
import java.util.Hashtable; //导入方法依赖的package包/类
protected CItemCounter GetIC(Hashtable<String, CItemCounter> tab, String cs)
{
CItemCounter ic = tab.get(cs);
if (ic == null)
{
ic = new CItemCounter();
ic.m_ItemName = cs ;
tab.put(cs, ic);
}
return ic ;
}
示例10: findExamLocationTable
import java.util.Hashtable; //导入方法依赖的package包/类
public static Hashtable<Long, Set<Long>> findExamLocationTable(Long periodId) {
Hashtable<Long,Set<Long>> table = new Hashtable();
for (Iterator i = (new LocationDAO()).getSession()
.createQuery("select distinct r.uniqueId, x.uniqueId from Exam x inner join x.assignedRooms r where x.assignedPeriod.uniqueId=:periodId")
.setLong("periodId",periodId)
.setCacheable(true).list().iterator();i.hasNext();) {
Object[] o = (Object[])i.next();
Set<Long> exams = table.get((Long)o[0]);
if (exams == null) { exams = new HashSet<Long>(); table.put((Long)o[0], exams); }
exams.add((Long)o[1]);
}
return table;
}
示例11: setCache
import java.util.Hashtable; //导入方法依赖的package包/类
public void setCache(Collection classesOrClassIds) {
Vector classesOrClassIdsVect = (classesOrClassIds instanceof Vector ? (Vector)classesOrClassIds : new Vector(classesOrClassIds));
Hashtable newAssignments = iProxy.getAssignmentTable(classesOrClassIdsVect);
Hashtable newInfos = iProxy.getAssignmentInfoTable(classesOrClassIdsVect);
for (Enumeration e=classesOrClassIdsVect.elements();e.hasMoreElements();) {
Object classOrClassId = e.nextElement();
if (classOrClassId instanceof Object[]) classOrClassId = ((Object[])classOrClassId)[0];
Long classId = (classOrClassId instanceof Class_ ? ((Class_)classOrClassId).getUniqueId() : (Long)classOrClassId);
Assignment assignment = (Assignment) newAssignments.get(classId);
iAssignmentTable.put(classId, (assignment==null?sNULL:assignment));
AssignmentPreferenceInfo info = (AssignmentPreferenceInfo) newInfos.get(classId);
iAssignmentInfoTable.put(classId, (info==null?sNULL:info));
}
}
示例12: ProxyDirContext
import java.util.Hashtable; //导入方法依赖的package包/类
/**
* Builds a proxy directory context using the given environment.
*/
public ProxyDirContext(Hashtable env, DirContext dirContext) {
this.env = env;
this.dirContext = dirContext;
if (dirContext instanceof BaseDirContext) {
// Initialize parameters based on the associated dir context, like
// the caching policy.
BaseDirContext baseDirContext = (BaseDirContext) dirContext;
if (baseDirContext.isCached()) {
try {
cache = (ResourceCache)
Class.forName(cacheClassName).newInstance();
} catch (Exception e) {
//FIXME
e.printStackTrace();
}
cache.setCacheMaxSize(baseDirContext.getCacheMaxSize());
cacheTTL = baseDirContext.getCacheTTL();
cacheObjectMaxSize = baseDirContext.getCacheObjectMaxSize();
// cacheObjectMaxSize must be less than cacheMaxSize
// Set a sensible limit
if (cacheObjectMaxSize > baseDirContext.getCacheMaxSize()/32) {
cacheObjectMaxSize = baseDirContext.getCacheMaxSize()/32;
}
}
}
hostName = (String) env.get(HOST);
contextName = (String) env.get(CONTEXT);
}
示例13: getConnection
import java.util.Hashtable; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public Connection getConnection(Data data, Qualifier qualifier, String name) {
Hashtable<String, EConnection> hash = (Hashtable<String, EConnection>) data
.get("Projections.Hash");
List<String> nulls = (List<String>) data.get("Projections.Nulls");
if (hash == null) {
hash = new Hashtable<String, EConnection>();
data.put("Projections.Hash", hash);
}
if (nulls == null) {
nulls = new Vector<String>();
data.put("Projections.Nulls", nulls);
}
EConnection connection = hash.get(name);
if (connection == null) {
if (nulls.indexOf(name) >= 0)
return null;
for (Attribute attribute : data.getAttributes()) {
if ((attribute.getName().equals(name) && (attribute
.getAttributeType().toString()
.equals("Core.ElementList")))) {
ElementListPropertyPersistent property = (ElementListPropertyPersistent) data
.getEngine().getAttribute(null, attribute);
if (property != null) {
connection = new EConnection(attribute, property);
}
}
}
}
if (connection == null)
nulls.add(name);
else
hash.put(name, connection);
return connection;
}
示例14: createObjectName
import java.util.Hashtable; //导入方法依赖的package包/类
/**
* Creates the ObjectName for the ConnectionPoolMBean object to be registered
* @param original the ObjectName for the DataSource
* @return the ObjectName for the ConnectionPoolMBean
* @throws MalformedObjectNameException
*/
public ObjectName createObjectName(ObjectName original) throws MalformedObjectNameException {
String domain = ConnectionPool.POOL_JMX_DOMAIN;
Hashtable<String,String> properties = original.getKeyPropertyList();
String origDomain = original.getDomain();
properties.put("type", "ConnectionPool");
properties.put("class", this.getClass().getName());
if (original.getKeyProperty("path")!=null || properties.get("context")!=null) {
//this ensures that if the registration came from tomcat, we're not losing
//the unique domain, but putting that into as an engine attribute
properties.put("engine", origDomain);
}
ObjectName name = new ObjectName(domain,properties);
return name;
}
示例15: replaceElements
import java.util.Hashtable; //导入方法依赖的package包/类
@Override
public void replaceElements(Engine engine, Element[] oldElements,
Element newElement) {
for (Qualifier qualifier : getAllNotSystemQualifiers(engine)) {
List<Attribute> attributes = new ArrayList<Attribute>();
for (Attribute attribute : qualifier.getAttributes()) {
if ((attribute.getAttributeType().getPluginName()
.equals(getName()))
&& (attribute.getAttributeType().getTypeName()
.equals(getTypeName()))) {
OtherElementPropertyPersistent p = (OtherElementPropertyPersistent) engine
.getAttribute(null, attribute);
if (p.getQualifier() == newElement.getQualifierId())
attributes.add(attribute);
}
}
Hashtable<Element, Object[]> hash = engine.getElements(qualifier,
attributes);
Enumeration<Element> keys = hash.keys();
while (keys.hasMoreElements()) {
Element key = keys.nextElement();
Object[] objects = hash.get(key);
int aIndex = 0;
for (Object object : objects)
if (object != null) {
Long l = (Long) object;
for (Element element : oldElements) {
if (element.getId() == l.longValue()) {
engine.setAttribute(key,
attributes.get(aIndex), newElement
.getId());
break;
}
}
aIndex++;
}
}
}
}