本文整理汇总了Java中com.helger.commons.collection.impl.CommonsHashMap类的典型用法代码示例。如果您正苦于以下问题:Java CommonsHashMap类的具体用法?Java CommonsHashMap怎么用?Java CommonsHashMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommonsHashMap类属于com.helger.commons.collection.impl包,在下文中一共展示了CommonsHashMap类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: schedule
import com.helger.commons.collection.impl.CommonsHashMap; //导入依赖的package包/类
/**
* @param aScheduleBuilder
* The schedule builder to be used. May not be <code>null</code>.
* Example:
* <code>SimpleScheduleBuilder.repeatMinutelyForever (1)</code>
* @return The created trigger key for further usage. Never <code>null</code>.
*/
@Nonnull
public static TriggerKey schedule (@Nonnull final SimpleScheduleBuilder aScheduleBuilder)
{
ValueEnforcer.notNull (aScheduleBuilder, "ScheduleBuilder");
final ICommonsMap <String, Object> aJobDataMap = new CommonsHashMap <> ();
return GlobalQuartzScheduler.getInstance ()
.scheduleJob (ReIndexJob.class.getName (),
JDK8TriggerBuilder.newTrigger ()
.startAt (PDTFactory.getCurrentLocalDateTime ()
.plusSeconds (5))
.withSchedule (aScheduleBuilder),
ReIndexJob.class,
aJobDataMap);
}
开发者ID:phax,项目名称:peppol-directory,代码行数:24,代码来源:ReIndexJob.java
示例2: testReadBuildInfo
import com.helger.commons.collection.impl.CommonsHashMap; //导入依赖的package包/类
@Test
public void testReadBuildInfo ()
{
final ICommonsMap <String, String> aMap = new CommonsHashMap <> ();
final IReadableResource aRes = new ClassPathResource ("xml/buildinfo.xml");
assertTrue (XMLMapHandler.readMap (aRes, aMap).isSuccess ());
assertNull (XMLMapHandler.readMap (new ClassPathResource ("test1.txt")));
assertTrue (aMap.containsKey ("buildinfo.version"));
assertEquals ("1", aMap.get ("buildinfo.version"));
assertTrue (XMLMapHandler.readMap (aRes).containsKey ("buildinfo.version"));
assertEquals ("1", XMLMapHandler.readMap (aRes).get ("buildinfo.version"));
assertTrue (XMLMapHandler.writeMap (aMap, new ByteArrayOutputStreamProvider ()).isSuccess ());
assertTrue (XMLMapHandler.writeMap (aMap, new NonBlockingByteArrayOutputStream ()).isSuccess ());
}
开发者ID:phax,项目名称:ph-commons,代码行数:17,代码来源:XMLMapHandlerTest.java
示例3: testMap
import com.helger.commons.collection.impl.CommonsHashMap; //导入依赖的package包/类
@Test
public void testMap ()
{
final ICommonsMap <String, Object> aMap = new CommonsHashMap<> ();
aMap.put ("foo", "bar");
assertEquals ("{\"foo\":\"bar\"}", JsonConverter.convertToJson (aMap).getAsJsonString ());
final ICommonsNavigableMap <String, Object> aTreeMap = new CommonsTreeMap<> ();
aTreeMap.put ("foo", "bar");
aTreeMap.put ("foo2", Integer.valueOf (5));
assertEquals ("{\"foo\":\"bar\",\"foo2\":5}", JsonConverter.convertToJson (aTreeMap).getAsJsonString ());
final ICommonsOrderedMap <String, Object> aLinkedMap = new CommonsLinkedHashMap<> ();
aLinkedMap.put ("foo", "bar");
aLinkedMap.put ("foo2", Integer.valueOf (5));
assertEquals ("{\"foo\":\"bar\",\"foo2\":5}", JsonConverter.convertToJson (aLinkedMap).getAsJsonString ());
assertEquals ("{foo:\"bar\",foo2:5}",
JsonConverter.convertToJson (aLinkedMap)
.getAsJsonString (new JsonWriterSettings ().setQuoteNames (false)));
}
开发者ID:phax,项目名称:ph-commons,代码行数:21,代码来源:JsonWriterTest.java
示例4: testWriteAndReadMap
import com.helger.commons.collection.impl.CommonsHashMap; //导入依赖的package包/类
@Test
public void testWriteAndReadMap ()
{
final ICommonsMap <String, Object> aMap = new CommonsHashMap<> ();
aMap.put ("foo", "bar");
_testWriteAndRead (aMap);
final ICommonsNavigableMap <String, Object> aTreeMap = new CommonsTreeMap<> ();
aTreeMap.put ("foo", "bar");
aTreeMap.put ("foo2", Integer.valueOf (5));
_testWriteAndRead (aTreeMap);
final ICommonsOrderedMap <String, Object> aLinkedMap = new CommonsLinkedHashMap<> ();
aLinkedMap.put ("foo", "bar");
aLinkedMap.put ("foo2", Integer.valueOf (5));
_testWriteAndRead (aLinkedMap);
}
开发者ID:phax,项目名称:ph-commons,代码行数:18,代码来源:JsonWriterTest.java
示例5: testMap
import com.helger.commons.collection.impl.CommonsHashMap; //导入依赖的package包/类
@Test
public void testMap ()
{
final ICommonsMap <String, Object> aMap = new CommonsHashMap <> ();
aMap.put ("foo", "bar");
aMap.put ("foo2", Integer.valueOf (5));
assertTrue (JsonConverter.convertToJson (aMap) instanceof JsonObject);
final ICommonsNavigableMap <String, Object> aTreeMap = new CommonsTreeMap <> ();
aTreeMap.put ("foo", "bar");
aTreeMap.put ("foo2", Integer.valueOf (5));
assertTrue (JsonConverter.convertToJson (aTreeMap) instanceof JsonObject);
final ICommonsOrderedMap <String, Object> aLinkedMap = new CommonsLinkedHashMap <> ();
aLinkedMap.put ("foo", "bar");
aLinkedMap.put ("foo2", Integer.valueOf (5));
assertTrue (JsonConverter.convertToJson (aLinkedMap) instanceof JsonObject);
}
开发者ID:phax,项目名称:ph-commons,代码行数:19,代码来源:JsonConverterTest.java
示例6: testMap
import com.helger.commons.collection.impl.CommonsHashMap; //导入依赖的package包/类
@Test
public void testMap ()
{
final ICommonsMap <String, Object> aMap = new CommonsHashMap <> ();
aMap.put ("foo", "bar");
_testEqualsHashcode (aMap);
final ICommonsMap <String, Object> aTreeMap = new CommonsTreeMap <> ();
aTreeMap.put ("foo", "bar");
aTreeMap.put ("foo2", Integer.valueOf (5));
_testEqualsHashcode (aTreeMap);
final ICommonsMap <String, Object> aLinkedMap = new CommonsLinkedHashMap <> ();
aLinkedMap.put ("foo", "bar");
aLinkedMap.put ("foo2", Integer.valueOf (5));
_testEqualsHashcode (aLinkedMap);
}
开发者ID:phax,项目名称:ph-commons,代码行数:18,代码来源:EqualsHashcodeFuncTest.java
示例7: internalAddChild
import com.helger.commons.collection.impl.CommonsHashMap; //导入依赖的package包/类
@Nonnull
public final EChange internalAddChild (@Nonnull final KEYTYPE aDataID,
@Nonnull final ITEMTYPE aChild,
final boolean bAllowOverwrite)
{
ValueEnforcer.notNull (aChild, "Child");
// Ensure children are present
if (m_aChildMap != null)
{
if (!bAllowOverwrite && m_aChildMap.containsKey (aDataID))
return EChange.UNCHANGED;
}
else
{
m_aChildMap = new CommonsHashMap <> ();
m_aChildren = new CommonsArrayList <> ();
}
m_aChildMap.put (aDataID, aChild);
m_aChildren.add (aChild);
m_aFactory.onAddItem (aChild);
return EChange.CHANGED;
}
开发者ID:phax,项目名称:ph-commons,代码行数:25,代码来源:BasicTreeItemWithID.java
示例8: newMap
import com.helger.commons.collection.impl.CommonsHashMap; //导入依赖的package包/类
@Nonnull
@ReturnsMutableCopy
@SafeVarargs
public static <ELEMENTTYPE> CommonsHashMap <ELEMENTTYPE, ELEMENTTYPE> newMap (@Nullable final ELEMENTTYPE... aValues)
{
if (ArrayHelper.isEmpty (aValues))
return newMap (0);
if ((aValues.length % 2) != 0)
throw new IllegalArgumentException ("The passed array needs an even number of elements!");
final CommonsHashMap <ELEMENTTYPE, ELEMENTTYPE> ret = newMap (aValues.length / 2);
for (int i = 0; i < aValues.length; i += 2)
ret.put (aValues[i], aValues[i + 1]);
return ret;
}
开发者ID:phax,项目名称:ph-commons,代码行数:17,代码来源:CollectionHelper.java
示例9: testReplaceMultipleMap
import com.helger.commons.collection.impl.CommonsHashMap; //导入依赖的package包/类
@Test
public void testReplaceMultipleMap ()
{
final ICommonsMap <String, String> aMap = new CommonsHashMap <> ();
aMap.put ("Hallo", "Hi");
aMap.put ("Welt", "world");
aMap.put ("!", "???");
assertEquals ("Abc die Katze lief im Schnee", StringHelper.replaceMultiple ("Abc die Katze lief im Schnee", aMap));
assertEquals ("Hi Katze", StringHelper.replaceMultiple ("Hallo Katze", aMap));
assertEquals ("Moin world", StringHelper.replaceMultiple ("Moin Welt", aMap));
assertEquals ("Moin welt", StringHelper.replaceMultiple ("Moin welt", aMap));
assertEquals ("Hi", StringHelper.replaceMultiple ("Hallo", aMap));
assertEquals ("Hi Hi", StringHelper.replaceMultiple ("Hallo Hallo", aMap));
assertEquals ("HiHiHi", StringHelper.replaceMultiple ("HalloHalloHallo", aMap));
assertEquals ("Hi world???", StringHelper.replaceMultiple ("Hallo Welt!", aMap));
assertEquals ("Hi world???Hi world???", StringHelper.replaceMultiple ("Hallo Welt!Hallo Welt!", aMap));
}
开发者ID:phax,项目名称:ph-commons,代码行数:18,代码来源:StringHelperTest.java
示例10: testMap
import com.helger.commons.collection.impl.CommonsHashMap; //导入依赖的package包/类
@Test
public void testMap ()
{
final StringMap aMap = new StringMap ("a", "b").add ("c", "d");
assertTrue (EqualsHelper.equalsCollection (aMap, aMap));
assertTrue (EqualsHelper.equalsCollection (aMap, CollectionHelper.makeUnmodifiable (aMap)));
assertTrue (EqualsHelper.equalsCollection (aMap, Collections.synchronizedMap (aMap)));
assertTrue (EqualsHelper.equalsCollection (aMap, new StringMap ("a", "b").add ("c", "d")));
assertTrue (EqualsHelper.equalsCollection (new CommonsHashMap <Integer, Integer> (),
new CommonsHashMap <Double, Float> ()));
assertFalse (EqualsHelper.equalsCollection (aMap, new CommonsHashMap <Integer, Integer> ()));
assertFalse (EqualsHelper.equalsCollection (new CommonsHashMap <Integer, Integer> (), aMap));
assertFalse (EqualsHelper.equalsCollection (aMap, new StringMap ("a", "b")));
assertFalse (EqualsHelper.equalsCollection (aMap, new StringMap ("A", "b").add ("c", "d")));
assertFalse (EqualsHelper.equalsCollection (aMap, new StringMap ("a", "B").add ("c", "d")));
assertFalse (EqualsHelper.equalsCollection (aMap, new StringMap ("a", "b").add ("C", "d")));
assertFalse (EqualsHelper.equalsCollection (aMap, new StringMap ("a", "b").add ("c", "D")));
assertFalse (EqualsHelper.equalsCollection (aMap, new StringMap ("a", "b").add ("c", "d").add ("e", "f")));
assertFalse (EqualsHelper.equalsCollection (aMap, new CommonsArrayList <> ("a", "b", "c")));
assertFalse (EqualsHelper.equalsCollection (aMap, new CommonsHashSet <> ("a", "b", "c")));
assertFalse (EqualsHelper.equalsCollection (aMap, ArrayHelper.newArray ("a", "b", "c")));
}
开发者ID:phax,项目名称:ph-commons,代码行数:24,代码来源:EqualsHelperTest.java
示例11: testBasic
import com.helger.commons.collection.impl.CommonsHashMap; //导入依赖的package包/类
@Test
public void testBasic ()
{
final WSClientConfig aCfg = new WSClientConfig (URLHelper.getAsURL ("http://www.example.org"));
final ICommonsMap <String, Object> aMap = new CommonsHashMap<> ();
final BindingProvider aBP = new MockBP (aMap);
aCfg.applyWSSettingsToBindingProvider (aBP);
assertEquals (5, aMap.size ());
assertEquals ("http://www.example.org", aMap.get (BindingProvider.ENDPOINT_ADDRESS_PROPERTY));
// 2 versions
assertEquals (Integer.valueOf (WSClientConfig.DEFAULT_CONNECTION_TIMEOUT_MS),
aMap.get ("com.sun.xml.ws.connect.timeout"));
assertEquals (Integer.valueOf (WSClientConfig.DEFAULT_CONNECTION_TIMEOUT_MS),
aMap.get ("com.sun.xml.internal.ws.connect.timeout"));
// 2 versions
assertEquals (Integer.valueOf (WSClientConfig.DEFAULT_REQUEST_TIMEOUT_MS),
aMap.get ("com.sun.xml.ws.request.timeout"));
assertEquals (Integer.valueOf (WSClientConfig.DEFAULT_REQUEST_TIMEOUT_MS),
aMap.get ("com.sun.xml.internal.ws.request.timeout"));
}
开发者ID:phax,项目名称:ph-commons,代码行数:21,代码来源:WSClientConfigTest.java
示例12: getAllVATItemsForCountry
import com.helger.commons.collection.impl.CommonsHashMap; //导入依赖的package包/类
/**
* Get all VAT types matching the given locale (without any fallback!). It
* contains both the specific definitions and the locale independent
* definitions.
*
* @param aCountry
* The locale to use. May not be <code>null</code>.
* @return A non-<code>null</code> map from ID to the matching VAT item. Also
* the deprecated VAT items are returned! VATTYPE_NONE.getID () is
* used if zero VAT is allowed
*/
@ReturnsMutableCopy
@Nonnull
public ICommonsMap <String, IVATItem> getAllVATItemsForCountry (@Nonnull final Locale aCountry)
{
ValueEnforcer.notNull (aCountry, "Country");
final ICommonsMap <String, IVATItem> ret = new CommonsHashMap <> ();
// first get locale specific VAT types
final VATCountryData aVATCountryData = getVATCountryData (aCountry);
if (aVATCountryData != null)
{
if (aVATCountryData.isZeroVATAllowed ())
ret.put (VATTYPE_NONE.getID (), VATTYPE_NONE);
ret.putAll (aVATCountryData.getAllItems ());
}
return ret;
}
开发者ID:phax,项目名称:ph-masterdata,代码行数:30,代码来源:VATManager.java
示例13: validateAndProduceSVRL
import com.helger.commons.collection.impl.CommonsHashMap; //导入依赖的package包/类
public static void validateAndProduceSVRL (@Nonnull final File aSchematron, final File aXML) throws Exception
{
// Create the custom parameters
final ICommonsMap <String, Object> aCustomParameters = new CommonsHashMap <> ();
aCustomParameters.put ("xyz", "mobile");
aCustomParameters.put ("expected", "");
final SchematronResourceSCH aSCH = SchematronResourceSCH.fromFile (aSchematron);
// Assign custom parameters
aSCH.setParameters (aCustomParameters);
if (false)
System.out.println (XMLWriter.getNodeAsString (aSCH.getXSLTProvider ().getXSLTDocument ()));
// Perform validation
final SchematronOutputType aSVRL = aSCH.applySchematronValidationToSVRL (new FileSystemResource (aXML));
assertNotNull (aSVRL);
if (false)
System.out.println (new SVRLMarshaller ().getAsString (aSVRL));
}
开发者ID:phax,项目名称:ph-schematron,代码行数:22,代码来源:Issue8Test.java
示例14: getClientUniqueID
import com.helger.commons.collection.impl.CommonsHashMap; //导入依赖的package包/类
@Nullable
static String getClientUniqueID (@Nonnull final X509Certificate aCert)
{
try
{
// subject principal name must be in the order CN=XX,O=YY,C=ZZ
// In some JDK versions it is O=YY,CN=XX,C=ZZ instead (e.g. 1.6.0_45)
final LdapName aLdapName = new LdapName (aCert.getSubjectX500Principal ().getName ());
// Make a map from type to name
final ICommonsMap <String, Rdn> aParts = new CommonsHashMap <> ();
for (final Rdn aRdn : aLdapName.getRdns ())
aParts.put (aRdn.getType (), aRdn);
// Re-order - least important item comes first (=reverse order)!
final String sSubjectName = new LdapName (new CommonsArrayList <> (aParts.get ("C"),
aParts.get ("O"),
aParts.get ("CN"))).toString ();
// subject-name + ":" + serial number hexstring
return sSubjectName + ':' + aCert.getSerialNumber ().toString (16);
}
catch (final Exception ex)
{
s_aLogger.error ("Failed to parse '" + aCert.getSubjectX500Principal ().getName () + "'", ex);
return null;
}
}
开发者ID:phax,项目名称:peppol-directory,代码行数:29,代码来源:ClientCertificateValidator.java
示例15: _createContext
import com.helger.commons.collection.impl.CommonsHashMap; //导入依赖的package包/类
@Nonnull
private static WebappContext _createContext (final String sURI)
{
final ICommonsMap <String, String> aInitParams = new CommonsHashMap <> ();
aInitParams.put ("jersey.config.server.provider.packages",
com.helger.pd.indexer.rest.IndexerResource.class.getPackage ().getName ());
return _createContext (URI.create (sURI), ServletContainer.class, null, aInitParams, null);
}
开发者ID:phax,项目名称:peppol-directory,代码行数:9,代码来源:MockServer.java
示例16: createNewInnerMap
import com.helger.commons.collection.impl.CommonsHashMap; //导入依赖的package包/类
@Override
@Nonnull
@ReturnsMutableCopy
protected CommonsHashMap <KEYTYPE2, VALUETYPE> createNewInnerMap ()
{
return new CommonsHashMap<> ();
}
开发者ID:phax,项目名称:ph-commons,代码行数:8,代码来源:MultiHashMapHashMapBased.java
示例17: getAllEntries
import com.helger.commons.collection.impl.CommonsHashMap; //导入依赖的package包/类
@Nonnull
@ReturnsMutableCopy
public ICommonsMap <String, Object> getAllEntries ()
{
if (m_aSettings == null)
return new CommonsHashMap <> ();
return m_aSettings.getClone ();
}
开发者ID:phax,项目名称:ph-commons,代码行数:9,代码来源:ConfigFile.java
示例18: getAllScopeRenewalAwareAttributes
import com.helger.commons.collection.impl.CommonsHashMap; //导入依赖的package包/类
/**
* @return The non-<code>null</code> map with all contained attributes that
* implement the {@link IScopeRenewalAware} interface. May be empty.
*/
@Nonnull
@ReturnsMutableCopy
default ICommonsMap <String, IScopeRenewalAware> getAllScopeRenewalAwareAttributes ()
{
final ICommonsMap <String, IScopeRenewalAware> ret = new CommonsHashMap <> ();
attrs ().forEach ( (n, v) -> {
if (v instanceof IScopeRenewalAware)
ret.put (n, (IScopeRenewalAware) v);
});
return ret;
}
开发者ID:phax,项目名称:ph-commons,代码行数:16,代码来源:IScope.java
示例19: addPrefixNamespaceMapping
import com.helger.commons.collection.impl.CommonsHashMap; //导入依赖的package包/类
public void addPrefixNamespaceMapping (@Nullable final String sPrefix, @Nonnull final String sNamespaceURI)
{
if (s_aLogger.isTraceEnabled ())
s_aLogger.trace ("Adding namespace mapping " + sPrefix + ":" + sNamespaceURI);
// namespace prefix uniqueness check
final String sExistingNamespaceURI = getNamespaceURIOfPrefix (sPrefix);
if (sExistingNamespaceURI != null && !sExistingNamespaceURI.equals (sNamespaceURI))
s_aLogger.warn ("Overwriting namespace prefix '" +
sPrefix +
"' to use URL '" +
sNamespaceURI +
"' instead of '" +
sExistingNamespaceURI +
"'");
if (StringHelper.hasNoText (sPrefix))
{
if (m_sDefaultNamespaceURI != null)
s_aLogger.warn ("Overwriting default namespace '" +
m_sDefaultNamespaceURI +
"' with namespace '" +
sNamespaceURI +
"'");
m_sDefaultNamespaceURI = sNamespaceURI;
}
else
{
if (m_aURL2PrefixMap == null)
m_aURL2PrefixMap = new CommonsHashMap <> ();
m_aURL2PrefixMap.put (sNamespaceURI, sPrefix);
}
}
开发者ID:phax,项目名称:ph-commons,代码行数:34,代码来源:AbstractXMLSerializer.java
示例20: readAllChangeLogs
import com.helger.commons.collection.impl.CommonsHashMap; //导入依赖的package包/类
@Nonnull
@ReturnsMutableCopy
public static ICommonsMap <URI, ChangeLog> readAllChangeLogs (@Nonnull final IChangeLogSerializerCallback aErrorCallback,
@Nullable final ClassLoader aClassLoader)
{
ValueEnforcer.notNull (aErrorCallback, "ErrorCallback");
try
{
final ClassLoader aRealClassLoader = aClassLoader != null ? aClassLoader
: ClassLoaderHelper.getDefaultClassLoader ();
final ICommonsMap <URI, ChangeLog> ret = new CommonsHashMap <> ();
// Find all change log XML files in the classpath
for (final URL aURL : CollectionHelper.newList (ClassLoaderHelper.getResources (aRealClassLoader,
CChangeLog.CHANGELOG_XML_FILENAME)))
{
final URLResource aRes = new URLResource (aURL);
final ChangeLog aChangeLog = readChangeLog (aRes, aErrorCallback);
if (aChangeLog != null)
ret.put (aRes.getAsURI (), aChangeLog);
else
s_aLogger.warn ("Failed to read changelog from URL " + aURL.toExternalForm ());
}
return ret;
}
catch (final IOException ex)
{
// Can be thrown by getResources
throw new IllegalStateException ("Failed to resolved changelogs", ex);
}
}
开发者ID:phax,项目名称:ph-commons,代码行数:33,代码来源:ChangeLogSerializer.java
注:本文中的com.helger.commons.collection.impl.CommonsHashMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论