id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
136,900 | phax/ph-commons | ph-less-commons/src/main/java/com/helger/lesscommons/charset/StringEncoder.java | StringEncoder.getAsNewArray | @Nonnull
@ReturnsMutableCopy
public byte [] getAsNewArray (@Nonnull final String sSource)
{
// Optimized for short strings
assert m_aArrayBuffer.remaining () == m_aArrayBuffer.capacity ();
if (encode (sSource, m_aArrayBuffer).isBreak ())
{
// copy the exact correct bytes out
final byte [] ret = new byte [m_aArrayBuffer.position ()];
System.arraycopy (m_aArrayBuffer.array (), 0, ret, 0, m_aArrayBuffer.position ());
m_aArrayBuffer.clear ();
// ~ good += 1;
return ret;
}
// Worst case: assume max bytes per remaining character.
final int charsRemaining = sSource.length () - _getCharsConverted ();
final ByteBuffer aRestBuffer = ByteBuffer.allocate (charsRemaining * UTF8_MAX_BYTES_PER_CHAR);
final EContinue eDone = encode (sSource, aRestBuffer);
assert eDone.isBreak ();
// Combine everything and return it
final byte [] ret = new byte [m_aArrayBuffer.position () + aRestBuffer.position ()];
System.arraycopy (m_aArrayBuffer.array (), 0, ret, 0, m_aArrayBuffer.position ());
System.arraycopy (aRestBuffer.array (), 0, ret, m_aArrayBuffer.position (), aRestBuffer.position ());
m_aArrayBuffer.clear ();
// ~ worst += 1;
return ret;
} | java | @Nonnull
@ReturnsMutableCopy
public byte [] getAsNewArray (@Nonnull final String sSource)
{
// Optimized for short strings
assert m_aArrayBuffer.remaining () == m_aArrayBuffer.capacity ();
if (encode (sSource, m_aArrayBuffer).isBreak ())
{
// copy the exact correct bytes out
final byte [] ret = new byte [m_aArrayBuffer.position ()];
System.arraycopy (m_aArrayBuffer.array (), 0, ret, 0, m_aArrayBuffer.position ());
m_aArrayBuffer.clear ();
// ~ good += 1;
return ret;
}
// Worst case: assume max bytes per remaining character.
final int charsRemaining = sSource.length () - _getCharsConverted ();
final ByteBuffer aRestBuffer = ByteBuffer.allocate (charsRemaining * UTF8_MAX_BYTES_PER_CHAR);
final EContinue eDone = encode (sSource, aRestBuffer);
assert eDone.isBreak ();
// Combine everything and return it
final byte [] ret = new byte [m_aArrayBuffer.position () + aRestBuffer.position ()];
System.arraycopy (m_aArrayBuffer.array (), 0, ret, 0, m_aArrayBuffer.position ());
System.arraycopy (aRestBuffer.array (), 0, ret, m_aArrayBuffer.position (), aRestBuffer.position ());
m_aArrayBuffer.clear ();
// ~ worst += 1;
return ret;
} | [
"@",
"Nonnull",
"@",
"ReturnsMutableCopy",
"public",
"byte",
"[",
"]",
"getAsNewArray",
"(",
"@",
"Nonnull",
"final",
"String",
"sSource",
")",
"{",
"// Optimized for short strings",
"assert",
"m_aArrayBuffer",
".",
"remaining",
"(",
")",
"==",
"m_aArrayBuffer",
"... | Returns a new byte array containing the UTF-8 version of source. The array
will be exactly the correct size for the string.
@param sSource
Source string
@return as encoded array | [
"Returns",
"a",
"new",
"byte",
"array",
"containing",
"the",
"UTF",
"-",
"8",
"version",
"of",
"source",
".",
"The",
"array",
"will",
"be",
"exactly",
"the",
"correct",
"size",
"for",
"the",
"string",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-less-commons/src/main/java/com/helger/lesscommons/charset/StringEncoder.java#L243-L272 |
136,901 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/concurrent/BasicThreadFactory.java | BasicThreadFactory.setDefaultUncaughtExceptionHandler | public static void setDefaultUncaughtExceptionHandler (@Nonnull final Thread.UncaughtExceptionHandler aHdl)
{
ValueEnforcer.notNull (aHdl, "DefaultUncaughtExceptionHandler");
s_aDefaultUncaughtExceptionHandler = aHdl;
} | java | public static void setDefaultUncaughtExceptionHandler (@Nonnull final Thread.UncaughtExceptionHandler aHdl)
{
ValueEnforcer.notNull (aHdl, "DefaultUncaughtExceptionHandler");
s_aDefaultUncaughtExceptionHandler = aHdl;
} | [
"public",
"static",
"void",
"setDefaultUncaughtExceptionHandler",
"(",
"@",
"Nonnull",
"final",
"Thread",
".",
"UncaughtExceptionHandler",
"aHdl",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aHdl",
",",
"\"DefaultUncaughtExceptionHandler\"",
")",
";",
"s_aDefaultUn... | Set the default uncaught exception handler for future instances of
BasicThreadFactory. By default a logging exception handler is present.
@param aHdl
The handlers to be used. May not be <code>null</code>.
@since 9.0.0 | [
"Set",
"the",
"default",
"uncaught",
"exception",
"handler",
"for",
"future",
"instances",
"of",
"BasicThreadFactory",
".",
"By",
"default",
"a",
"logging",
"exception",
"handler",
"is",
"present",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/concurrent/BasicThreadFactory.java#L117-L121 |
136,902 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/deadlock/ThreadDeadlockDetector.java | ThreadDeadlockDetector.findDeadlockedThreads | public void findDeadlockedThreads ()
{
final long [] aThreadIDs = m_aMBean.isSynchronizerUsageSupported () ? m_aMBean.findDeadlockedThreads ()
: m_aMBean.findMonitorDeadlockedThreads ();
if (ArrayHelper.isNotEmpty (aThreadIDs))
{
// Get all stack traces
final Map <Thread, StackTraceElement []> aAllStackTraces = Thread.getAllStackTraces ();
// Sort by ID for a consistent result
Arrays.sort (aThreadIDs);
// Extract the relevant information
final ThreadDeadlockInfo [] aThreadInfos = new ThreadDeadlockInfo [aThreadIDs.length];
for (int i = 0; i < aThreadInfos.length; i++)
{
// ThreadInfo
final ThreadInfo aThreadInfo = m_aMBean.getThreadInfo (aThreadIDs[i]);
// Find matching thread and stack trace
Thread aFoundThread = null;
StackTraceElement [] aFoundStackTrace = null;
// Sort ascending by thread ID for a consistent result
for (final Map.Entry <Thread, StackTraceElement []> aEnrty : aAllStackTraces.entrySet ())
if (aEnrty.getKey ().getId () == aThreadInfo.getThreadId ())
{
aFoundThread = aEnrty.getKey ();
aFoundStackTrace = aEnrty.getValue ();
break;
}
if (aFoundThread == null)
throw new IllegalStateException ("Deadlocked Thread not found as defined by " + aThreadInfo.toString ());
// Remember
aThreadInfos[i] = new ThreadDeadlockInfo (aThreadInfo, aFoundThread, aFoundStackTrace);
}
// Invoke all callbacks
if (m_aCallbacks.isEmpty ())
{
if (LOGGER.isWarnEnabled ())
LOGGER.warn ("Found a deadlock of " + aThreadInfos.length + " threads but no callbacks are present!");
}
else
m_aCallbacks.forEach (x -> x.onDeadlockDetected (aThreadInfos));
}
} | java | public void findDeadlockedThreads ()
{
final long [] aThreadIDs = m_aMBean.isSynchronizerUsageSupported () ? m_aMBean.findDeadlockedThreads ()
: m_aMBean.findMonitorDeadlockedThreads ();
if (ArrayHelper.isNotEmpty (aThreadIDs))
{
// Get all stack traces
final Map <Thread, StackTraceElement []> aAllStackTraces = Thread.getAllStackTraces ();
// Sort by ID for a consistent result
Arrays.sort (aThreadIDs);
// Extract the relevant information
final ThreadDeadlockInfo [] aThreadInfos = new ThreadDeadlockInfo [aThreadIDs.length];
for (int i = 0; i < aThreadInfos.length; i++)
{
// ThreadInfo
final ThreadInfo aThreadInfo = m_aMBean.getThreadInfo (aThreadIDs[i]);
// Find matching thread and stack trace
Thread aFoundThread = null;
StackTraceElement [] aFoundStackTrace = null;
// Sort ascending by thread ID for a consistent result
for (final Map.Entry <Thread, StackTraceElement []> aEnrty : aAllStackTraces.entrySet ())
if (aEnrty.getKey ().getId () == aThreadInfo.getThreadId ())
{
aFoundThread = aEnrty.getKey ();
aFoundStackTrace = aEnrty.getValue ();
break;
}
if (aFoundThread == null)
throw new IllegalStateException ("Deadlocked Thread not found as defined by " + aThreadInfo.toString ());
// Remember
aThreadInfos[i] = new ThreadDeadlockInfo (aThreadInfo, aFoundThread, aFoundStackTrace);
}
// Invoke all callbacks
if (m_aCallbacks.isEmpty ())
{
if (LOGGER.isWarnEnabled ())
LOGGER.warn ("Found a deadlock of " + aThreadInfos.length + " threads but no callbacks are present!");
}
else
m_aCallbacks.forEach (x -> x.onDeadlockDetected (aThreadInfos));
}
} | [
"public",
"void",
"findDeadlockedThreads",
"(",
")",
"{",
"final",
"long",
"[",
"]",
"aThreadIDs",
"=",
"m_aMBean",
".",
"isSynchronizerUsageSupported",
"(",
")",
"?",
"m_aMBean",
".",
"findDeadlockedThreads",
"(",
")",
":",
"m_aMBean",
".",
"findMonitorDeadlocked... | This is the main method to be invoked to find deadlocked threads. In case a
deadlock is found, all registered callbacks are invoked. | [
"This",
"is",
"the",
"main",
"method",
"to",
"be",
"invoked",
"to",
"find",
"deadlocked",
"threads",
".",
"In",
"case",
"a",
"deadlock",
"is",
"found",
"all",
"registered",
"callbacks",
"are",
"invoked",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/deadlock/ThreadDeadlockDetector.java#L52-L98 |
136,903 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/url/URLValidator.java | URLValidator.getUnifiedURL | @Nullable
public static String getUnifiedURL (@Nullable final String sURL)
{
return sURL == null ? null : sURL.trim ().toLowerCase (Locale.US);
} | java | @Nullable
public static String getUnifiedURL (@Nullable final String sURL)
{
return sURL == null ? null : sURL.trim ().toLowerCase (Locale.US);
} | [
"@",
"Nullable",
"public",
"static",
"String",
"getUnifiedURL",
"(",
"@",
"Nullable",
"final",
"String",
"sURL",
")",
"{",
"return",
"sURL",
"==",
"null",
"?",
"null",
":",
"sURL",
".",
"trim",
"(",
")",
".",
"toLowerCase",
"(",
"Locale",
".",
"US",
")... | Get the unified version of a URL. It trims leading and trailing spaces and
lower-cases the URL.
@param sURL
The URL to unify. May be <code>null</code>.
@return The unified URL or <code>null</code> if the input address is
<code>null</code>. | [
"Get",
"the",
"unified",
"version",
"of",
"a",
"URL",
".",
"It",
"trims",
"leading",
"and",
"trailing",
"spaces",
"and",
"lower",
"-",
"cases",
"the",
"URL",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/url/URLValidator.java#L70-L74 |
136,904 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/url/URLValidator.java | URLValidator.isValid | public static boolean isValid (@Nullable final String sURL)
{
if (StringHelper.hasNoText (sURL))
return false;
final String sUnifiedURL = getUnifiedURL (sURL);
return PATTERN.matcher (sUnifiedURL).matches ();
} | java | public static boolean isValid (@Nullable final String sURL)
{
if (StringHelper.hasNoText (sURL))
return false;
final String sUnifiedURL = getUnifiedURL (sURL);
return PATTERN.matcher (sUnifiedURL).matches ();
} | [
"public",
"static",
"boolean",
"isValid",
"(",
"@",
"Nullable",
"final",
"String",
"sURL",
")",
"{",
"if",
"(",
"StringHelper",
".",
"hasNoText",
"(",
"sURL",
")",
")",
"return",
"false",
";",
"final",
"String",
"sUnifiedURL",
"=",
"getUnifiedURL",
"(",
"s... | Checks if a value is a valid URL.
@param sURL
The value validation is being performed on. A <code>null</code> or
empty value is considered invalid.
@return <code>true</code> if URL is valid, <code>false</code> otherwise. | [
"Checks",
"if",
"a",
"value",
"is",
"a",
"valid",
"URL",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/url/URLValidator.java#L84-L91 |
136,905 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java | ValueEnforcer.setEnabled | public static void setEnabled (final boolean bEnabled)
{
s_aEnabled.set (bEnabled);
if (LOGGER.isInfoEnabled ())
LOGGER.info ("ValueEnforcer checks are now " + (bEnabled ? "enabled" : "disabled"));
} | java | public static void setEnabled (final boolean bEnabled)
{
s_aEnabled.set (bEnabled);
if (LOGGER.isInfoEnabled ())
LOGGER.info ("ValueEnforcer checks are now " + (bEnabled ? "enabled" : "disabled"));
} | [
"public",
"static",
"void",
"setEnabled",
"(",
"final",
"boolean",
"bEnabled",
")",
"{",
"s_aEnabled",
".",
"set",
"(",
"bEnabled",
")",
";",
"if",
"(",
"LOGGER",
".",
"isInfoEnabled",
"(",
")",
")",
"LOGGER",
".",
"info",
"(",
"\"ValueEnforcer checks are no... | Enable or disable the checks. By default checks are enabled.
@param bEnabled
<code>true</code> to enable it, <code>false</code> otherwise. | [
"Enable",
"or",
"disable",
"the",
"checks",
".",
"By",
"default",
"checks",
"are",
"enabled",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L69-L74 |
136,906 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/NonBlockingBufferedOutputStream.java | NonBlockingBufferedOutputStream.write | @Override
public void write (final int b) throws IOException
{
if (m_nCount >= m_aBuf.length)
_flushBuffer ();
m_aBuf[m_nCount++] = (byte) b;
} | java | @Override
public void write (final int b) throws IOException
{
if (m_nCount >= m_aBuf.length)
_flushBuffer ();
m_aBuf[m_nCount++] = (byte) b;
} | [
"@",
"Override",
"public",
"void",
"write",
"(",
"final",
"int",
"b",
")",
"throws",
"IOException",
"{",
"if",
"(",
"m_nCount",
">=",
"m_aBuf",
".",
"length",
")",
"_flushBuffer",
"(",
")",
";",
"m_aBuf",
"[",
"m_nCount",
"++",
"]",
"=",
"(",
"byte",
... | Writes the specified byte to this buffered output stream.
@param b
the byte to be written.
@exception IOException
if an I/O error occurs. | [
"Writes",
"the",
"specified",
"byte",
"to",
"this",
"buffered",
"output",
"stream",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/NonBlockingBufferedOutputStream.java#L95-L101 |
136,907 | phax/ph-commons | ph-json/src/main/java/com/helger/json/parser/JsonParser.java | JsonParser.parse | public void parse () throws JsonParseException
{
_readValue ();
// Check for trailing whitespaces
_skipSpaces ();
final IJsonParsePosition aStartPos = m_aPos.getClone ();
// Check for expected end of input
final int c = _readChar ();
if (c != EOI)
throw _parseEx (aStartPos, "Invalid character " + _getPrintableChar (c) + " after JSON root object");
} | java | public void parse () throws JsonParseException
{
_readValue ();
// Check for trailing whitespaces
_skipSpaces ();
final IJsonParsePosition aStartPos = m_aPos.getClone ();
// Check for expected end of input
final int c = _readChar ();
if (c != EOI)
throw _parseEx (aStartPos, "Invalid character " + _getPrintableChar (c) + " after JSON root object");
} | [
"public",
"void",
"parse",
"(",
")",
"throws",
"JsonParseException",
"{",
"_readValue",
"(",
")",
";",
"// Check for trailing whitespaces",
"_skipSpaces",
"(",
")",
";",
"final",
"IJsonParsePosition",
"aStartPos",
"=",
"m_aPos",
".",
"getClone",
"(",
")",
";",
"... | Main parsing routine
@throws JsonParseException
In case a parse error occurs. | [
"Main",
"parsing",
"routine"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-json/src/main/java/com/helger/json/parser/JsonParser.java#L906-L919 |
136,908 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/csv/CSVWriter.java | CSVWriter.setLineEnd | @Nonnull
public CSVWriter setLineEnd (@Nonnull @Nonempty final String sLineEnd)
{
ValueEnforcer.notNull (sLineEnd, "LineEnd");
m_sLineEnd = sLineEnd;
return this;
} | java | @Nonnull
public CSVWriter setLineEnd (@Nonnull @Nonempty final String sLineEnd)
{
ValueEnforcer.notNull (sLineEnd, "LineEnd");
m_sLineEnd = sLineEnd;
return this;
} | [
"@",
"Nonnull",
"public",
"CSVWriter",
"setLineEnd",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sLineEnd",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"sLineEnd",
",",
"\"LineEnd\"",
")",
";",
"m_sLineEnd",
"=",
"sLineEnd",
";",
"return",
... | Set the line delimiting string.
@param sLineEnd
The line end. May neither be <code>null</code> nor empty.
@return this | [
"Set",
"the",
"line",
"delimiting",
"string",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/csv/CSVWriter.java#L194-L200 |
136,909 | phax/ph-commons | ph-security/src/main/java/com/helger/security/keystore/KeyStoreHelper.java | KeyStoreHelper.createKeyStoreWithOnlyOneItem | @Nonnull
public static KeyStore createKeyStoreWithOnlyOneItem (@Nonnull final KeyStore aBaseKeyStore,
@Nonnull final String sAliasToCopy,
@Nullable final char [] aAliasPassword) throws GeneralSecurityException,
IOException
{
ValueEnforcer.notNull (aBaseKeyStore, "BaseKeyStore");
ValueEnforcer.notNull (sAliasToCopy, "AliasToCopy");
final KeyStore aKeyStore = getSimiliarKeyStore (aBaseKeyStore);
// null stream means: create new key store
aKeyStore.load (null, null);
// Do we need a password?
ProtectionParameter aPP = null;
if (aAliasPassword != null)
aPP = new PasswordProtection (aAliasPassword);
aKeyStore.setEntry (sAliasToCopy, aBaseKeyStore.getEntry (sAliasToCopy, aPP), aPP);
return aKeyStore;
} | java | @Nonnull
public static KeyStore createKeyStoreWithOnlyOneItem (@Nonnull final KeyStore aBaseKeyStore,
@Nonnull final String sAliasToCopy,
@Nullable final char [] aAliasPassword) throws GeneralSecurityException,
IOException
{
ValueEnforcer.notNull (aBaseKeyStore, "BaseKeyStore");
ValueEnforcer.notNull (sAliasToCopy, "AliasToCopy");
final KeyStore aKeyStore = getSimiliarKeyStore (aBaseKeyStore);
// null stream means: create new key store
aKeyStore.load (null, null);
// Do we need a password?
ProtectionParameter aPP = null;
if (aAliasPassword != null)
aPP = new PasswordProtection (aAliasPassword);
aKeyStore.setEntry (sAliasToCopy, aBaseKeyStore.getEntry (sAliasToCopy, aPP), aPP);
return aKeyStore;
} | [
"@",
"Nonnull",
"public",
"static",
"KeyStore",
"createKeyStoreWithOnlyOneItem",
"(",
"@",
"Nonnull",
"final",
"KeyStore",
"aBaseKeyStore",
",",
"@",
"Nonnull",
"final",
"String",
"sAliasToCopy",
",",
"@",
"Nullable",
"final",
"char",
"[",
"]",
"aAliasPassword",
"... | Create a new key store based on an existing key store
@param aBaseKeyStore
The source key store. May not be <code>null</code>
@param sAliasToCopy
The name of the alias in the source key store that should be put in
the new key store
@param aAliasPassword
The optional password to access the alias in the source key store.
If it is not <code>null</code> the same password will be used in the
created key store
@return The created in-memory key store
@throws GeneralSecurityException
In case of a key store error
@throws IOException
In case key store loading fails | [
"Create",
"a",
"new",
"key",
"store",
"based",
"on",
"an",
"existing",
"key",
"store"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-security/src/main/java/com/helger/security/keystore/KeyStoreHelper.java#L181-L201 |
136,910 | phax/ph-commons | ph-security/src/main/java/com/helger/security/keystore/KeyStoreHelper.java | KeyStoreHelper.loadKeyStore | @Nonnull
public static LoadedKeyStore loadKeyStore (@Nonnull final IKeyStoreType aKeyStoreType,
@Nullable final String sKeyStorePath,
@Nullable final String sKeyStorePassword)
{
ValueEnforcer.notNull (aKeyStoreType, "KeyStoreType");
// Get the parameters for the key store
if (StringHelper.hasNoText (sKeyStorePath))
return new LoadedKeyStore (null, EKeyStoreLoadError.KEYSTORE_NO_PATH);
KeyStore aKeyStore = null;
// Try to load key store
try
{
aKeyStore = loadKeyStoreDirect (aKeyStoreType, sKeyStorePath, sKeyStorePassword);
}
catch (final IllegalArgumentException ex)
{
if (LOGGER.isWarnEnabled ())
LOGGER.warn ("No such key store '" + sKeyStorePath + "': " + ex.getMessage (), ex.getCause ());
return new LoadedKeyStore (null,
EKeyStoreLoadError.KEYSTORE_LOAD_ERROR_NON_EXISTING,
sKeyStorePath,
ex.getMessage ());
}
catch (final Exception ex)
{
final boolean bInvalidPW = ex instanceof IOException && ex.getCause () instanceof UnrecoverableKeyException;
if (LOGGER.isWarnEnabled ())
LOGGER.warn ("Failed to load key store '" + sKeyStorePath + "': " + ex.getMessage (),
bInvalidPW ? null : ex.getCause ());
return new LoadedKeyStore (null,
bInvalidPW ? EKeyStoreLoadError.KEYSTORE_INVALID_PASSWORD
: EKeyStoreLoadError.KEYSTORE_LOAD_ERROR_FORMAT_ERROR,
sKeyStorePath,
ex.getMessage ());
}
// Finally success
return new LoadedKeyStore (aKeyStore, null);
} | java | @Nonnull
public static LoadedKeyStore loadKeyStore (@Nonnull final IKeyStoreType aKeyStoreType,
@Nullable final String sKeyStorePath,
@Nullable final String sKeyStorePassword)
{
ValueEnforcer.notNull (aKeyStoreType, "KeyStoreType");
// Get the parameters for the key store
if (StringHelper.hasNoText (sKeyStorePath))
return new LoadedKeyStore (null, EKeyStoreLoadError.KEYSTORE_NO_PATH);
KeyStore aKeyStore = null;
// Try to load key store
try
{
aKeyStore = loadKeyStoreDirect (aKeyStoreType, sKeyStorePath, sKeyStorePassword);
}
catch (final IllegalArgumentException ex)
{
if (LOGGER.isWarnEnabled ())
LOGGER.warn ("No such key store '" + sKeyStorePath + "': " + ex.getMessage (), ex.getCause ());
return new LoadedKeyStore (null,
EKeyStoreLoadError.KEYSTORE_LOAD_ERROR_NON_EXISTING,
sKeyStorePath,
ex.getMessage ());
}
catch (final Exception ex)
{
final boolean bInvalidPW = ex instanceof IOException && ex.getCause () instanceof UnrecoverableKeyException;
if (LOGGER.isWarnEnabled ())
LOGGER.warn ("Failed to load key store '" + sKeyStorePath + "': " + ex.getMessage (),
bInvalidPW ? null : ex.getCause ());
return new LoadedKeyStore (null,
bInvalidPW ? EKeyStoreLoadError.KEYSTORE_INVALID_PASSWORD
: EKeyStoreLoadError.KEYSTORE_LOAD_ERROR_FORMAT_ERROR,
sKeyStorePath,
ex.getMessage ());
}
// Finally success
return new LoadedKeyStore (aKeyStore, null);
} | [
"@",
"Nonnull",
"public",
"static",
"LoadedKeyStore",
"loadKeyStore",
"(",
"@",
"Nonnull",
"final",
"IKeyStoreType",
"aKeyStoreType",
",",
"@",
"Nullable",
"final",
"String",
"sKeyStorePath",
",",
"@",
"Nullable",
"final",
"String",
"sKeyStorePassword",
")",
"{",
... | Load the provided key store in a safe manner.
@param aKeyStoreType
Type of key store. May not be <code>null</code>.
@param sKeyStorePath
Path to the key store. May not be <code>null</code> to succeed.
@param sKeyStorePassword
Password for the key store. May not be <code>null</code> to succeed.
@return The key store loading result. Never <code>null</code>. | [
"Load",
"the",
"provided",
"key",
"store",
"in",
"a",
"safe",
"manner",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-security/src/main/java/com/helger/security/keystore/KeyStoreHelper.java#L214-L258 |
136,911 | phax/ph-commons | ph-security/src/main/java/com/helger/security/keystore/KeyStoreHelper.java | KeyStoreHelper.loadSecretKey | @Nonnull
public static LoadedKey <KeyStore.SecretKeyEntry> loadSecretKey (@Nonnull final KeyStore aKeyStore,
@Nonnull final String sKeyStorePath,
@Nullable final String sKeyStoreKeyAlias,
@Nullable final char [] aKeyStoreKeyPassword)
{
return _loadKey (aKeyStore, sKeyStorePath, sKeyStoreKeyAlias, aKeyStoreKeyPassword, KeyStore.SecretKeyEntry.class);
} | java | @Nonnull
public static LoadedKey <KeyStore.SecretKeyEntry> loadSecretKey (@Nonnull final KeyStore aKeyStore,
@Nonnull final String sKeyStorePath,
@Nullable final String sKeyStoreKeyAlias,
@Nullable final char [] aKeyStoreKeyPassword)
{
return _loadKey (aKeyStore, sKeyStorePath, sKeyStoreKeyAlias, aKeyStoreKeyPassword, KeyStore.SecretKeyEntry.class);
} | [
"@",
"Nonnull",
"public",
"static",
"LoadedKey",
"<",
"KeyStore",
".",
"SecretKeyEntry",
">",
"loadSecretKey",
"(",
"@",
"Nonnull",
"final",
"KeyStore",
"aKeyStore",
",",
"@",
"Nonnull",
"final",
"String",
"sKeyStorePath",
",",
"@",
"Nullable",
"final",
"String"... | Load the specified secret key entry from the provided key store.
@param aKeyStore
The key store to load the key from. May not be <code>null</code>.
@param sKeyStorePath
Key store path. For nice error messages only. May be
<code>null</code>.
@param sKeyStoreKeyAlias
The alias to be resolved in the key store. Must be non-
<code>null</code> to succeed.
@param aKeyStoreKeyPassword
The key password for the key store. Must be non-<code>null</code> to
succeed.
@return The key loading result. Never <code>null</code>. | [
"Load",
"the",
"specified",
"secret",
"key",
"entry",
"from",
"the",
"provided",
"key",
"store",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-security/src/main/java/com/helger/security/keystore/KeyStoreHelper.java#L360-L367 |
136,912 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/serialize/read/XMLCharsetDeterminator.java | XMLCharsetDeterminator._match | private static boolean _match (@Nonnull final byte [] aSrcBytes,
@Nonnegative final int nSrcOffset,
@Nonnull final byte [] aCmpBytes)
{
final int nEnd = aCmpBytes.length;
for (int i = 0; i < nEnd; ++i)
if (aSrcBytes[nSrcOffset + i] != aCmpBytes[i])
return false;
return true;
} | java | private static boolean _match (@Nonnull final byte [] aSrcBytes,
@Nonnegative final int nSrcOffset,
@Nonnull final byte [] aCmpBytes)
{
final int nEnd = aCmpBytes.length;
for (int i = 0; i < nEnd; ++i)
if (aSrcBytes[nSrcOffset + i] != aCmpBytes[i])
return false;
return true;
} | [
"private",
"static",
"boolean",
"_match",
"(",
"@",
"Nonnull",
"final",
"byte",
"[",
"]",
"aSrcBytes",
",",
"@",
"Nonnegative",
"final",
"int",
"nSrcOffset",
",",
"@",
"Nonnull",
"final",
"byte",
"[",
"]",
"aCmpBytes",
")",
"{",
"final",
"int",
"nEnd",
"... | Byte array match method
@param aSrcBytes
The bytes read.
@param nSrcOffset
The offset within read bytes to start searching
@param aCmpBytes
The encoding specific bytes to check.
@return <code>true</code> if the bytes match, <code>false</code> otherwise. | [
"Byte",
"array",
"match",
"method"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/read/XMLCharsetDeterminator.java#L190-L199 |
136,913 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/serialize/read/XMLCharsetDeterminator.java | XMLCharsetDeterminator.determineXMLCharset | @Nullable
public static Charset determineXMLCharset (@Nonnull final byte [] aBytes)
{
ValueEnforcer.notNull (aBytes, "Bytes");
Charset aParseCharset = null;
int nSearchOfs = 0;
if (aBytes.length > 0)
{
// Check if a BOM is present
// Read at maximum 4 bytes (max BOM bytes)
try (
NonBlockingByteArrayInputStream aIS = new NonBlockingByteArrayInputStream (aBytes,
0,
Math.min (EUnicodeBOM.getMaximumByteCount (),
aBytes.length)))
{
// Check for BOM first
final InputStreamAndCharset aISC = CharsetHelper.getInputStreamAndCharsetFromBOM (aIS);
if (aISC.hasBOM ())
{
// A BOM was found, but not necessarily a charset could uniquely be
// identified - skip the
// BOM bytes and continue determination from there
nSearchOfs = aISC.getBOM ().getByteCount ();
}
if (aISC.hasCharset ())
{
// A BOM was found, and that BOM also has a unique charset assigned
aParseCharset = aISC.getCharset ();
}
}
}
// No charset found and enough bytes left?
if (aParseCharset == null && aBytes.length - nSearchOfs >= 4)
if (_match (aBytes, nSearchOfs, CS_UTF32_BE))
aParseCharset = CHARSET_UTF_32BE;
else
if (_match (aBytes, nSearchOfs, CS_UTF32_LE))
aParseCharset = CHARSET_UTF_32LE;
else
if (_match (aBytes, nSearchOfs, CS_UTF16_BE))
aParseCharset = StandardCharsets.UTF_16BE;
else
if (_match (aBytes, nSearchOfs, CS_UTF16_LE))
aParseCharset = StandardCharsets.UTF_16LE;
else
if (_match (aBytes, nSearchOfs, CS_UTF8))
aParseCharset = StandardCharsets.UTF_8;
else
if (_match (aBytes, nSearchOfs, CS_EBCDIC))
aParseCharset = CHARSET_EBCDIC;
else
if (_match (aBytes, nSearchOfs, CS_IBM290))
aParseCharset = CHARSET_IBM290;
if (aParseCharset == null)
{
// Fallback charset is always UTF-8
aParseCharset = FALLBACK_CHARSET;
}
// Now read with a reader
return _parseXMLEncoding (aBytes, nSearchOfs, aParseCharset);
} | java | @Nullable
public static Charset determineXMLCharset (@Nonnull final byte [] aBytes)
{
ValueEnforcer.notNull (aBytes, "Bytes");
Charset aParseCharset = null;
int nSearchOfs = 0;
if (aBytes.length > 0)
{
// Check if a BOM is present
// Read at maximum 4 bytes (max BOM bytes)
try (
NonBlockingByteArrayInputStream aIS = new NonBlockingByteArrayInputStream (aBytes,
0,
Math.min (EUnicodeBOM.getMaximumByteCount (),
aBytes.length)))
{
// Check for BOM first
final InputStreamAndCharset aISC = CharsetHelper.getInputStreamAndCharsetFromBOM (aIS);
if (aISC.hasBOM ())
{
// A BOM was found, but not necessarily a charset could uniquely be
// identified - skip the
// BOM bytes and continue determination from there
nSearchOfs = aISC.getBOM ().getByteCount ();
}
if (aISC.hasCharset ())
{
// A BOM was found, and that BOM also has a unique charset assigned
aParseCharset = aISC.getCharset ();
}
}
}
// No charset found and enough bytes left?
if (aParseCharset == null && aBytes.length - nSearchOfs >= 4)
if (_match (aBytes, nSearchOfs, CS_UTF32_BE))
aParseCharset = CHARSET_UTF_32BE;
else
if (_match (aBytes, nSearchOfs, CS_UTF32_LE))
aParseCharset = CHARSET_UTF_32LE;
else
if (_match (aBytes, nSearchOfs, CS_UTF16_BE))
aParseCharset = StandardCharsets.UTF_16BE;
else
if (_match (aBytes, nSearchOfs, CS_UTF16_LE))
aParseCharset = StandardCharsets.UTF_16LE;
else
if (_match (aBytes, nSearchOfs, CS_UTF8))
aParseCharset = StandardCharsets.UTF_8;
else
if (_match (aBytes, nSearchOfs, CS_EBCDIC))
aParseCharset = CHARSET_EBCDIC;
else
if (_match (aBytes, nSearchOfs, CS_IBM290))
aParseCharset = CHARSET_IBM290;
if (aParseCharset == null)
{
// Fallback charset is always UTF-8
aParseCharset = FALLBACK_CHARSET;
}
// Now read with a reader
return _parseXMLEncoding (aBytes, nSearchOfs, aParseCharset);
} | [
"@",
"Nullable",
"public",
"static",
"Charset",
"determineXMLCharset",
"(",
"@",
"Nonnull",
"final",
"byte",
"[",
"]",
"aBytes",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aBytes",
",",
"\"Bytes\"",
")",
";",
"Charset",
"aParseCharset",
"=",
"null",
";... | Determine the XML charset
@param aBytes
XML byte representation
@return <code>null</code> if no charset was found. In that case you might
wanna try UTF-8 as the fallback. | [
"Determine",
"the",
"XML",
"charset"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/read/XMLCharsetDeterminator.java#L209-L276 |
136,914 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java | HttpHeaderMap.getUnifiedValue | @Nonnull
public static String getUnifiedValue (@Nullable final String sValue)
{
final StringBuilder aSB = new StringBuilder ();
StringHelper.replaceMultipleTo (sValue, new char [] { '\r', '\n', '\t' }, ' ', aSB);
return aSB.toString ();
} | java | @Nonnull
public static String getUnifiedValue (@Nullable final String sValue)
{
final StringBuilder aSB = new StringBuilder ();
StringHelper.replaceMultipleTo (sValue, new char [] { '\r', '\n', '\t' }, ' ', aSB);
return aSB.toString ();
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"getUnifiedValue",
"(",
"@",
"Nullable",
"final",
"String",
"sValue",
")",
"{",
"final",
"StringBuilder",
"aSB",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"StringHelper",
".",
"replaceMultipleTo",
"(",
"sValue",
... | Avoid having header values spanning multiple lines. This has been deprecated
by RFC 7230 and Jetty 9.3 refuses to parse these requests with HTTP 400 by
default.
@param sValue
The source header value. May be <code>null</code>.
@return The unified header value without \r, \n and \t. Never
<code>null</code>. | [
"Avoid",
"having",
"header",
"values",
"spanning",
"multiple",
"lines",
".",
"This",
"has",
"been",
"deprecated",
"by",
"RFC",
"7230",
"and",
"Jetty",
"9",
".",
"3",
"refuses",
"to",
"parse",
"these",
"requests",
"with",
"HTTP",
"400",
"by",
"default",
"."... | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java#L108-L114 |
136,915 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java | HttpHeaderMap.setHeader | public void setHeader (@Nonnull @Nonempty final String sName, @Nullable final String sValue)
{
if (sValue != null)
_setHeader (sName, sValue);
} | java | public void setHeader (@Nonnull @Nonempty final String sName, @Nullable final String sValue)
{
if (sValue != null)
_setHeader (sName, sValue);
} | [
"public",
"void",
"setHeader",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sName",
",",
"@",
"Nullable",
"final",
"String",
"sValue",
")",
"{",
"if",
"(",
"sValue",
"!=",
"null",
")",
"_setHeader",
"(",
"sName",
",",
"sValue",
")",
";",
"... | Set the passed header as is.
@param sName
Header name. May neither be <code>null</code> nor empty.
@param sValue
The value to be set. May be <code>null</code> in which case nothing
happens. | [
"Set",
"the",
"passed",
"header",
"as",
"is",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java#L190-L194 |
136,916 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java | HttpHeaderMap.addHeader | public void addHeader (@Nonnull @Nonempty final String sName, @Nullable final String sValue)
{
if (sValue != null)
_addHeader (sName, sValue);
} | java | public void addHeader (@Nonnull @Nonempty final String sName, @Nullable final String sValue)
{
if (sValue != null)
_addHeader (sName, sValue);
} | [
"public",
"void",
"addHeader",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sName",
",",
"@",
"Nullable",
"final",
"String",
"sValue",
")",
"{",
"if",
"(",
"sValue",
"!=",
"null",
")",
"_addHeader",
"(",
"sName",
",",
"sValue",
")",
";",
"... | Add the passed header as is.
@param sName
Header name. May neither be <code>null</code> nor empty.
@param sValue
The value to be set. May be <code>null</code> in which case nothing
happens. | [
"Add",
"the",
"passed",
"header",
"as",
"is",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java#L205-L209 |
136,917 | phax/ph-commons | ph-wsclient/src/main/java/com/helger/wsclient/WSHelper.java | WSHelper.enableSoapLogging | public static void enableSoapLogging (final boolean bServerDebug, final boolean bClientDebug)
{
// Server debug mode
String sDebug = Boolean.toString (bServerDebug);
SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", sDebug);
SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump", sDebug);
// Client debug mode
sDebug = Boolean.toString (bClientDebug);
SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.HttpTransportPipe.dump", sDebug);
SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.HttpTransportPipe.dump", sDebug);
// Enlarge dump size
if (bServerDebug || bClientDebug)
{
final String sValue = Integer.toString (2 * CGlobal.BYTES_PER_MEGABYTE);
SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.HttpAdapter.dumpTreshold", sValue);
SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.HttpAdapter.dumpTreshold", sValue);
}
else
{
SystemProperties.removePropertyValue ("com.sun.xml.ws.transport.http.HttpAdapter.dumpTreshold");
SystemProperties.removePropertyValue ("com.sun.xml.internal.ws.transport.http.HttpAdapter.dumpTreshold");
}
} | java | public static void enableSoapLogging (final boolean bServerDebug, final boolean bClientDebug)
{
// Server debug mode
String sDebug = Boolean.toString (bServerDebug);
SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", sDebug);
SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump", sDebug);
// Client debug mode
sDebug = Boolean.toString (bClientDebug);
SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.HttpTransportPipe.dump", sDebug);
SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.HttpTransportPipe.dump", sDebug);
// Enlarge dump size
if (bServerDebug || bClientDebug)
{
final String sValue = Integer.toString (2 * CGlobal.BYTES_PER_MEGABYTE);
SystemProperties.setPropertyValue ("com.sun.xml.ws.transport.http.HttpAdapter.dumpTreshold", sValue);
SystemProperties.setPropertyValue ("com.sun.xml.internal.ws.transport.http.HttpAdapter.dumpTreshold", sValue);
}
else
{
SystemProperties.removePropertyValue ("com.sun.xml.ws.transport.http.HttpAdapter.dumpTreshold");
SystemProperties.removePropertyValue ("com.sun.xml.internal.ws.transport.http.HttpAdapter.dumpTreshold");
}
} | [
"public",
"static",
"void",
"enableSoapLogging",
"(",
"final",
"boolean",
"bServerDebug",
",",
"final",
"boolean",
"bClientDebug",
")",
"{",
"// Server debug mode",
"String",
"sDebug",
"=",
"Boolean",
".",
"toString",
"(",
"bServerDebug",
")",
";",
"SystemProperties... | Enable the JAX-WS SOAP debugging. This shows the exchanged SOAP messages in
the log file. By default this logging is disabled.
@param bServerDebug
<code>true</code> to enable server debugging, <code>false</code> to
disable it.
@param bClientDebug
<code>true</code> to enable client debugging, <code>false</code> to
disable it. | [
"Enable",
"the",
"JAX",
"-",
"WS",
"SOAP",
"debugging",
".",
"This",
"shows",
"the",
"exchanged",
"SOAP",
"messages",
"in",
"the",
"log",
"file",
".",
"By",
"default",
"this",
"logging",
"is",
"disabled",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-wsclient/src/main/java/com/helger/wsclient/WSHelper.java#L62-L86 |
136,918 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/charset/CharsetHelper.java | CharsetHelper.getUTF8ByteCount | @Nonnegative
public static int getUTF8ByteCount (@Nullable final String s)
{
return s == null ? 0 : getUTF8ByteCount (s.toCharArray ());
} | java | @Nonnegative
public static int getUTF8ByteCount (@Nullable final String s)
{
return s == null ? 0 : getUTF8ByteCount (s.toCharArray ());
} | [
"@",
"Nonnegative",
"public",
"static",
"int",
"getUTF8ByteCount",
"(",
"@",
"Nullable",
"final",
"String",
"s",
")",
"{",
"return",
"s",
"==",
"null",
"?",
"0",
":",
"getUTF8ByteCount",
"(",
"s",
".",
"toCharArray",
"(",
")",
")",
";",
"}"
] | Get the number of bytes necessary to represent the passed string as an
UTF-8 string.
@param s
The string to count the length. May be <code>null</code> or empty.
@return A non-negative value. | [
"Get",
"the",
"number",
"of",
"bytes",
"necessary",
"to",
"represent",
"the",
"passed",
"string",
"as",
"an",
"UTF",
"-",
"8",
"string",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/charset/CharsetHelper.java#L183-L187 |
136,919 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/charset/CharsetHelper.java | CharsetHelper.getUTF8ByteCount | @Nonnegative
public static int getUTF8ByteCount (@Nullable final char [] aChars)
{
int nCount = 0;
if (aChars != null)
for (final char c : aChars)
nCount += getUTF8ByteCount (c);
return nCount;
} | java | @Nonnegative
public static int getUTF8ByteCount (@Nullable final char [] aChars)
{
int nCount = 0;
if (aChars != null)
for (final char c : aChars)
nCount += getUTF8ByteCount (c);
return nCount;
} | [
"@",
"Nonnegative",
"public",
"static",
"int",
"getUTF8ByteCount",
"(",
"@",
"Nullable",
"final",
"char",
"[",
"]",
"aChars",
")",
"{",
"int",
"nCount",
"=",
"0",
";",
"if",
"(",
"aChars",
"!=",
"null",
")",
"for",
"(",
"final",
"char",
"c",
":",
"aC... | Get the number of bytes necessary to represent the passed char array as an
UTF-8 string.
@param aChars
The characters to count the length. May be <code>null</code> or
empty.
@return A non-negative value. | [
"Get",
"the",
"number",
"of",
"bytes",
"necessary",
"to",
"represent",
"the",
"passed",
"char",
"array",
"as",
"an",
"UTF",
"-",
"8",
"string",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/charset/CharsetHelper.java#L198-L206 |
136,920 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/charset/CharsetHelper.java | CharsetHelper.getUTF8ByteCount | @Nonnegative
public static int getUTF8ByteCount (@Nonnegative final int c)
{
ValueEnforcer.isBetweenInclusive (c, "c", Character.MIN_VALUE, Character.MAX_VALUE);
// see JVM spec 4.4.7, p 111
// http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html
// #1297
if (c == 0)
return 2;
// Source: http://icu-project.org/apiref/icu4c/utf8_8h_source.html
if (c <= 0x7f)
return 1;
if (c <= 0x7ff)
return 2;
if (c <= 0xd7ff)
return 3;
// It's a surrogate...
return 0;
} | java | @Nonnegative
public static int getUTF8ByteCount (@Nonnegative final int c)
{
ValueEnforcer.isBetweenInclusive (c, "c", Character.MIN_VALUE, Character.MAX_VALUE);
// see JVM spec 4.4.7, p 111
// http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html
// #1297
if (c == 0)
return 2;
// Source: http://icu-project.org/apiref/icu4c/utf8_8h_source.html
if (c <= 0x7f)
return 1;
if (c <= 0x7ff)
return 2;
if (c <= 0xd7ff)
return 3;
// It's a surrogate...
return 0;
} | [
"@",
"Nonnegative",
"public",
"static",
"int",
"getUTF8ByteCount",
"(",
"@",
"Nonnegative",
"final",
"int",
"c",
")",
"{",
"ValueEnforcer",
".",
"isBetweenInclusive",
"(",
"c",
",",
"\"c\"",
",",
"Character",
".",
"MIN_VALUE",
",",
"Character",
".",
"MAX_VALUE... | Get the number of bytes necessary to represent the passed character.
@param c
The character to be evaluated.
@return A non-negative value. | [
"Get",
"the",
"number",
"of",
"bytes",
"necessary",
"to",
"represent",
"the",
"passed",
"character",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/charset/CharsetHelper.java#L221-L242 |
136,921 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/lang/BitSetHelper.java | BitSetHelper.createBitSet | @Nonnull
public static BitSet createBitSet (final byte nValue)
{
final BitSet ret = new BitSet (CGlobal.BITS_PER_BYTE);
for (int i = 0; i < CGlobal.BITS_PER_BYTE; ++i)
ret.set (i, ((nValue >> i) & 1) == 1);
return ret;
} | java | @Nonnull
public static BitSet createBitSet (final byte nValue)
{
final BitSet ret = new BitSet (CGlobal.BITS_PER_BYTE);
for (int i = 0; i < CGlobal.BITS_PER_BYTE; ++i)
ret.set (i, ((nValue >> i) & 1) == 1);
return ret;
} | [
"@",
"Nonnull",
"public",
"static",
"BitSet",
"createBitSet",
"(",
"final",
"byte",
"nValue",
")",
"{",
"final",
"BitSet",
"ret",
"=",
"new",
"BitSet",
"(",
"CGlobal",
".",
"BITS_PER_BYTE",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"... | Convert the passed byte value to an bit set of size 8.
@param nValue
The value to be converted to a bit set.
@return The non-<code>null</code> bit set. | [
"Convert",
"the",
"passed",
"byte",
"value",
"to",
"an",
"bit",
"set",
"of",
"size",
"8",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/BitSetHelper.java#L49-L56 |
136,922 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/lang/BitSetHelper.java | BitSetHelper.getExtractedIntValue | public static int getExtractedIntValue (@Nonnull final BitSet aBS)
{
ValueEnforcer.notNull (aBS, "BitSet");
final int nMax = aBS.length ();
ValueEnforcer.isTrue (nMax <= CGlobal.BITS_PER_INT,
() -> "Can extract only up to " + CGlobal.BITS_PER_INT + " bits");
int ret = 0;
for (int i = nMax - 1; i >= 0; --i)
{
ret <<= 1;
if (aBS.get (i))
ret += CGlobal.BIT_SET;
}
return ret;
} | java | public static int getExtractedIntValue (@Nonnull final BitSet aBS)
{
ValueEnforcer.notNull (aBS, "BitSet");
final int nMax = aBS.length ();
ValueEnforcer.isTrue (nMax <= CGlobal.BITS_PER_INT,
() -> "Can extract only up to " + CGlobal.BITS_PER_INT + " bits");
int ret = 0;
for (int i = nMax - 1; i >= 0; --i)
{
ret <<= 1;
if (aBS.get (i))
ret += CGlobal.BIT_SET;
}
return ret;
} | [
"public",
"static",
"int",
"getExtractedIntValue",
"(",
"@",
"Nonnull",
"final",
"BitSet",
"aBS",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aBS",
",",
"\"BitSet\"",
")",
";",
"final",
"int",
"nMax",
"=",
"aBS",
".",
"length",
"(",
")",
";",
"Value... | Extract the int representation of the passed bit set. To avoid loss of
data, the bit set may not have more than 32 bits.
@param aBS
The bit set to extract the value from. May not be <code>null</code>.
@return The extracted value. May be negative if the bit set has 32
elements, the highest order bit is set. | [
"Extract",
"the",
"int",
"representation",
"of",
"the",
"passed",
"bit",
"set",
".",
"To",
"avoid",
"loss",
"of",
"data",
"the",
"bit",
"set",
"may",
"not",
"have",
"more",
"than",
"32",
"bits",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/BitSetHelper.java#L115-L131 |
136,923 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/lang/BitSetHelper.java | BitSetHelper.getExtractedLongValue | public static long getExtractedLongValue (@Nonnull final BitSet aBS)
{
ValueEnforcer.notNull (aBS, "BitSet");
final int nMax = aBS.length ();
ValueEnforcer.isTrue (nMax <= CGlobal.BITS_PER_LONG,
() -> "Can extract only up to " + CGlobal.BITS_PER_LONG + " bits");
long ret = 0;
for (int i = nMax - 1; i >= 0; --i)
{
ret <<= 1;
if (aBS.get (i))
ret += CGlobal.BIT_SET;
}
return ret;
} | java | public static long getExtractedLongValue (@Nonnull final BitSet aBS)
{
ValueEnforcer.notNull (aBS, "BitSet");
final int nMax = aBS.length ();
ValueEnforcer.isTrue (nMax <= CGlobal.BITS_PER_LONG,
() -> "Can extract only up to " + CGlobal.BITS_PER_LONG + " bits");
long ret = 0;
for (int i = nMax - 1; i >= 0; --i)
{
ret <<= 1;
if (aBS.get (i))
ret += CGlobal.BIT_SET;
}
return ret;
} | [
"public",
"static",
"long",
"getExtractedLongValue",
"(",
"@",
"Nonnull",
"final",
"BitSet",
"aBS",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aBS",
",",
"\"BitSet\"",
")",
";",
"final",
"int",
"nMax",
"=",
"aBS",
".",
"length",
"(",
")",
";",
"Val... | Extract the long representation of the passed bit set. To avoid loss of
data, the bit set may not have more than 64 bits.
@param aBS
The bit set to extract the value from. May not be <code>null</code>.
@return The extracted value. May be negative if the bit set has 64
elements, the highest order bit is set. | [
"Extract",
"the",
"long",
"representation",
"of",
"the",
"passed",
"bit",
"set",
".",
"To",
"avoid",
"loss",
"of",
"data",
"the",
"bit",
"set",
"may",
"not",
"have",
"more",
"than",
"64",
"bits",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/BitSetHelper.java#L142-L158 |
136,924 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/XMLFactory.java | XMLFactory.newDocument | @Nonnull
public static Document newDocument (@Nonnull final DocumentBuilder aDocBuilder, @Nullable final EXMLVersion eVersion)
{
ValueEnforcer.notNull (aDocBuilder, "DocBuilder");
final Document aDoc = aDocBuilder.newDocument ();
aDoc.setXmlVersion ((eVersion != null ? eVersion : EXMLVersion.XML_10).getVersion ());
return aDoc;
} | java | @Nonnull
public static Document newDocument (@Nonnull final DocumentBuilder aDocBuilder, @Nullable final EXMLVersion eVersion)
{
ValueEnforcer.notNull (aDocBuilder, "DocBuilder");
final Document aDoc = aDocBuilder.newDocument ();
aDoc.setXmlVersion ((eVersion != null ? eVersion : EXMLVersion.XML_10).getVersion ());
return aDoc;
} | [
"@",
"Nonnull",
"public",
"static",
"Document",
"newDocument",
"(",
"@",
"Nonnull",
"final",
"DocumentBuilder",
"aDocBuilder",
",",
"@",
"Nullable",
"final",
"EXMLVersion",
"eVersion",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aDocBuilder",
",",
"\"DocBuild... | Create a new XML document without document type using a custom document
builder.
@param aDocBuilder
The document builder to use. May not be <code>null</code>.
@param eVersion
The XML version to use. If <code>null</code> is passed,
{@link EXMLVersion#XML_10} will be used.
@return The created document. Never <code>null</code>. | [
"Create",
"a",
"new",
"XML",
"document",
"without",
"document",
"type",
"using",
"a",
"custom",
"document",
"builder",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/XMLFactory.java#L303-L311 |
136,925 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/XMLFactory.java | XMLFactory.newDocument | @Nonnull
public static Document newDocument (@Nullable final EXMLVersion eVersion,
@Nonnull final String sQualifiedName,
@Nullable final String sPublicId,
@Nullable final String sSystemId)
{
return newDocument (getDocumentBuilder (), eVersion, sQualifiedName, sPublicId, sSystemId);
} | java | @Nonnull
public static Document newDocument (@Nullable final EXMLVersion eVersion,
@Nonnull final String sQualifiedName,
@Nullable final String sPublicId,
@Nullable final String sSystemId)
{
return newDocument (getDocumentBuilder (), eVersion, sQualifiedName, sPublicId, sSystemId);
} | [
"@",
"Nonnull",
"public",
"static",
"Document",
"newDocument",
"(",
"@",
"Nullable",
"final",
"EXMLVersion",
"eVersion",
",",
"@",
"Nonnull",
"final",
"String",
"sQualifiedName",
",",
"@",
"Nullable",
"final",
"String",
"sPublicId",
",",
"@",
"Nullable",
"final"... | Create a new document with a document type using the default document
builder.
@param eVersion
The XML version to use. If <code>null</code> is passed,
{@link EXMLVersion#XML_10} will be used.
@param sQualifiedName
The qualified name to use.
@param sPublicId
The public ID of the document type.
@param sSystemId
The system ID of the document type.
@return The created document. Never <code>null</code>. | [
"Create",
"a",
"new",
"document",
"with",
"a",
"document",
"type",
"using",
"the",
"default",
"document",
"builder",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/XMLFactory.java#L348-L355 |
136,926 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/XMLFactory.java | XMLFactory.newDocument | @Nonnull
public static Document newDocument (@Nonnull final DocumentBuilder aDocBuilder,
@Nullable final EXMLVersion eVersion,
@Nonnull final String sQualifiedName,
@Nullable final String sPublicId,
@Nullable final String sSystemId)
{
ValueEnforcer.notNull (aDocBuilder, "DocBuilder");
final DOMImplementation aDomImpl = aDocBuilder.getDOMImplementation ();
final DocumentType aDocType = aDomImpl.createDocumentType (sQualifiedName, sPublicId, sSystemId);
final Document aDoc = aDomImpl.createDocument (sSystemId, sQualifiedName, aDocType);
aDoc.setXmlVersion ((eVersion != null ? eVersion : EXMLVersion.XML_10).getVersion ());
return aDoc;
} | java | @Nonnull
public static Document newDocument (@Nonnull final DocumentBuilder aDocBuilder,
@Nullable final EXMLVersion eVersion,
@Nonnull final String sQualifiedName,
@Nullable final String sPublicId,
@Nullable final String sSystemId)
{
ValueEnforcer.notNull (aDocBuilder, "DocBuilder");
final DOMImplementation aDomImpl = aDocBuilder.getDOMImplementation ();
final DocumentType aDocType = aDomImpl.createDocumentType (sQualifiedName, sPublicId, sSystemId);
final Document aDoc = aDomImpl.createDocument (sSystemId, sQualifiedName, aDocType);
aDoc.setXmlVersion ((eVersion != null ? eVersion : EXMLVersion.XML_10).getVersion ());
return aDoc;
} | [
"@",
"Nonnull",
"public",
"static",
"Document",
"newDocument",
"(",
"@",
"Nonnull",
"final",
"DocumentBuilder",
"aDocBuilder",
",",
"@",
"Nullable",
"final",
"EXMLVersion",
"eVersion",
",",
"@",
"Nonnull",
"final",
"String",
"sQualifiedName",
",",
"@",
"Nullable",... | Create a new document with a document type using a custom document builder.
@param aDocBuilder
the document builder to be used. May not be <code>null</code>.
@param eVersion
The XML version to use. If <code>null</code> is passed,
{@link EXMLVersion#XML_10} will be used.
@param sQualifiedName
The qualified name to use.
@param sPublicId
The public ID of the document type.
@param sSystemId
The system ID of the document type.
@return The created document. Never <code>null</code>. | [
"Create",
"a",
"new",
"document",
"with",
"a",
"document",
"type",
"using",
"a",
"custom",
"document",
"builder",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/XMLFactory.java#L373-L388 |
136,927 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/state/SuccessWithValue.java | SuccessWithValue.getIfSuccess | @Nullable
public DATATYPE getIfSuccess (@Nullable final DATATYPE aFailureValue)
{
return m_eSuccess.isSuccess () ? m_aObj : aFailureValue;
} | java | @Nullable
public DATATYPE getIfSuccess (@Nullable final DATATYPE aFailureValue)
{
return m_eSuccess.isSuccess () ? m_aObj : aFailureValue;
} | [
"@",
"Nullable",
"public",
"DATATYPE",
"getIfSuccess",
"(",
"@",
"Nullable",
"final",
"DATATYPE",
"aFailureValue",
")",
"{",
"return",
"m_eSuccess",
".",
"isSuccess",
"(",
")",
"?",
"m_aObj",
":",
"aFailureValue",
";",
"}"
] | Get the store value if this is a success. Otherwise the passed failure
value is returned.
@param aFailureValue
The failure value to be used. May be <code>null</code>.
@return Either the stored value or the failure value. May be
<code>null</code>. | [
"Get",
"the",
"store",
"value",
"if",
"this",
"is",
"a",
"success",
".",
"Otherwise",
"the",
"passed",
"failure",
"value",
"is",
"returned",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/state/SuccessWithValue.java#L90-L94 |
136,928 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/state/SuccessWithValue.java | SuccessWithValue.getIfFailure | @Nullable
public DATATYPE getIfFailure (@Nullable final DATATYPE aSuccessValue)
{
return m_eSuccess.isFailure () ? m_aObj : aSuccessValue;
} | java | @Nullable
public DATATYPE getIfFailure (@Nullable final DATATYPE aSuccessValue)
{
return m_eSuccess.isFailure () ? m_aObj : aSuccessValue;
} | [
"@",
"Nullable",
"public",
"DATATYPE",
"getIfFailure",
"(",
"@",
"Nullable",
"final",
"DATATYPE",
"aSuccessValue",
")",
"{",
"return",
"m_eSuccess",
".",
"isFailure",
"(",
")",
"?",
"m_aObj",
":",
"aSuccessValue",
";",
"}"
] | Get the store value if this is a failure. Otherwise the passed success
value is returned.
@param aSuccessValue
The failure value to be used. May be <code>null</code>.
@return Either the stored value or the failure value. May be
<code>null</code>. | [
"Get",
"the",
"store",
"value",
"if",
"this",
"is",
"a",
"failure",
".",
"Otherwise",
"the",
"passed",
"success",
"value",
"is",
"returned",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/state/SuccessWithValue.java#L117-L121 |
136,929 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/state/SuccessWithValue.java | SuccessWithValue.create | @Nonnull
public static <DATATYPE> SuccessWithValue <DATATYPE> create (@Nonnull final ISuccessIndicator aSuccessIndicator,
@Nullable final DATATYPE aValue)
{
return new SuccessWithValue <> (aSuccessIndicator, aValue);
} | java | @Nonnull
public static <DATATYPE> SuccessWithValue <DATATYPE> create (@Nonnull final ISuccessIndicator aSuccessIndicator,
@Nullable final DATATYPE aValue)
{
return new SuccessWithValue <> (aSuccessIndicator, aValue);
} | [
"@",
"Nonnull",
"public",
"static",
"<",
"DATATYPE",
">",
"SuccessWithValue",
"<",
"DATATYPE",
">",
"create",
"(",
"@",
"Nonnull",
"final",
"ISuccessIndicator",
"aSuccessIndicator",
",",
"@",
"Nullable",
"final",
"DATATYPE",
"aValue",
")",
"{",
"return",
"new",
... | Create a new object with the given value.
@param <DATATYPE>
The data type that is wrapped together with the success indicator
@param aSuccessIndicator
The success indicator. May not be <code>null</code>.
@param aValue
The value to be used. May be <code>null</code>.
@return Never <code>null</code>. | [
"Create",
"a",
"new",
"object",
"with",
"the",
"given",
"value",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/state/SuccessWithValue.java#L169-L174 |
136,930 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/state/SuccessWithValue.java | SuccessWithValue.createSuccess | @Nonnull
public static <DATATYPE> SuccessWithValue <DATATYPE> createSuccess (@Nullable final DATATYPE aValue)
{
return new SuccessWithValue <> (ESuccess.SUCCESS, aValue);
} | java | @Nonnull
public static <DATATYPE> SuccessWithValue <DATATYPE> createSuccess (@Nullable final DATATYPE aValue)
{
return new SuccessWithValue <> (ESuccess.SUCCESS, aValue);
} | [
"@",
"Nonnull",
"public",
"static",
"<",
"DATATYPE",
">",
"SuccessWithValue",
"<",
"DATATYPE",
">",
"createSuccess",
"(",
"@",
"Nullable",
"final",
"DATATYPE",
"aValue",
")",
"{",
"return",
"new",
"SuccessWithValue",
"<>",
"(",
"ESuccess",
".",
"SUCCESS",
",",... | Create a new success object with the given value.
@param <DATATYPE>
The data type that is wrapped together with the success indicator
@param aValue
The value to be used. May be <code>null</code>.
@return Never <code>null</code>. | [
"Create",
"a",
"new",
"success",
"object",
"with",
"the",
"given",
"value",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/state/SuccessWithValue.java#L185-L189 |
136,931 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/state/SuccessWithValue.java | SuccessWithValue.createFailure | @Nonnull
public static <DATATYPE> SuccessWithValue <DATATYPE> createFailure (@Nullable final DATATYPE aValue)
{
return new SuccessWithValue <> (ESuccess.FAILURE, aValue);
} | java | @Nonnull
public static <DATATYPE> SuccessWithValue <DATATYPE> createFailure (@Nullable final DATATYPE aValue)
{
return new SuccessWithValue <> (ESuccess.FAILURE, aValue);
} | [
"@",
"Nonnull",
"public",
"static",
"<",
"DATATYPE",
">",
"SuccessWithValue",
"<",
"DATATYPE",
">",
"createFailure",
"(",
"@",
"Nullable",
"final",
"DATATYPE",
"aValue",
")",
"{",
"return",
"new",
"SuccessWithValue",
"<>",
"(",
"ESuccess",
".",
"FAILURE",
",",... | Create a new failure object with the given value.
@param <DATATYPE>
The data type that is wrapped together with the success indicator
@param aValue
The value to be used. May be <code>null</code>.
@return Never <code>null</code>. | [
"Create",
"a",
"new",
"failure",
"object",
"with",
"the",
"given",
"value",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/state/SuccessWithValue.java#L200-L204 |
136,932 | phax/ph-commons | ph-security/src/main/java/com/helger/security/authentication/result/AuthIdentificationManager.java | AuthIdentificationManager.validateLoginCredentialsAndCreateToken | @Nonnull
public static AuthIdentificationResult validateLoginCredentialsAndCreateToken (@Nonnull final IAuthCredentials aCredentials)
{
ValueEnforcer.notNull (aCredentials, "Credentials");
// validate credentials
final ICredentialValidationResult aValidationResult = AuthCredentialValidatorManager.validateCredentials (aCredentials);
if (aValidationResult.isFailure ())
{
if (LOGGER.isWarnEnabled ())
LOGGER.warn ("Credentials have been rejected: " + aCredentials);
return AuthIdentificationResult.createFailure (aValidationResult);
}
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Credentials have been accepted: " + aCredentials);
// try to get AuthSubject from passed credentials
final IAuthSubject aSubject = AuthCredentialToSubjectResolverManager.getSubjectFromCredentials (aCredentials);
if (aSubject != null)
{
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Credentials " + aCredentials + " correspond to subject " + aSubject);
}
else
{
if (LOGGER.isErrorEnabled ())
LOGGER.error ("Failed to resolve credentials " + aCredentials + " to an auth subject!");
}
// Create the identification element
final AuthIdentification aIdentification = new AuthIdentification (aSubject);
// create the token (without expiration seconds)
final IAuthToken aNewAuthToken = AuthTokenRegistry.createToken (aIdentification,
IAuthToken.EXPIRATION_SECONDS_INFINITE);
return AuthIdentificationResult.createSuccess (aNewAuthToken);
} | java | @Nonnull
public static AuthIdentificationResult validateLoginCredentialsAndCreateToken (@Nonnull final IAuthCredentials aCredentials)
{
ValueEnforcer.notNull (aCredentials, "Credentials");
// validate credentials
final ICredentialValidationResult aValidationResult = AuthCredentialValidatorManager.validateCredentials (aCredentials);
if (aValidationResult.isFailure ())
{
if (LOGGER.isWarnEnabled ())
LOGGER.warn ("Credentials have been rejected: " + aCredentials);
return AuthIdentificationResult.createFailure (aValidationResult);
}
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Credentials have been accepted: " + aCredentials);
// try to get AuthSubject from passed credentials
final IAuthSubject aSubject = AuthCredentialToSubjectResolverManager.getSubjectFromCredentials (aCredentials);
if (aSubject != null)
{
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Credentials " + aCredentials + " correspond to subject " + aSubject);
}
else
{
if (LOGGER.isErrorEnabled ())
LOGGER.error ("Failed to resolve credentials " + aCredentials + " to an auth subject!");
}
// Create the identification element
final AuthIdentification aIdentification = new AuthIdentification (aSubject);
// create the token (without expiration seconds)
final IAuthToken aNewAuthToken = AuthTokenRegistry.createToken (aIdentification,
IAuthToken.EXPIRATION_SECONDS_INFINITE);
return AuthIdentificationResult.createSuccess (aNewAuthToken);
} | [
"@",
"Nonnull",
"public",
"static",
"AuthIdentificationResult",
"validateLoginCredentialsAndCreateToken",
"(",
"@",
"Nonnull",
"final",
"IAuthCredentials",
"aCredentials",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aCredentials",
",",
"\"Credentials\"",
")",
";",
... | Validate the login credentials, try to resolve the subject and create a
token upon success.
@param aCredentials
The credentials to validate. If <code>null</code> it is treated as
error.
@return Never <code>null</code>. | [
"Validate",
"the",
"login",
"credentials",
"try",
"to",
"resolve",
"the",
"subject",
"and",
"create",
"a",
"token",
"upon",
"success",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-security/src/main/java/com/helger/security/authentication/result/AuthIdentificationManager.java#L55-L92 |
136,933 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/util/mime/MimeTypeInfoManager.java | MimeTypeInfoManager.read | @Nonnull
public MimeTypeInfoManager read (@Nonnull final IReadableResource aRes)
{
ValueEnforcer.notNull (aRes, "Resource");
final IMicroDocument aDoc = MicroReader.readMicroXML (aRes);
if (aDoc == null)
throw new IllegalArgumentException ("Failed to read MimeTypeInfo resource " + aRes);
aDoc.getDocumentElement ().forAllChildElements (eItem -> {
final MimeTypeInfo aInfo = MicroTypeConverter.convertToNative (eItem, MimeTypeInfo.class);
registerMimeType (aInfo);
});
return this;
} | java | @Nonnull
public MimeTypeInfoManager read (@Nonnull final IReadableResource aRes)
{
ValueEnforcer.notNull (aRes, "Resource");
final IMicroDocument aDoc = MicroReader.readMicroXML (aRes);
if (aDoc == null)
throw new IllegalArgumentException ("Failed to read MimeTypeInfo resource " + aRes);
aDoc.getDocumentElement ().forAllChildElements (eItem -> {
final MimeTypeInfo aInfo = MicroTypeConverter.convertToNative (eItem, MimeTypeInfo.class);
registerMimeType (aInfo);
});
return this;
} | [
"@",
"Nonnull",
"public",
"MimeTypeInfoManager",
"read",
"(",
"@",
"Nonnull",
"final",
"IReadableResource",
"aRes",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aRes",
",",
"\"Resource\"",
")",
";",
"final",
"IMicroDocument",
"aDoc",
"=",
"MicroReader",
".",... | Read the information from the specified resource.
@param aRes
The resource to read. May not be <code>null</code>.
@return this | [
"Read",
"the",
"information",
"from",
"the",
"specified",
"resource",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/util/mime/MimeTypeInfoManager.java#L125-L139 |
136,934 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/util/mime/MimeTypeInfoManager.java | MimeTypeInfoManager.clearCache | @Nonnull
public EChange clearCache ()
{
return m_aRWLock.writeLocked ( () -> {
EChange ret = m_aList.removeAll ();
if (!m_aMapExt.isEmpty ())
{
m_aMapExt.clear ();
ret = EChange.CHANGED;
}
if (!m_aMapMimeType.isEmpty ())
{
m_aMapMimeType.clear ();
ret = EChange.CHANGED;
}
return ret;
});
} | java | @Nonnull
public EChange clearCache ()
{
return m_aRWLock.writeLocked ( () -> {
EChange ret = m_aList.removeAll ();
if (!m_aMapExt.isEmpty ())
{
m_aMapExt.clear ();
ret = EChange.CHANGED;
}
if (!m_aMapMimeType.isEmpty ())
{
m_aMapMimeType.clear ();
ret = EChange.CHANGED;
}
return ret;
});
} | [
"@",
"Nonnull",
"public",
"EChange",
"clearCache",
"(",
")",
"{",
"return",
"m_aRWLock",
".",
"writeLocked",
"(",
"(",
")",
"->",
"{",
"EChange",
"ret",
"=",
"m_aList",
".",
"removeAll",
"(",
")",
";",
"if",
"(",
"!",
"m_aMapExt",
".",
"isEmpty",
"(",
... | Remove all registered mime types
@return {@link EChange}. | [
"Remove",
"all",
"registered",
"mime",
"types"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/util/mime/MimeTypeInfoManager.java#L146-L163 |
136,935 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/util/mime/MimeTypeInfoManager.java | MimeTypeInfoManager.getAllInfosOfExtension | @Nullable
@ReturnsMutableCopy
public ICommonsList <MimeTypeInfo> getAllInfosOfExtension (@Nullable final String sExtension)
{
// Extension may be empty!
if (sExtension == null)
return null;
return m_aRWLock.readLocked ( () -> {
ICommonsList <MimeTypeInfo> ret = m_aMapExt.get (sExtension);
if (ret == null)
{
// Especially on Windows, sometimes file extensions like "JPG" can be
// found. Therefore also test for the lowercase version of the
// extension.
ret = m_aMapExt.get (sExtension.toLowerCase (Locale.US));
}
// Create a copy if present
return ret == null ? null : ret.getClone ();
});
} | java | @Nullable
@ReturnsMutableCopy
public ICommonsList <MimeTypeInfo> getAllInfosOfExtension (@Nullable final String sExtension)
{
// Extension may be empty!
if (sExtension == null)
return null;
return m_aRWLock.readLocked ( () -> {
ICommonsList <MimeTypeInfo> ret = m_aMapExt.get (sExtension);
if (ret == null)
{
// Especially on Windows, sometimes file extensions like "JPG" can be
// found. Therefore also test for the lowercase version of the
// extension.
ret = m_aMapExt.get (sExtension.toLowerCase (Locale.US));
}
// Create a copy if present
return ret == null ? null : ret.getClone ();
});
} | [
"@",
"Nullable",
"@",
"ReturnsMutableCopy",
"public",
"ICommonsList",
"<",
"MimeTypeInfo",
">",
"getAllInfosOfExtension",
"(",
"@",
"Nullable",
"final",
"String",
"sExtension",
")",
"{",
"// Extension may be empty!",
"if",
"(",
"sExtension",
"==",
"null",
")",
"retu... | Get all infos associated with the specified filename extension.
@param sExtension
The extension to search. May be <code>null</code> or empty.
@return <code>null</code> if the passed extension is <code>null</code> or
if no such extension is registered. | [
"Get",
"all",
"infos",
"associated",
"with",
"the",
"specified",
"filename",
"extension",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/util/mime/MimeTypeInfoManager.java#L272-L292 |
136,936 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/util/mime/MimeTypeInfoManager.java | MimeTypeInfoManager.getAllInfosOfMimeType | @Nullable
@ReturnsMutableCopy
public ICommonsList <MimeTypeInfo> getAllInfosOfMimeType (@Nullable final IMimeType aMimeType)
{
if (aMimeType == null)
return null;
final ICommonsList <MimeTypeInfo> ret = m_aRWLock.readLocked ( () -> m_aMapMimeType.get (aMimeType));
// Create a copy if present
return ret == null ? null : ret.getClone ();
} | java | @Nullable
@ReturnsMutableCopy
public ICommonsList <MimeTypeInfo> getAllInfosOfMimeType (@Nullable final IMimeType aMimeType)
{
if (aMimeType == null)
return null;
final ICommonsList <MimeTypeInfo> ret = m_aRWLock.readLocked ( () -> m_aMapMimeType.get (aMimeType));
// Create a copy if present
return ret == null ? null : ret.getClone ();
} | [
"@",
"Nullable",
"@",
"ReturnsMutableCopy",
"public",
"ICommonsList",
"<",
"MimeTypeInfo",
">",
"getAllInfosOfMimeType",
"(",
"@",
"Nullable",
"final",
"IMimeType",
"aMimeType",
")",
"{",
"if",
"(",
"aMimeType",
"==",
"null",
")",
"return",
"null",
";",
"final",... | Get all infos associated with the passed mime type.
@param aMimeType
The mime type to search. May be <code>null</code>.
@return <code>null</code> if a <code>null</code> mime type was passed or
the passed mime type is unknown. | [
"Get",
"all",
"infos",
"associated",
"with",
"the",
"passed",
"mime",
"type",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/util/mime/MimeTypeInfoManager.java#L302-L313 |
136,937 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/util/mime/MimeTypeInfoManager.java | MimeTypeInfoManager.containsMimeTypeForFilename | public boolean containsMimeTypeForFilename (@Nonnull @Nonempty final String sFilename)
{
ValueEnforcer.notEmpty (sFilename, "Filename");
final String sExtension = FilenameHelper.getExtension (sFilename);
return containsMimeTypeForExtension (sExtension);
} | java | public boolean containsMimeTypeForFilename (@Nonnull @Nonempty final String sFilename)
{
ValueEnforcer.notEmpty (sFilename, "Filename");
final String sExtension = FilenameHelper.getExtension (sFilename);
return containsMimeTypeForExtension (sExtension);
} | [
"public",
"boolean",
"containsMimeTypeForFilename",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sFilename",
")",
"{",
"ValueEnforcer",
".",
"notEmpty",
"(",
"sFilename",
",",
"\"Filename\"",
")",
";",
"final",
"String",
"sExtension",
"=",
"FilenameHe... | Check if any mime type is registered for the extension of the specified
filename.
@param sFilename
The filename to search. May neither be <code>null</code> nor empty.
@return <code>true</code> if at least one mime type is associated with the
extension of the passed filename, <code>false</code> otherwise. | [
"Check",
"if",
"any",
"mime",
"type",
"is",
"registered",
"for",
"the",
"extension",
"of",
"the",
"specified",
"filename",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/util/mime/MimeTypeInfoManager.java#L361-L367 |
136,938 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/util/mime/MimeTypeInfoManager.java | MimeTypeInfoManager.containsMimeTypeForExtension | public boolean containsMimeTypeForExtension (@Nonnull final String sExtension)
{
ValueEnforcer.notNull (sExtension, "Extension");
final ICommonsList <MimeTypeInfo> aInfos = getAllInfosOfExtension (sExtension);
return CollectionHelper.isNotEmpty (aInfos);
} | java | public boolean containsMimeTypeForExtension (@Nonnull final String sExtension)
{
ValueEnforcer.notNull (sExtension, "Extension");
final ICommonsList <MimeTypeInfo> aInfos = getAllInfosOfExtension (sExtension);
return CollectionHelper.isNotEmpty (aInfos);
} | [
"public",
"boolean",
"containsMimeTypeForExtension",
"(",
"@",
"Nonnull",
"final",
"String",
"sExtension",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"sExtension",
",",
"\"Extension\"",
")",
";",
"final",
"ICommonsList",
"<",
"MimeTypeInfo",
">",
"aInfos",
"=... | Check if any mime type is associated with the passed extension
@param sExtension
The filename extension to search. May not be <code>null</code>.
@return <code>true</code> if at least one mime type is associated,
<code>false</code> if no mime type is associated with the extension | [
"Check",
"if",
"any",
"mime",
"type",
"is",
"associated",
"with",
"the",
"passed",
"extension"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/util/mime/MimeTypeInfoManager.java#L451-L457 |
136,939 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/serialize/write/XMLWriterSettings.java | XMLWriterSettings.setSerializeVersion | @Nonnull
public final XMLWriterSettings setSerializeVersion (@Nonnull final EXMLSerializeVersion eSerializeVersion)
{
m_eSerializeVersion = ValueEnforcer.notNull (eSerializeVersion, "Version");
m_eXMLVersion = eSerializeVersion.getXMLVersionOrDefault (EXMLVersion.XML_10);
return this;
} | java | @Nonnull
public final XMLWriterSettings setSerializeVersion (@Nonnull final EXMLSerializeVersion eSerializeVersion)
{
m_eSerializeVersion = ValueEnforcer.notNull (eSerializeVersion, "Version");
m_eXMLVersion = eSerializeVersion.getXMLVersionOrDefault (EXMLVersion.XML_10);
return this;
} | [
"@",
"Nonnull",
"public",
"final",
"XMLWriterSettings",
"setSerializeVersion",
"(",
"@",
"Nonnull",
"final",
"EXMLSerializeVersion",
"eSerializeVersion",
")",
"{",
"m_eSerializeVersion",
"=",
"ValueEnforcer",
".",
"notNull",
"(",
"eSerializeVersion",
",",
"\"Version\"",
... | Set the preferred XML version to use.
@param eSerializeVersion
The XML serialize version. May not be <code>null</code>.
@return this | [
"Set",
"the",
"preferred",
"XML",
"version",
"to",
"use",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLWriterSettings.java#L162-L168 |
136,940 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/serialize/write/XMLWriterSettings.java | XMLWriterSettings.setSerializeXMLDeclaration | @Nonnull
public final XMLWriterSettings setSerializeXMLDeclaration (@Nonnull final EXMLSerializeXMLDeclaration eSerializeXMLDecl)
{
m_eSerializeXMLDecl = ValueEnforcer.notNull (eSerializeXMLDecl, "SerializeXMLDecl");
return this;
} | java | @Nonnull
public final XMLWriterSettings setSerializeXMLDeclaration (@Nonnull final EXMLSerializeXMLDeclaration eSerializeXMLDecl)
{
m_eSerializeXMLDecl = ValueEnforcer.notNull (eSerializeXMLDecl, "SerializeXMLDecl");
return this;
} | [
"@",
"Nonnull",
"public",
"final",
"XMLWriterSettings",
"setSerializeXMLDeclaration",
"(",
"@",
"Nonnull",
"final",
"EXMLSerializeXMLDeclaration",
"eSerializeXMLDecl",
")",
"{",
"m_eSerializeXMLDecl",
"=",
"ValueEnforcer",
".",
"notNull",
"(",
"eSerializeXMLDecl",
",",
"\... | Set the way how to handle the XML declaration.
@param eSerializeXMLDecl
XML declaration handling. May not be <code>null</code>.
@return this | [
"Set",
"the",
"way",
"how",
"to",
"handle",
"the",
"XML",
"declaration",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLWriterSettings.java#L183-L188 |
136,941 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/serialize/write/XMLWriterSettings.java | XMLWriterSettings.setSerializeDocType | @Nonnull
public final XMLWriterSettings setSerializeDocType (@Nonnull final EXMLSerializeDocType eSerializeDocType)
{
m_eSerializeDocType = ValueEnforcer.notNull (eSerializeDocType, "SerializeDocType");
return this;
} | java | @Nonnull
public final XMLWriterSettings setSerializeDocType (@Nonnull final EXMLSerializeDocType eSerializeDocType)
{
m_eSerializeDocType = ValueEnforcer.notNull (eSerializeDocType, "SerializeDocType");
return this;
} | [
"@",
"Nonnull",
"public",
"final",
"XMLWriterSettings",
"setSerializeDocType",
"(",
"@",
"Nonnull",
"final",
"EXMLSerializeDocType",
"eSerializeDocType",
")",
"{",
"m_eSerializeDocType",
"=",
"ValueEnforcer",
".",
"notNull",
"(",
"eSerializeDocType",
",",
"\"SerializeDocT... | Set the way how to handle the doc type.
@param eSerializeDocType
Doc type handling. May not be <code>null</code>.
@return this | [
"Set",
"the",
"way",
"how",
"to",
"handle",
"the",
"doc",
"type",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLWriterSettings.java#L203-L208 |
136,942 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/serialize/write/XMLWriterSettings.java | XMLWriterSettings.setSerializeComments | @Nonnull
public final XMLWriterSettings setSerializeComments (@Nonnull final EXMLSerializeComments eSerializeComments)
{
m_eSerializeComments = ValueEnforcer.notNull (eSerializeComments, "SerializeComments");
return this;
} | java | @Nonnull
public final XMLWriterSettings setSerializeComments (@Nonnull final EXMLSerializeComments eSerializeComments)
{
m_eSerializeComments = ValueEnforcer.notNull (eSerializeComments, "SerializeComments");
return this;
} | [
"@",
"Nonnull",
"public",
"final",
"XMLWriterSettings",
"setSerializeComments",
"(",
"@",
"Nonnull",
"final",
"EXMLSerializeComments",
"eSerializeComments",
")",
"{",
"m_eSerializeComments",
"=",
"ValueEnforcer",
".",
"notNull",
"(",
"eSerializeComments",
",",
"\"Serializ... | Set the way how comments should be handled.
@param eSerializeComments
The comment handling. May not be <code>null</code>.
@return this | [
"Set",
"the",
"way",
"how",
"comments",
"should",
"be",
"handled",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLWriterSettings.java#L223-L228 |
136,943 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/serialize/write/XMLWriterSettings.java | XMLWriterSettings.setIncorrectCharacterHandling | @Nonnull
public final XMLWriterSettings setIncorrectCharacterHandling (@Nonnull final EXMLIncorrectCharacterHandling eIncorrectCharacterHandling)
{
m_eIncorrectCharacterHandling = ValueEnforcer.notNull (eIncorrectCharacterHandling, "IncorrectCharacterHandling");
return this;
} | java | @Nonnull
public final XMLWriterSettings setIncorrectCharacterHandling (@Nonnull final EXMLIncorrectCharacterHandling eIncorrectCharacterHandling)
{
m_eIncorrectCharacterHandling = ValueEnforcer.notNull (eIncorrectCharacterHandling, "IncorrectCharacterHandling");
return this;
} | [
"@",
"Nonnull",
"public",
"final",
"XMLWriterSettings",
"setIncorrectCharacterHandling",
"(",
"@",
"Nonnull",
"final",
"EXMLIncorrectCharacterHandling",
"eIncorrectCharacterHandling",
")",
"{",
"m_eIncorrectCharacterHandling",
"=",
"ValueEnforcer",
".",
"notNull",
"(",
"eInco... | Set the way how to handle invalid characters.
@param eIncorrectCharacterHandling
The invalid character handling. May not be <code>null</code>.
@return this | [
"Set",
"the",
"way",
"how",
"to",
"handle",
"invalid",
"characters",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLWriterSettings.java#L283-L288 |
136,944 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/serialize/write/XMLWriterSettings.java | XMLWriterSettings.setCharset | @Nonnull
public final XMLWriterSettings setCharset (@Nonnull final Charset aCharset)
{
m_aCharset = ValueEnforcer.notNull (aCharset, "Charset");
return this;
} | java | @Nonnull
public final XMLWriterSettings setCharset (@Nonnull final Charset aCharset)
{
m_aCharset = ValueEnforcer.notNull (aCharset, "Charset");
return this;
} | [
"@",
"Nonnull",
"public",
"final",
"XMLWriterSettings",
"setCharset",
"(",
"@",
"Nonnull",
"final",
"Charset",
"aCharset",
")",
"{",
"m_aCharset",
"=",
"ValueEnforcer",
".",
"notNull",
"(",
"aCharset",
",",
"\"Charset\"",
")",
";",
"return",
"this",
";",
"}"
] | Set the serialization charset.
@param aCharset
The charset to be used. May not be <code>null</code>.
@return this | [
"Set",
"the",
"serialization",
"charset",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLWriterSettings.java#L303-L308 |
136,945 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/serialize/write/XMLWriterSettings.java | XMLWriterSettings.setNamespaceContext | @Nonnull
public final XMLWriterSettings setNamespaceContext (@Nullable final INamespaceContext aNamespaceContext)
{
// A namespace context must always be present, to resolve default namespaces
m_aNamespaceContext = aNamespaceContext != null ? aNamespaceContext : new MapBasedNamespaceContext ();
return this;
} | java | @Nonnull
public final XMLWriterSettings setNamespaceContext (@Nullable final INamespaceContext aNamespaceContext)
{
// A namespace context must always be present, to resolve default namespaces
m_aNamespaceContext = aNamespaceContext != null ? aNamespaceContext : new MapBasedNamespaceContext ();
return this;
} | [
"@",
"Nonnull",
"public",
"final",
"XMLWriterSettings",
"setNamespaceContext",
"(",
"@",
"Nullable",
"final",
"INamespaceContext",
"aNamespaceContext",
")",
"{",
"// A namespace context must always be present, to resolve default namespaces",
"m_aNamespaceContext",
"=",
"aNamespaceC... | Set the namespace context to be used.
@param aNamespaceContext
The namespace context to be used. May be <code>null</code>.
@return this | [
"Set",
"the",
"namespace",
"context",
"to",
"be",
"used",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLWriterSettings.java#L323-L329 |
136,946 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringParser.java | StringParser._getUnifiedDecimal | @Nonnull
@Nonempty
private static String _getUnifiedDecimal (@Nonnull @Nonempty final String sStr)
{
return StringHelper.replaceAll (sStr, ',', '.');
} | java | @Nonnull
@Nonempty
private static String _getUnifiedDecimal (@Nonnull @Nonempty final String sStr)
{
return StringHelper.replaceAll (sStr, ',', '.');
} | [
"@",
"Nonnull",
"@",
"Nonempty",
"private",
"static",
"String",
"_getUnifiedDecimal",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sStr",
")",
"{",
"return",
"StringHelper",
".",
"replaceAll",
"(",
"sStr",
",",
"'",
"'",
",",
"'",
"'",
")",
... | Get the unified decimal string for parsing by the runtime library. This is
done by replacing ',' with '.'.
@param sStr
The string to unified. Never <code>null</code>.
@return Never <code>null</code>. | [
"Get",
"the",
"unified",
"decimal",
"string",
"for",
"parsing",
"by",
"the",
"runtime",
"library",
".",
"This",
"is",
"done",
"by",
"replacing",
"with",
".",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L58-L63 |
136,947 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringParser.java | StringParser.isDouble | public static boolean isDouble (@Nullable final String sStr)
{
return !Double.isNaN (parseDouble (sStr, Double.NaN));
} | java | public static boolean isDouble (@Nullable final String sStr)
{
return !Double.isNaN (parseDouble (sStr, Double.NaN));
} | [
"public",
"static",
"boolean",
"isDouble",
"(",
"@",
"Nullable",
"final",
"String",
"sStr",
")",
"{",
"return",
"!",
"Double",
".",
"isNaN",
"(",
"parseDouble",
"(",
"sStr",
",",
"Double",
".",
"NaN",
")",
")",
";",
"}"
] | Checks if the given string is a double string that can be converted to a
double value.
@param sStr
The string to check. May be <code>null</code>.
@return <code>true</code> if the value can be converted to a valid value | [
"Checks",
"if",
"the",
"given",
"string",
"is",
"a",
"double",
"string",
"that",
"can",
"be",
"converted",
"to",
"a",
"double",
"value",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L1657-L1660 |
136,948 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringParser.java | StringParser.isFloat | public static boolean isFloat (@Nullable final String sStr)
{
return !Float.isNaN (parseFloat (sStr, Float.NaN));
} | java | public static boolean isFloat (@Nullable final String sStr)
{
return !Float.isNaN (parseFloat (sStr, Float.NaN));
} | [
"public",
"static",
"boolean",
"isFloat",
"(",
"@",
"Nullable",
"final",
"String",
"sStr",
")",
"{",
"return",
"!",
"Float",
".",
"isNaN",
"(",
"parseFloat",
"(",
"sStr",
",",
"Float",
".",
"NaN",
")",
")",
";",
"}"
] | Checks if the given string is a float string that can be converted to a
double value.
@param sStr
The string to check. May be <code>null</code>.
@return <code>true</code> if the value can be converted to a valid value | [
"Checks",
"if",
"the",
"given",
"string",
"is",
"a",
"float",
"string",
"that",
"can",
"be",
"converted",
"to",
"a",
"double",
"value",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L1670-L1673 |
136,949 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/equals/EqualsHelper.java | EqualsHelper.identityEqual | public static <T> boolean identityEqual (@Nullable final T aObj1, @Nullable final T aObj2)
{
return aObj1 == aObj2;
} | java | public static <T> boolean identityEqual (@Nullable final T aObj1, @Nullable final T aObj2)
{
return aObj1 == aObj2;
} | [
"public",
"static",
"<",
"T",
">",
"boolean",
"identityEqual",
"(",
"@",
"Nullable",
"final",
"T",
"aObj1",
",",
"@",
"Nullable",
"final",
"T",
"aObj2",
")",
"{",
"return",
"aObj1",
"==",
"aObj2",
";",
"}"
] | The only place where objects are compared by identity.
@param aObj1
First object. May be <code>null</code>.
@param aObj2
Second object. May be <code>null</code>.
@return <code>true</code> if both objects are <code>null</code> or
reference the same object.
@param <T>
Type to check. | [
"The",
"only",
"place",
"where",
"objects",
"are",
"compared",
"by",
"identity",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/equals/EqualsHelper.java#L64-L67 |
136,950 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/csv/CSVIterator.java | CSVIterator.next | @Nonnull
public ICommonsList <String> next ()
{
final ICommonsList <String> ret = m_aNextLine;
if (ret == null)
throw new NoSuchElementException ();
try
{
m_aNextLine = m_aReader.readNext ();
}
catch (final IOException ex)
{
throw new IllegalStateException ("Failed to read next CSV line", ex);
}
return ret;
} | java | @Nonnull
public ICommonsList <String> next ()
{
final ICommonsList <String> ret = m_aNextLine;
if (ret == null)
throw new NoSuchElementException ();
try
{
m_aNextLine = m_aReader.readNext ();
}
catch (final IOException ex)
{
throw new IllegalStateException ("Failed to read next CSV line", ex);
}
return ret;
} | [
"@",
"Nonnull",
"public",
"ICommonsList",
"<",
"String",
">",
"next",
"(",
")",
"{",
"final",
"ICommonsList",
"<",
"String",
">",
"ret",
"=",
"m_aNextLine",
";",
"if",
"(",
"ret",
"==",
"null",
")",
"throw",
"new",
"NoSuchElementException",
"(",
")",
";"... | Returns the next element in the iterator.
@return The next element of the iterator. Never <code>null</code>. | [
"Returns",
"the",
"next",
"element",
"in",
"the",
"iterator",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/csv/CSVIterator.java#L69-L85 |
136,951 | phax/ph-commons | ph-tree/src/main/java/com/helger/tree/xml/TreeXMLConverter.java | TreeXMLConverter.getTreeWithStringIDAsXML | @Nonnull
public static <DATATYPE, ITEMTYPE extends ITreeItemWithID <String, DATATYPE, ITEMTYPE>> IMicroElement getTreeWithStringIDAsXML (@Nonnull final IBasicTree <DATATYPE, ITEMTYPE> aTree,
@Nonnull final IConverterTreeItemToMicroNode <? super DATATYPE> aConverter)
{
return getTreeWithIDAsXML (aTree, IHasID.getComparatorID (), x -> x, aConverter);
} | java | @Nonnull
public static <DATATYPE, ITEMTYPE extends ITreeItemWithID <String, DATATYPE, ITEMTYPE>> IMicroElement getTreeWithStringIDAsXML (@Nonnull final IBasicTree <DATATYPE, ITEMTYPE> aTree,
@Nonnull final IConverterTreeItemToMicroNode <? super DATATYPE> aConverter)
{
return getTreeWithIDAsXML (aTree, IHasID.getComparatorID (), x -> x, aConverter);
} | [
"@",
"Nonnull",
"public",
"static",
"<",
"DATATYPE",
",",
"ITEMTYPE",
"extends",
"ITreeItemWithID",
"<",
"String",
",",
"DATATYPE",
",",
"ITEMTYPE",
">",
">",
"IMicroElement",
"getTreeWithStringIDAsXML",
"(",
"@",
"Nonnull",
"final",
"IBasicTree",
"<",
"DATATYPE",... | Specialized conversion method for converting a tree with ID to a
standardized XML tree.
@param <DATATYPE>
tree item value type
@param <ITEMTYPE>
tree item type
@param aTree
The tree to be converted
@param aConverter
The main data converter that converts the tree item values into XML
@return The created document. | [
"Specialized",
"conversion",
"method",
"for",
"converting",
"a",
"tree",
"with",
"ID",
"to",
"a",
"standardized",
"XML",
"tree",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-tree/src/main/java/com/helger/tree/xml/TreeXMLConverter.java#L77-L82 |
136,952 | phax/ph-commons | ph-jaxb/src/main/java/com/helger/jaxb/validation/CollectingValidationEventHandler.java | CollectingValidationEventHandler.forEachResourceError | public void forEachResourceError (@Nonnull final Consumer <? super IError> aConsumer)
{
ValueEnforcer.notNull (aConsumer, "Consumer");
m_aRWLock.readLocked ( () -> m_aErrors.forEach (aConsumer));
} | java | public void forEachResourceError (@Nonnull final Consumer <? super IError> aConsumer)
{
ValueEnforcer.notNull (aConsumer, "Consumer");
m_aRWLock.readLocked ( () -> m_aErrors.forEach (aConsumer));
} | [
"public",
"void",
"forEachResourceError",
"(",
"@",
"Nonnull",
"final",
"Consumer",
"<",
"?",
"super",
"IError",
">",
"aConsumer",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aConsumer",
",",
"\"Consumer\"",
")",
";",
"m_aRWLock",
".",
"readLocked",
"(",
... | Call the provided consumer for all contained resource errors.
@param aConsumer
The consumer to be invoked. May not be <code>null</code>. May only
perform reading actions! | [
"Call",
"the",
"provided",
"consumer",
"for",
"all",
"contained",
"resource",
"errors",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-jaxb/src/main/java/com/helger/jaxb/validation/CollectingValidationEventHandler.java#L71-L75 |
136,953 | phax/ph-commons | ph-dao/src/main/java/com/helger/dao/wal/AbstractMapBasedWALDAO.java | AbstractMapBasedWALDAO._addItem | @MustBeLocked (ELockType.WRITE)
private void _addItem (@Nonnull final IMPLTYPE aItem, @Nonnull final EDAOActionType eActionType)
{
ValueEnforcer.notNull (aItem, "Item");
ValueEnforcer.isTrue (eActionType == EDAOActionType.CREATE || eActionType == EDAOActionType.UPDATE,
"Invalid action type provided!");
final String sID = aItem.getID ();
final IMPLTYPE aOldItem = m_aMap.get (sID);
if (eActionType == EDAOActionType.CREATE)
{
if (aOldItem != null)
throw new IllegalArgumentException (ClassHelper.getClassLocalName (getDataTypeClass ()) +
" with ID '" +
sID +
"' is already in use and can therefore not be created again. Old item = " +
aOldItem +
"; New item = " +
aItem);
}
else
{
// Update
if (aOldItem == null)
throw new IllegalArgumentException (ClassHelper.getClassLocalName (getDataTypeClass ()) +
" with ID '" +
sID +
"' is not yet in use and can therefore not be updated! Updated item = " +
aItem);
}
m_aMap.put (sID, aItem);
} | java | @MustBeLocked (ELockType.WRITE)
private void _addItem (@Nonnull final IMPLTYPE aItem, @Nonnull final EDAOActionType eActionType)
{
ValueEnforcer.notNull (aItem, "Item");
ValueEnforcer.isTrue (eActionType == EDAOActionType.CREATE || eActionType == EDAOActionType.UPDATE,
"Invalid action type provided!");
final String sID = aItem.getID ();
final IMPLTYPE aOldItem = m_aMap.get (sID);
if (eActionType == EDAOActionType.CREATE)
{
if (aOldItem != null)
throw new IllegalArgumentException (ClassHelper.getClassLocalName (getDataTypeClass ()) +
" with ID '" +
sID +
"' is already in use and can therefore not be created again. Old item = " +
aOldItem +
"; New item = " +
aItem);
}
else
{
// Update
if (aOldItem == null)
throw new IllegalArgumentException (ClassHelper.getClassLocalName (getDataTypeClass ()) +
" with ID '" +
sID +
"' is not yet in use and can therefore not be updated! Updated item = " +
aItem);
}
m_aMap.put (sID, aItem);
} | [
"@",
"MustBeLocked",
"(",
"ELockType",
".",
"WRITE",
")",
"private",
"void",
"_addItem",
"(",
"@",
"Nonnull",
"final",
"IMPLTYPE",
"aItem",
",",
"@",
"Nonnull",
"final",
"EDAOActionType",
"eActionType",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aItem",
... | Add or update an item. Must only be invoked inside a write-lock.
@param aItem
The item to be added or updated
@param eActionType
The action type. Must be CREATE or UPDATE!
@throws IllegalArgumentException
If on CREATE an item with the same ID is already contained. If on
UPDATE an item with the provided ID does NOT exist. | [
"Add",
"or",
"update",
"an",
"item",
".",
"Must",
"only",
"be",
"invoked",
"inside",
"a",
"write",
"-",
"lock",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-dao/src/main/java/com/helger/dao/wal/AbstractMapBasedWALDAO.java#L240-L272 |
136,954 | phax/ph-commons | ph-dao/src/main/java/com/helger/dao/wal/AbstractMapBasedWALDAO.java | AbstractMapBasedWALDAO.getOfID | @Nullable
@IsLocked (ELockType.READ)
protected final IMPLTYPE getOfID (@Nullable final String sID)
{
if (StringHelper.hasNoText (sID))
return null;
return m_aRWLock.readLocked ( () -> m_aMap.get (sID));
} | java | @Nullable
@IsLocked (ELockType.READ)
protected final IMPLTYPE getOfID (@Nullable final String sID)
{
if (StringHelper.hasNoText (sID))
return null;
return m_aRWLock.readLocked ( () -> m_aMap.get (sID));
} | [
"@",
"Nullable",
"@",
"IsLocked",
"(",
"ELockType",
".",
"READ",
")",
"protected",
"final",
"IMPLTYPE",
"getOfID",
"(",
"@",
"Nullable",
"final",
"String",
"sID",
")",
"{",
"if",
"(",
"StringHelper",
".",
"hasNoText",
"(",
"sID",
")",
")",
"return",
"nul... | Find the element with the provided ID. Locking is done internally.
@param sID
The ID to search. May be <code>null</code>.
@return <code>null</code> if no such item exists | [
"Find",
"the",
"element",
"with",
"the",
"provided",
"ID",
".",
"Locking",
"is",
"done",
"internally",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-dao/src/main/java/com/helger/dao/wal/AbstractMapBasedWALDAO.java#L722-L730 |
136,955 | phax/ph-commons | ph-dao/src/main/java/com/helger/dao/wal/AbstractMapBasedWALDAO.java | AbstractMapBasedWALDAO.getAtIndex | @Nullable
@IsLocked (ELockType.READ)
protected final INTERFACETYPE getAtIndex (@Nonnegative final int nIndex)
{
return m_aRWLock.readLocked ( () -> CollectionHelper.getAtIndex (m_aMap.values (), nIndex));
} | java | @Nullable
@IsLocked (ELockType.READ)
protected final INTERFACETYPE getAtIndex (@Nonnegative final int nIndex)
{
return m_aRWLock.readLocked ( () -> CollectionHelper.getAtIndex (m_aMap.values (), nIndex));
} | [
"@",
"Nullable",
"@",
"IsLocked",
"(",
"ELockType",
".",
"READ",
")",
"protected",
"final",
"INTERFACETYPE",
"getAtIndex",
"(",
"@",
"Nonnegative",
"final",
"int",
"nIndex",
")",
"{",
"return",
"m_aRWLock",
".",
"readLocked",
"(",
"(",
")",
"->",
"Collection... | Get the item at the specified index. This method only returns defined
results if an ordered map is used for data storage.
@param nIndex
The index to retrieve. Should be ≥ 0.
@return <code>null</code> if an invalid index was provided. | [
"Get",
"the",
"item",
"at",
"the",
"specified",
"index",
".",
"This",
"method",
"only",
"returns",
"defined",
"results",
"if",
"an",
"ordered",
"map",
"is",
"used",
"for",
"data",
"storage",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-dao/src/main/java/com/helger/dao/wal/AbstractMapBasedWALDAO.java#L740-L745 |
136,956 | phax/ph-commons | ph-datetime/src/main/java/com/helger/datetime/util/PDTHelper.java | PDTHelper.getWeekDays | public static int getWeekDays (@Nonnull final LocalDate aStartDate, @Nonnull final LocalDate aEndDate)
{
ValueEnforcer.notNull (aStartDate, "StartDate");
ValueEnforcer.notNull (aEndDate, "EndDate");
final boolean bFlip = aStartDate.isAfter (aEndDate);
LocalDate aCurDate = bFlip ? aEndDate : aStartDate;
final LocalDate aRealEndDate = bFlip ? aStartDate : aEndDate;
int ret = 0;
while (!aRealEndDate.isBefore (aCurDate))
{
if (!isWeekend (aCurDate))
ret++;
aCurDate = aCurDate.plusDays (1);
}
return bFlip ? -1 * ret : ret;
} | java | public static int getWeekDays (@Nonnull final LocalDate aStartDate, @Nonnull final LocalDate aEndDate)
{
ValueEnforcer.notNull (aStartDate, "StartDate");
ValueEnforcer.notNull (aEndDate, "EndDate");
final boolean bFlip = aStartDate.isAfter (aEndDate);
LocalDate aCurDate = bFlip ? aEndDate : aStartDate;
final LocalDate aRealEndDate = bFlip ? aStartDate : aEndDate;
int ret = 0;
while (!aRealEndDate.isBefore (aCurDate))
{
if (!isWeekend (aCurDate))
ret++;
aCurDate = aCurDate.plusDays (1);
}
return bFlip ? -1 * ret : ret;
} | [
"public",
"static",
"int",
"getWeekDays",
"(",
"@",
"Nonnull",
"final",
"LocalDate",
"aStartDate",
",",
"@",
"Nonnull",
"final",
"LocalDate",
"aEndDate",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aStartDate",
",",
"\"StartDate\"",
")",
";",
"ValueEnforcer... | Count all non-weekend days in the range. Does not consider holidays!
@param aStartDate
start date
@param aEndDate
end date
@return days not counting Saturdays and Sundays. If start date is after end
date, the value will be negative! If start date equals end date the
return will be 1 if it is a week day. | [
"Count",
"all",
"non",
"-",
"weekend",
"days",
"in",
"the",
"range",
".",
"Does",
"not",
"consider",
"holidays!"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-datetime/src/main/java/com/helger/datetime/util/PDTHelper.java#L148-L165 |
136,957 | phax/ph-commons | ph-datetime/src/main/java/com/helger/datetime/util/PDTHelper.java | PDTHelper.getEndWeekOfMonth | public static int getEndWeekOfMonth (@Nonnull final LocalDateTime aDT, @Nonnull final Locale aLocale)
{
return getWeekOfWeekBasedYear (aDT.plusMonths (1).withDayOfMonth (1).minusDays (1), aLocale);
} | java | public static int getEndWeekOfMonth (@Nonnull final LocalDateTime aDT, @Nonnull final Locale aLocale)
{
return getWeekOfWeekBasedYear (aDT.plusMonths (1).withDayOfMonth (1).minusDays (1), aLocale);
} | [
"public",
"static",
"int",
"getEndWeekOfMonth",
"(",
"@",
"Nonnull",
"final",
"LocalDateTime",
"aDT",
",",
"@",
"Nonnull",
"final",
"Locale",
"aLocale",
")",
"{",
"return",
"getWeekOfWeekBasedYear",
"(",
"aDT",
".",
"plusMonths",
"(",
"1",
")",
".",
"withDayOf... | Get the end-week number for the passed year and month.
@param aDT
The object to use year and month from.
@param aLocale
Locale to use. May not be <code>null</code>.
@return The end week number. | [
"Get",
"the",
"end",
"-",
"week",
"number",
"for",
"the",
"passed",
"year",
"and",
"month",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-datetime/src/main/java/com/helger/datetime/util/PDTHelper.java#L231-L234 |
136,958 | phax/ph-commons | ph-datetime/src/main/java/com/helger/datetime/util/PDTHelper.java | PDTHelper.birthdayEquals | public static boolean birthdayEquals (@Nullable final LocalDate aDate1, @Nullable final LocalDate aDate2)
{
return birthdayCompare (aDate1, aDate2) == 0;
} | java | public static boolean birthdayEquals (@Nullable final LocalDate aDate1, @Nullable final LocalDate aDate2)
{
return birthdayCompare (aDate1, aDate2) == 0;
} | [
"public",
"static",
"boolean",
"birthdayEquals",
"(",
"@",
"Nullable",
"final",
"LocalDate",
"aDate1",
",",
"@",
"Nullable",
"final",
"LocalDate",
"aDate2",
")",
"{",
"return",
"birthdayCompare",
"(",
"aDate1",
",",
"aDate2",
")",
"==",
"0",
";",
"}"
] | Check if the two birthdays are equal. Equal birthdays are identified by
equal months and equal days.
@param aDate1
First date. May be <code>null</code>.
@param aDate2
Second date. May be <code>null</code>.
@return <code>true</code> if month and day are equal | [
"Check",
"if",
"the",
"two",
"birthdays",
"are",
"equal",
".",
"Equal",
"birthdays",
"are",
"identified",
"by",
"equal",
"months",
"and",
"equal",
"days",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-datetime/src/main/java/com/helger/datetime/util/PDTHelper.java#L310-L313 |
136,959 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java | ClassHelper.isInstancableClass | public static boolean isInstancableClass (@Nullable final Class <?> aClass)
{
if (!isPublicClass (aClass))
return false;
// Check if a default constructor is present
try
{
aClass.getConstructor ((Class <?> []) null);
}
catch (final NoSuchMethodException ex)
{
return false;
}
return true;
} | java | public static boolean isInstancableClass (@Nullable final Class <?> aClass)
{
if (!isPublicClass (aClass))
return false;
// Check if a default constructor is present
try
{
aClass.getConstructor ((Class <?> []) null);
}
catch (final NoSuchMethodException ex)
{
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"isInstancableClass",
"(",
"@",
"Nullable",
"final",
"Class",
"<",
"?",
">",
"aClass",
")",
"{",
"if",
"(",
"!",
"isPublicClass",
"(",
"aClass",
")",
")",
"return",
"false",
";",
"// Check if a default constructor is present",
"try... | Check if the passed class is public, instancable and has a no-argument
constructor.
@param aClass
The class to check. May be <code>null</code>.
@return <code>true</code> if the class is public, instancable and has a
no-argument constructor that is public. | [
"Check",
"if",
"the",
"passed",
"class",
"is",
"public",
"instancable",
"and",
"has",
"a",
"no",
"-",
"argument",
"constructor",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java#L105-L120 |
136,960 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java | ClassHelper.isInterface | public static boolean isInterface (@Nullable final Class <?> aClass)
{
return aClass != null && Modifier.isInterface (aClass.getModifiers ());
} | java | public static boolean isInterface (@Nullable final Class <?> aClass)
{
return aClass != null && Modifier.isInterface (aClass.getModifiers ());
} | [
"public",
"static",
"boolean",
"isInterface",
"(",
"@",
"Nullable",
"final",
"Class",
"<",
"?",
">",
"aClass",
")",
"{",
"return",
"aClass",
"!=",
"null",
"&&",
"Modifier",
".",
"isInterface",
"(",
"aClass",
".",
"getModifiers",
"(",
")",
")",
";",
"}"
] | Check if the passed class is an interface or not. Please note that
annotations are also interfaces!
@param aClass
The class to check.
@return <code>true</code> if the class is an interface (or an annotation) | [
"Check",
"if",
"the",
"passed",
"class",
"is",
"an",
"interface",
"or",
"not",
".",
"Please",
"note",
"that",
"annotations",
"are",
"also",
"interfaces!"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java#L135-L138 |
136,961 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java | ClassHelper.getPrimitiveWrapperClass | @Nullable
public static Class <?> getPrimitiveWrapperClass (@Nullable final Class <?> aClass)
{
if (isPrimitiveWrapperType (aClass))
return aClass;
return PRIMITIVE_TO_WRAPPER.get (aClass);
} | java | @Nullable
public static Class <?> getPrimitiveWrapperClass (@Nullable final Class <?> aClass)
{
if (isPrimitiveWrapperType (aClass))
return aClass;
return PRIMITIVE_TO_WRAPPER.get (aClass);
} | [
"@",
"Nullable",
"public",
"static",
"Class",
"<",
"?",
">",
"getPrimitiveWrapperClass",
"(",
"@",
"Nullable",
"final",
"Class",
"<",
"?",
">",
"aClass",
")",
"{",
"if",
"(",
"isPrimitiveWrapperType",
"(",
"aClass",
")",
")",
"return",
"aClass",
";",
"retu... | Get the primitive wrapper class of the passed primitive class.
@param aClass
The primitive class. May be <code>null</code>.
@return <code>null</code> if the passed class is not a primitive class. | [
"Get",
"the",
"primitive",
"wrapper",
"class",
"of",
"the",
"passed",
"primitive",
"class",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java#L188-L194 |
136,962 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java | ClassHelper.getPrimitiveClass | @Nullable
public static Class <?> getPrimitiveClass (@Nullable final Class <?> aClass)
{
if (isPrimitiveType (aClass))
return aClass;
return WRAPPER_TO_PRIMITIVE.get (aClass);
} | java | @Nullable
public static Class <?> getPrimitiveClass (@Nullable final Class <?> aClass)
{
if (isPrimitiveType (aClass))
return aClass;
return WRAPPER_TO_PRIMITIVE.get (aClass);
} | [
"@",
"Nullable",
"public",
"static",
"Class",
"<",
"?",
">",
"getPrimitiveClass",
"(",
"@",
"Nullable",
"final",
"Class",
"<",
"?",
">",
"aClass",
")",
"{",
"if",
"(",
"isPrimitiveType",
"(",
"aClass",
")",
")",
"return",
"aClass",
";",
"return",
"WRAPPE... | Get the primitive class of the passed primitive wrapper class.
@param aClass
The primitive wrapper class. May be <code>null</code>.
@return <code>null</code> if the passed class is not a primitive wrapper
class. | [
"Get",
"the",
"primitive",
"class",
"of",
"the",
"passed",
"primitive",
"wrapper",
"class",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java#L204-L210 |
136,963 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java | ClassHelper.areConvertibleClasses | public static boolean areConvertibleClasses (@Nonnull final Class <?> aSrcClass, @Nonnull final Class <?> aDstClass)
{
ValueEnforcer.notNull (aSrcClass, "SrcClass");
ValueEnforcer.notNull (aDstClass, "DstClass");
// Same class?
if (aDstClass.equals (aSrcClass))
return true;
// Default assignable
if (aDstClass.isAssignableFrom (aSrcClass))
return true;
// Special handling for "int.class" == "Integer.class" etc.
if (aDstClass == getPrimitiveWrapperClass (aSrcClass))
return true;
if (aDstClass == getPrimitiveClass (aSrcClass))
return true;
// Not convertible
return false;
} | java | public static boolean areConvertibleClasses (@Nonnull final Class <?> aSrcClass, @Nonnull final Class <?> aDstClass)
{
ValueEnforcer.notNull (aSrcClass, "SrcClass");
ValueEnforcer.notNull (aDstClass, "DstClass");
// Same class?
if (aDstClass.equals (aSrcClass))
return true;
// Default assignable
if (aDstClass.isAssignableFrom (aSrcClass))
return true;
// Special handling for "int.class" == "Integer.class" etc.
if (aDstClass == getPrimitiveWrapperClass (aSrcClass))
return true;
if (aDstClass == getPrimitiveClass (aSrcClass))
return true;
// Not convertible
return false;
} | [
"public",
"static",
"boolean",
"areConvertibleClasses",
"(",
"@",
"Nonnull",
"final",
"Class",
"<",
"?",
">",
"aSrcClass",
",",
"@",
"Nonnull",
"final",
"Class",
"<",
"?",
">",
"aDstClass",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aSrcClass",
",",
... | Check if the passed classes are convertible. Includes conversion checks
between primitive types and primitive wrapper types.
@param aSrcClass
First class. May not be <code>null</code>.
@param aDstClass
Second class. May not be <code>null</code>.
@return <code>true</code> if the classes are directly convertible. | [
"Check",
"if",
"the",
"passed",
"classes",
"are",
"convertible",
".",
"Includes",
"conversion",
"checks",
"between",
"primitive",
"types",
"and",
"primitive",
"wrapper",
"types",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java#L284-L305 |
136,964 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java | ClassHelper.getClassLocalName | @Nullable
public static String getClassLocalName (@Nullable final Object aObject)
{
return aObject == null ? null : getClassLocalName (aObject.getClass ());
} | java | @Nullable
public static String getClassLocalName (@Nullable final Object aObject)
{
return aObject == null ? null : getClassLocalName (aObject.getClass ());
} | [
"@",
"Nullable",
"public",
"static",
"String",
"getClassLocalName",
"(",
"@",
"Nullable",
"final",
"Object",
"aObject",
")",
"{",
"return",
"aObject",
"==",
"null",
"?",
"null",
":",
"getClassLocalName",
"(",
"aObject",
".",
"getClass",
"(",
")",
")",
";",
... | Get the name of the object's class without the package.
@param aObject
The object to get the information from. May be <code>null</code> .
@return The local name of the passed object's class. | [
"Get",
"the",
"name",
"of",
"the",
"object",
"s",
"class",
"without",
"the",
"package",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java#L341-L345 |
136,965 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java | ClassHelper.getClassPackageName | @Nullable
public static String getClassPackageName (@Nullable final Object aObject)
{
return aObject == null ? null : getClassPackageName (aObject.getClass ());
} | java | @Nullable
public static String getClassPackageName (@Nullable final Object aObject)
{
return aObject == null ? null : getClassPackageName (aObject.getClass ());
} | [
"@",
"Nullable",
"public",
"static",
"String",
"getClassPackageName",
"(",
"@",
"Nullable",
"final",
"Object",
"aObject",
")",
"{",
"return",
"aObject",
"==",
"null",
"?",
"null",
":",
"getClassPackageName",
"(",
"aObject",
".",
"getClass",
"(",
")",
")",
";... | Get the name of the package the passed object resides in.
@param aObject
The class to get the information from. May be <code>null</code>.
@return The package name of the passed object. | [
"Get",
"the",
"name",
"of",
"the",
"package",
"the",
"passed",
"object",
"resides",
"in",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java#L384-L388 |
136,966 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java | ClassHelper.getDirectoryFromPackage | @Nullable
public static String getDirectoryFromPackage (@Nullable final Package aPackage)
{
// No differentiation
return aPackage == null ? null : getPathFromClass (aPackage.getName ());
} | java | @Nullable
public static String getDirectoryFromPackage (@Nullable final Package aPackage)
{
// No differentiation
return aPackage == null ? null : getPathFromClass (aPackage.getName ());
} | [
"@",
"Nullable",
"public",
"static",
"String",
"getDirectoryFromPackage",
"(",
"@",
"Nullable",
"final",
"Package",
"aPackage",
")",
"{",
"// No differentiation",
"return",
"aPackage",
"==",
"null",
"?",
"null",
":",
"getPathFromClass",
"(",
"aPackage",
".",
"getN... | Convert a package name to a relative directory name.
@param aPackage
The package to be converted. May be <code>null</code>.
@return The directory name using forward slashes (/) instead of the dots. | [
"Convert",
"a",
"package",
"name",
"to",
"a",
"relative",
"directory",
"name",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java#L447-L452 |
136,967 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java | ClassHelper.getObjectAddress | @Nonnull
@Nonempty
public static String getObjectAddress (@Nullable final Object aObject)
{
if (aObject == null)
return "0x00000000";
return "0x" + StringHelper.getHexStringLeadingZero (System.identityHashCode (aObject), 8);
} | java | @Nonnull
@Nonempty
public static String getObjectAddress (@Nullable final Object aObject)
{
if (aObject == null)
return "0x00000000";
return "0x" + StringHelper.getHexStringLeadingZero (System.identityHashCode (aObject), 8);
} | [
"@",
"Nonnull",
"@",
"Nonempty",
"public",
"static",
"String",
"getObjectAddress",
"(",
"@",
"Nullable",
"final",
"Object",
"aObject",
")",
"{",
"if",
"(",
"aObject",
"==",
"null",
")",
"return",
"\"0x00000000\"",
";",
"return",
"\"0x\"",
"+",
"StringHelper",
... | Get the hex representation of the passed object's address. Note that this
method makes no differentiation between 32 and 64 bit architectures. The
result is always a hexadecimal value preceded by "0x" and followed by
exactly 8 characters.
@param aObject
The object who's address is to be retrieved. May be
<code>null</code>.
@return Depending on the current architecture. Always starting with "0x"
and than containing the address.
@see System#identityHashCode(Object) | [
"Get",
"the",
"hex",
"representation",
"of",
"the",
"passed",
"object",
"s",
"address",
".",
"Note",
"that",
"this",
"method",
"makes",
"no",
"differentiation",
"between",
"32",
"and",
"64",
"bit",
"architectures",
".",
"The",
"result",
"is",
"always",
"a",
... | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java#L529-L536 |
136,968 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/statistics/util/StatisticsVisitor.java | StatisticsVisitor.visitStatistics | public static void visitStatistics (@Nonnull final IStatisticsVisitorCallback aCallback)
{
ValueEnforcer.notNull (aCallback, "Callback");
// For all cache handler
ICommonsList <String> aHandlers = StatisticsManager.getAllCacheHandler ().getSorted (Comparator.naturalOrder ());
for (final String sName : aHandlers)
{
final IStatisticsHandlerCache aHandler = StatisticsManager.getCacheHandler (sName);
aCallback.onCache (sName, aHandler);
}
// For all timer handler
aHandlers = StatisticsManager.getAllTimerHandler ().getSorted (Comparator.naturalOrder ());
for (final String sName : aHandlers)
{
final IStatisticsHandlerTimer aHandler = StatisticsManager.getTimerHandler (sName);
aCallback.onTimer (sName, aHandler);
}
// For all keyed timer handler
aHandlers = StatisticsManager.getAllKeyedTimerHandler ().getSorted (Comparator.naturalOrder ());
for (final String sName : aHandlers)
{
final IStatisticsHandlerKeyedTimer aHandler = StatisticsManager.getKeyedTimerHandler (sName);
aCallback.onKeyedTimer (sName, aHandler);
}
// For all size handler
aHandlers = StatisticsManager.getAllSizeHandler ().getSorted (Comparator.naturalOrder ());
for (final String sName : aHandlers)
{
final IStatisticsHandlerSize aHandler = StatisticsManager.getSizeHandler (sName);
aCallback.onSize (sName, aHandler);
}
// For all keyed size handler
aHandlers = StatisticsManager.getAllKeyedSizeHandler ().getSorted (Comparator.naturalOrder ());
for (final String sName : aHandlers)
{
final IStatisticsHandlerKeyedSize aHandler = StatisticsManager.getKeyedSizeHandler (sName);
aCallback.onKeyedSize (sName, aHandler);
}
// For all counter handler
aHandlers = StatisticsManager.getAllCounterHandler ().getSorted (Comparator.naturalOrder ());
for (final String sName : aHandlers)
{
final IStatisticsHandlerCounter aHandler = StatisticsManager.getCounterHandler (sName);
aCallback.onCounter (sName, aHandler);
}
// For all keyed counter handler
aHandlers = StatisticsManager.getAllKeyedCounterHandler ().getSorted (Comparator.naturalOrder ());
for (final String sName : aHandlers)
{
final IStatisticsHandlerKeyedCounter aHandler = StatisticsManager.getKeyedCounterHandler (sName);
aCallback.onKeyedCounter (sName, aHandler);
}
} | java | public static void visitStatistics (@Nonnull final IStatisticsVisitorCallback aCallback)
{
ValueEnforcer.notNull (aCallback, "Callback");
// For all cache handler
ICommonsList <String> aHandlers = StatisticsManager.getAllCacheHandler ().getSorted (Comparator.naturalOrder ());
for (final String sName : aHandlers)
{
final IStatisticsHandlerCache aHandler = StatisticsManager.getCacheHandler (sName);
aCallback.onCache (sName, aHandler);
}
// For all timer handler
aHandlers = StatisticsManager.getAllTimerHandler ().getSorted (Comparator.naturalOrder ());
for (final String sName : aHandlers)
{
final IStatisticsHandlerTimer aHandler = StatisticsManager.getTimerHandler (sName);
aCallback.onTimer (sName, aHandler);
}
// For all keyed timer handler
aHandlers = StatisticsManager.getAllKeyedTimerHandler ().getSorted (Comparator.naturalOrder ());
for (final String sName : aHandlers)
{
final IStatisticsHandlerKeyedTimer aHandler = StatisticsManager.getKeyedTimerHandler (sName);
aCallback.onKeyedTimer (sName, aHandler);
}
// For all size handler
aHandlers = StatisticsManager.getAllSizeHandler ().getSorted (Comparator.naturalOrder ());
for (final String sName : aHandlers)
{
final IStatisticsHandlerSize aHandler = StatisticsManager.getSizeHandler (sName);
aCallback.onSize (sName, aHandler);
}
// For all keyed size handler
aHandlers = StatisticsManager.getAllKeyedSizeHandler ().getSorted (Comparator.naturalOrder ());
for (final String sName : aHandlers)
{
final IStatisticsHandlerKeyedSize aHandler = StatisticsManager.getKeyedSizeHandler (sName);
aCallback.onKeyedSize (sName, aHandler);
}
// For all counter handler
aHandlers = StatisticsManager.getAllCounterHandler ().getSorted (Comparator.naturalOrder ());
for (final String sName : aHandlers)
{
final IStatisticsHandlerCounter aHandler = StatisticsManager.getCounterHandler (sName);
aCallback.onCounter (sName, aHandler);
}
// For all keyed counter handler
aHandlers = StatisticsManager.getAllKeyedCounterHandler ().getSorted (Comparator.naturalOrder ());
for (final String sName : aHandlers)
{
final IStatisticsHandlerKeyedCounter aHandler = StatisticsManager.getKeyedCounterHandler (sName);
aCallback.onKeyedCounter (sName, aHandler);
}
} | [
"public",
"static",
"void",
"visitStatistics",
"(",
"@",
"Nonnull",
"final",
"IStatisticsVisitorCallback",
"aCallback",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aCallback",
",",
"\"Callback\"",
")",
";",
"// For all cache handler",
"ICommonsList",
"<",
"String... | Walk all available statistics elements with the passed statistics visitor.
@param aCallback
The visitor to use. May not be <code>null</code>. | [
"Walk",
"all",
"available",
"statistics",
"elements",
"with",
"the",
"passed",
"statistics",
"visitor",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/statistics/util/StatisticsVisitor.java#L56-L115 |
136,969 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/math/CombinationGenerator.java | CombinationGenerator.reset | public final void reset ()
{
for (int i = 0; i < m_aIndexResult.length; i++)
m_aIndexResult[i] = i;
m_aCombinationsLeft = m_aTotalCombinations;
m_nCombinationsLeft = m_nTotalCombinations;
} | java | public final void reset ()
{
for (int i = 0; i < m_aIndexResult.length; i++)
m_aIndexResult[i] = i;
m_aCombinationsLeft = m_aTotalCombinations;
m_nCombinationsLeft = m_nTotalCombinations;
} | [
"public",
"final",
"void",
"reset",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m_aIndexResult",
".",
"length",
";",
"i",
"++",
")",
"m_aIndexResult",
"[",
"i",
"]",
"=",
"i",
";",
"m_aCombinationsLeft",
"=",
"m_aTotalCombinations"... | Reset the generator | [
"Reset",
"the",
"generator"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/math/CombinationGenerator.java#L88-L94 |
136,970 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/math/CombinationGenerator.java | CombinationGenerator.getAllPermutations | @Nonnull
public static <DATATYPE> ICommonsList <ICommonsList <DATATYPE>> getAllPermutations (@Nonnull @Nonempty final ICommonsList <DATATYPE> aInput,
@Nonnegative final int nSlotCount)
{
final ICommonsList <ICommonsList <DATATYPE>> aResultList = new CommonsArrayList <> ();
addAllPermutations (aInput, nSlotCount, aResultList);
return aResultList;
} | java | @Nonnull
public static <DATATYPE> ICommonsList <ICommonsList <DATATYPE>> getAllPermutations (@Nonnull @Nonempty final ICommonsList <DATATYPE> aInput,
@Nonnegative final int nSlotCount)
{
final ICommonsList <ICommonsList <DATATYPE>> aResultList = new CommonsArrayList <> ();
addAllPermutations (aInput, nSlotCount, aResultList);
return aResultList;
} | [
"@",
"Nonnull",
"public",
"static",
"<",
"DATATYPE",
">",
"ICommonsList",
"<",
"ICommonsList",
"<",
"DATATYPE",
">",
">",
"getAllPermutations",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"ICommonsList",
"<",
"DATATYPE",
">",
"aInput",
",",
"@",
"Nonnegativ... | Get a list of all permutations of the input elements.
@param <DATATYPE>
Element type to be combined
@param aInput
Input list.
@param nSlotCount
Slot count.
@return The list of all permutations. Beware: the resulting list may be
quite large and may contain duplicates if the input list contains
duplicate elements! | [
"Get",
"a",
"list",
"of",
"all",
"permutations",
"of",
"the",
"input",
"elements",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/math/CombinationGenerator.java#L182-L189 |
136,971 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/math/CombinationGenerator.java | CombinationGenerator.addAllPermutations | public static <DATATYPE> void addAllPermutations (@Nonnull @Nonempty final ICommonsList <DATATYPE> aInput,
@Nonnegative final int nSlotCount,
@Nonnull final Collection <ICommonsList <DATATYPE>> aResultList)
{
for (final ICommonsList <DATATYPE> aPermutation : new CombinationGenerator <> (aInput, nSlotCount))
aResultList.add (aPermutation);
} | java | public static <DATATYPE> void addAllPermutations (@Nonnull @Nonempty final ICommonsList <DATATYPE> aInput,
@Nonnegative final int nSlotCount,
@Nonnull final Collection <ICommonsList <DATATYPE>> aResultList)
{
for (final ICommonsList <DATATYPE> aPermutation : new CombinationGenerator <> (aInput, nSlotCount))
aResultList.add (aPermutation);
} | [
"public",
"static",
"<",
"DATATYPE",
">",
"void",
"addAllPermutations",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"ICommonsList",
"<",
"DATATYPE",
">",
"aInput",
",",
"@",
"Nonnegative",
"final",
"int",
"nSlotCount",
",",
"@",
"Nonnull",
"final",
"Collect... | Fill a list with all permutations of the input elements.
@param <DATATYPE>
Element type to be combined
@param aInput
Input list.
@param nSlotCount
Slot count.
@param aResultList
The list to be filled with all permutations. Beware: this list may
be quite large and may contain duplicates if the input list contains
duplicate elements! Note: this list is not cleared before filling | [
"Fill",
"a",
"list",
"with",
"all",
"permutations",
"of",
"the",
"input",
"elements",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/math/CombinationGenerator.java#L205-L211 |
136,972 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/microdom/AbstractMicroNode.java | AbstractMicroNode.onInsertBefore | @OverrideOnDemand
protected void onInsertBefore (@Nonnull final AbstractMicroNode aChildNode, @Nonnull final IMicroNode aSuccessor)
{
throw new MicroException ("Cannot insert children in class " + getClass ().getName ());
} | java | @OverrideOnDemand
protected void onInsertBefore (@Nonnull final AbstractMicroNode aChildNode, @Nonnull final IMicroNode aSuccessor)
{
throw new MicroException ("Cannot insert children in class " + getClass ().getName ());
} | [
"@",
"OverrideOnDemand",
"protected",
"void",
"onInsertBefore",
"(",
"@",
"Nonnull",
"final",
"AbstractMicroNode",
"aChildNode",
",",
"@",
"Nonnull",
"final",
"IMicroNode",
"aSuccessor",
")",
"{",
"throw",
"new",
"MicroException",
"(",
"\"Cannot insert children in class... | Callback that is invoked once a child is to be inserted before another
child.
@param aChildNode
The new child node to be inserted.
@param aSuccessor
The node before which the new node will be inserted. | [
"Callback",
"that",
"is",
"invoked",
"once",
"a",
"child",
"is",
"to",
"be",
"inserted",
"before",
"another",
"child",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/microdom/AbstractMicroNode.java#L74-L78 |
136,973 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/microdom/AbstractMicroNode.java | AbstractMicroNode.onInsertAfter | @OverrideOnDemand
protected void onInsertAfter (@Nonnull final AbstractMicroNode aChildNode, @Nonnull final IMicroNode aPredecessor)
{
throw new MicroException ("Cannot insert children in class " + getClass ().getName ());
} | java | @OverrideOnDemand
protected void onInsertAfter (@Nonnull final AbstractMicroNode aChildNode, @Nonnull final IMicroNode aPredecessor)
{
throw new MicroException ("Cannot insert children in class " + getClass ().getName ());
} | [
"@",
"OverrideOnDemand",
"protected",
"void",
"onInsertAfter",
"(",
"@",
"Nonnull",
"final",
"AbstractMicroNode",
"aChildNode",
",",
"@",
"Nonnull",
"final",
"IMicroNode",
"aPredecessor",
")",
"{",
"throw",
"new",
"MicroException",
"(",
"\"Cannot insert children in clas... | Callback that is invoked once a child is to be inserted after another
child.
@param aChildNode
The new child node to be inserted.
@param aPredecessor
The node after which the new node will be inserted. | [
"Callback",
"that",
"is",
"invoked",
"once",
"a",
"child",
"is",
"to",
"be",
"inserted",
"after",
"another",
"child",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/microdom/AbstractMicroNode.java#L89-L93 |
136,974 | phax/ph-commons | ph-xml/src/main/java/com/helger/xml/microdom/AbstractMicroNode.java | AbstractMicroNode.onInsertAtIndex | @OverrideOnDemand
protected void onInsertAtIndex (@Nonnegative final int nIndex, @Nonnull final AbstractMicroNode aChildNode)
{
throw new MicroException ("Cannot insert children in class " + getClass ().getName ());
} | java | @OverrideOnDemand
protected void onInsertAtIndex (@Nonnegative final int nIndex, @Nonnull final AbstractMicroNode aChildNode)
{
throw new MicroException ("Cannot insert children in class " + getClass ().getName ());
} | [
"@",
"OverrideOnDemand",
"protected",
"void",
"onInsertAtIndex",
"(",
"@",
"Nonnegative",
"final",
"int",
"nIndex",
",",
"@",
"Nonnull",
"final",
"AbstractMicroNode",
"aChildNode",
")",
"{",
"throw",
"new",
"MicroException",
"(",
"\"Cannot insert children in class \"",
... | Callback that is invoked once a child is to be inserted at the specified
index.
@param nIndex
The index where the node should be inserted.
@param aChildNode
The new child node to be inserted. | [
"Callback",
"that",
"is",
"invoked",
"once",
"a",
"child",
"is",
"to",
"be",
"inserted",
"at",
"the",
"specified",
"index",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/microdom/AbstractMicroNode.java#L104-L108 |
136,975 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/ByteArrayWrapper.java | ByteArrayWrapper.create | @Nonnull
@ReturnsMutableCopy
public static ByteArrayWrapper create (@Nonnull final String sText, @Nonnull final Charset aCharset)
{
return new ByteArrayWrapper (sText.getBytes (aCharset), false);
} | java | @Nonnull
@ReturnsMutableCopy
public static ByteArrayWrapper create (@Nonnull final String sText, @Nonnull final Charset aCharset)
{
return new ByteArrayWrapper (sText.getBytes (aCharset), false);
} | [
"@",
"Nonnull",
"@",
"ReturnsMutableCopy",
"public",
"static",
"ByteArrayWrapper",
"create",
"(",
"@",
"Nonnull",
"final",
"String",
"sText",
",",
"@",
"Nonnull",
"final",
"Charset",
"aCharset",
")",
"{",
"return",
"new",
"ByteArrayWrapper",
"(",
"sText",
".",
... | Wrap the content of a String in a certain charset.
@param sText
The String to be wrapped. May not be <code>null</code>.
@param aCharset
The character set to be used for retrieving the bytes from the
string. May not be <code>null</code>.
@return ByteArrayWrapper The created instance. Never <code>null</code>.
@since 9.2.1 | [
"Wrap",
"the",
"content",
"of",
"a",
"String",
"in",
"a",
"certain",
"charset",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/ByteArrayWrapper.java#L185-L190 |
136,976 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/file/SimpleFileIO.java | SimpleFileIO.getAllFileBytes | @Nullable
public static byte [] getAllFileBytes (@Nullable final File aFile)
{
return aFile == null ? null : StreamHelper.getAllBytes (FileHelper.getInputStream (aFile));
} | java | @Nullable
public static byte [] getAllFileBytes (@Nullable final File aFile)
{
return aFile == null ? null : StreamHelper.getAllBytes (FileHelper.getInputStream (aFile));
} | [
"@",
"Nullable",
"public",
"static",
"byte",
"[",
"]",
"getAllFileBytes",
"(",
"@",
"Nullable",
"final",
"File",
"aFile",
")",
"{",
"return",
"aFile",
"==",
"null",
"?",
"null",
":",
"StreamHelper",
".",
"getAllBytes",
"(",
"FileHelper",
".",
"getInputStream... | Get the content of the file as a byte array.
@param aFile
The file to read. May be <code>null</code>.
@return <code>null</code> if the passed file is <code>null</code> or if the
passed file does not exist. | [
"Get",
"the",
"content",
"of",
"the",
"file",
"as",
"a",
"byte",
"array",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/file/SimpleFileIO.java#L65-L69 |
136,977 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/text/codepoint/CodepointHelper.java | CodepointHelper.stripBidi | @Nullable
public static String stripBidi (@Nullable final String sStr)
{
if (sStr == null || sStr.length () <= 1)
return sStr;
String ret = sStr;
if (isBidi (ret.charAt (0)))
ret = ret.substring (1);
if (isBidi (ret.charAt (ret.length () - 1)))
ret = ret.substring (0, ret.length () - 1);
return ret;
} | java | @Nullable
public static String stripBidi (@Nullable final String sStr)
{
if (sStr == null || sStr.length () <= 1)
return sStr;
String ret = sStr;
if (isBidi (ret.charAt (0)))
ret = ret.substring (1);
if (isBidi (ret.charAt (ret.length () - 1)))
ret = ret.substring (0, ret.length () - 1);
return ret;
} | [
"@",
"Nullable",
"public",
"static",
"String",
"stripBidi",
"(",
"@",
"Nullable",
"final",
"String",
"sStr",
")",
"{",
"if",
"(",
"sStr",
"==",
"null",
"||",
"sStr",
".",
"length",
"(",
")",
"<=",
"1",
")",
"return",
"sStr",
";",
"String",
"ret",
"="... | Removes leading and trailing bidi controls from the string
@param sStr
Source string
@return the modified string | [
"Removes",
"leading",
"and",
"trailing",
"bidi",
"controls",
"from",
"the",
"string"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/text/codepoint/CodepointHelper.java#L340-L352 |
136,978 | phax/ph-commons | ph-commons/src/main/java/com/helger/commons/text/codepoint/CodepointHelper.java | CodepointHelper.wrapBidi | @Nullable
public static String wrapBidi (@Nullable final String sStr, final char cChar)
{
switch (cChar)
{
case RLE:
return _wrap (sStr, RLE, PDF);
case RLO:
return _wrap (sStr, RLO, PDF);
case LRE:
return _wrap (sStr, LRE, PDF);
case LRO:
return _wrap (sStr, LRO, PDF);
case RLM:
return _wrap (sStr, RLM, RLM);
case LRM:
return _wrap (sStr, LRM, LRM);
default:
return sStr;
}
} | java | @Nullable
public static String wrapBidi (@Nullable final String sStr, final char cChar)
{
switch (cChar)
{
case RLE:
return _wrap (sStr, RLE, PDF);
case RLO:
return _wrap (sStr, RLO, PDF);
case LRE:
return _wrap (sStr, LRE, PDF);
case LRO:
return _wrap (sStr, LRO, PDF);
case RLM:
return _wrap (sStr, RLM, RLM);
case LRM:
return _wrap (sStr, LRM, LRM);
default:
return sStr;
}
} | [
"@",
"Nullable",
"public",
"static",
"String",
"wrapBidi",
"(",
"@",
"Nullable",
"final",
"String",
"sStr",
",",
"final",
"char",
"cChar",
")",
"{",
"switch",
"(",
"cChar",
")",
"{",
"case",
"RLE",
":",
"return",
"_wrap",
"(",
"sStr",
",",
"RLE",
",",
... | Wrap the string with the specified bidi control
@param sStr
source string
@param cChar
source char
@return The wrapped string | [
"Wrap",
"the",
"string",
"with",
"the",
"specified",
"bidi",
"control"
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/text/codepoint/CodepointHelper.java#L390-L410 |
136,979 | omise/omise-java | src/main/java/co/omise/Serializer.java | Serializer.deserialize | public <T extends OmiseObject> T deserialize(InputStream input, Class<T> klass) throws IOException {
return objectMapper.readerFor(klass).readValue(input);
} | java | public <T extends OmiseObject> T deserialize(InputStream input, Class<T> klass) throws IOException {
return objectMapper.readerFor(klass).readValue(input);
} | [
"public",
"<",
"T",
"extends",
"OmiseObject",
">",
"T",
"deserialize",
"(",
"InputStream",
"input",
",",
"Class",
"<",
"T",
">",
"klass",
")",
"throws",
"IOException",
"{",
"return",
"objectMapper",
".",
"readerFor",
"(",
"klass",
")",
".",
"readValue",
"(... | Deserialize an instance of the given class from the input stream.
@param input The {@link InputStream} that contains the data to deserialize.
@param klass The {@link Class} to deserialize the result into.
@param <T> The type to deserialize the result into.
@return An instance of type T deserialized from the input stream.
@throws IOException on general I/O error. | [
"Deserialize",
"an",
"instance",
"of",
"the",
"given",
"class",
"from",
"the",
"input",
"stream",
"."
] | 95aafc5e8c21b44e6d00a5a9080b9e353fe98042 | https://github.com/omise/omise-java/blob/95aafc5e8c21b44e6d00a5a9080b9e353fe98042/src/main/java/co/omise/Serializer.java#L115-L117 |
136,980 | omise/omise-java | src/main/java/co/omise/Serializer.java | Serializer.deserialize | public <T extends OmiseObject> T deserialize(InputStream input, TypeReference<T> ref) throws IOException {
return objectMapper.readerFor(ref).readValue(input);
} | java | public <T extends OmiseObject> T deserialize(InputStream input, TypeReference<T> ref) throws IOException {
return objectMapper.readerFor(ref).readValue(input);
} | [
"public",
"<",
"T",
"extends",
"OmiseObject",
">",
"T",
"deserialize",
"(",
"InputStream",
"input",
",",
"TypeReference",
"<",
"T",
">",
"ref",
")",
"throws",
"IOException",
"{",
"return",
"objectMapper",
".",
"readerFor",
"(",
"ref",
")",
".",
"readValue",
... | Deserialize an instance of the given type reference from the input stream.
@param input The {@link InputStream} that contains the data to deserialize.
@param ref The {@link TypeReference} of the type to deserialize the result into.
@param <T> The type to deserialize the result into.
@return An instance of the given type T deserialized from the input stream.
@throws IOException on general I/O error. | [
"Deserialize",
"an",
"instance",
"of",
"the",
"given",
"type",
"reference",
"from",
"the",
"input",
"stream",
"."
] | 95aafc5e8c21b44e6d00a5a9080b9e353fe98042 | https://github.com/omise/omise-java/blob/95aafc5e8c21b44e6d00a5a9080b9e353fe98042/src/main/java/co/omise/Serializer.java#L128-L130 |
136,981 | omise/omise-java | src/main/java/co/omise/Serializer.java | Serializer.deserializeFromMap | public <T extends OmiseObject> T deserializeFromMap(Map<String, Object> map, Class<T> klass) {
return objectMapper.convertValue(map, klass);
} | java | public <T extends OmiseObject> T deserializeFromMap(Map<String, Object> map, Class<T> klass) {
return objectMapper.convertValue(map, klass);
} | [
"public",
"<",
"T",
"extends",
"OmiseObject",
">",
"T",
"deserializeFromMap",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
",",
"Class",
"<",
"T",
">",
"klass",
")",
"{",
"return",
"objectMapper",
".",
"convertValue",
"(",
"map",
",",
"klass",
... | Deserialize an instance of the given class from the map.
@param map The {@link Map} containing the JSON structure to deserialize from.
@param klass The {@link Class} to deserialize the result into.
@param <T> The type to deserialize the result into.
@return An instance of type T deserialized from the map. | [
"Deserialize",
"an",
"instance",
"of",
"the",
"given",
"class",
"from",
"the",
"map",
"."
] | 95aafc5e8c21b44e6d00a5a9080b9e353fe98042 | https://github.com/omise/omise-java/blob/95aafc5e8c21b44e6d00a5a9080b9e353fe98042/src/main/java/co/omise/Serializer.java#L140-L142 |
136,982 | omise/omise-java | src/main/java/co/omise/Serializer.java | Serializer.deserializeFromMap | public <T extends OmiseObject> T deserializeFromMap(Map<String, Object> map, TypeReference<T> ref) {
return objectMapper.convertValue(map, ref);
} | java | public <T extends OmiseObject> T deserializeFromMap(Map<String, Object> map, TypeReference<T> ref) {
return objectMapper.convertValue(map, ref);
} | [
"public",
"<",
"T",
"extends",
"OmiseObject",
">",
"T",
"deserializeFromMap",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
",",
"TypeReference",
"<",
"T",
">",
"ref",
")",
"{",
"return",
"objectMapper",
".",
"convertValue",
"(",
"map",
",",
"ref... | Deserialize an instance of the given type reference from the map.
@param map The {@link Map} containing the JSON structure to deserialize from.
@param ref The {@link TypeReference} of the type to deserialize the result into.
@param <T> The type to deserialize the result into.
@return An instance of the given type T deserialized from the map. | [
"Deserialize",
"an",
"instance",
"of",
"the",
"given",
"type",
"reference",
"from",
"the",
"map",
"."
] | 95aafc5e8c21b44e6d00a5a9080b9e353fe98042 | https://github.com/omise/omise-java/blob/95aafc5e8c21b44e6d00a5a9080b9e353fe98042/src/main/java/co/omise/Serializer.java#L152-L154 |
136,983 | omise/omise-java | src/main/java/co/omise/Serializer.java | Serializer.serialize | public <T extends OmiseObject> void serialize(OutputStream output, T model) throws IOException {
objectMapper.writerFor(model.getClass()).writeValue(output, model);
} | java | public <T extends OmiseObject> void serialize(OutputStream output, T model) throws IOException {
objectMapper.writerFor(model.getClass()).writeValue(output, model);
} | [
"public",
"<",
"T",
"extends",
"OmiseObject",
">",
"void",
"serialize",
"(",
"OutputStream",
"output",
",",
"T",
"model",
")",
"throws",
"IOException",
"{",
"objectMapper",
".",
"writerFor",
"(",
"model",
".",
"getClass",
"(",
")",
")",
".",
"writeValue",
... | Serializes the given model to the output stream.
@param output The {@link OutputStream} to serializes the model into.
@param model The {@link OmiseObject} to serialize.
@param <T> The type of the model to serialize.
@throws IOException on general I/O error. | [
"Serializes",
"the",
"given",
"model",
"to",
"the",
"output",
"stream",
"."
] | 95aafc5e8c21b44e6d00a5a9080b9e353fe98042 | https://github.com/omise/omise-java/blob/95aafc5e8c21b44e6d00a5a9080b9e353fe98042/src/main/java/co/omise/Serializer.java#L164-L166 |
136,984 | omise/omise-java | src/main/java/co/omise/Serializer.java | Serializer.serializeParams | public <T extends Params> void serializeParams(OutputStream output, T param) throws IOException {
// TODO: Add params-specific options.
objectMapper.writerFor(param.getClass()).writeValue(output, param);
} | java | public <T extends Params> void serializeParams(OutputStream output, T param) throws IOException {
// TODO: Add params-specific options.
objectMapper.writerFor(param.getClass()).writeValue(output, param);
} | [
"public",
"<",
"T",
"extends",
"Params",
">",
"void",
"serializeParams",
"(",
"OutputStream",
"output",
",",
"T",
"param",
")",
"throws",
"IOException",
"{",
"// TODO: Add params-specific options.",
"objectMapper",
".",
"writerFor",
"(",
"param",
".",
"getClass",
... | Serializes the given parameter object to the output stream.
@param output The {@link OutputStream} to serialize the parameter into.
@param param The {@link Params} to serialize.
@param <T> The type of the parameter object to serialize.
@throws IOException on general I/O error. | [
"Serializes",
"the",
"given",
"parameter",
"object",
"to",
"the",
"output",
"stream",
"."
] | 95aafc5e8c21b44e6d00a5a9080b9e353fe98042 | https://github.com/omise/omise-java/blob/95aafc5e8c21b44e6d00a5a9080b9e353fe98042/src/main/java/co/omise/Serializer.java#L176-L179 |
136,985 | omise/omise-java | src/main/java/co/omise/Serializer.java | Serializer.serializeToMap | public <T extends OmiseObject> Map<String, Object> serializeToMap(T model) {
return objectMapper.convertValue(model, new TypeReference<Map<String, Object>>() {
});
} | java | public <T extends OmiseObject> Map<String, Object> serializeToMap(T model) {
return objectMapper.convertValue(model, new TypeReference<Map<String, Object>>() {
});
} | [
"public",
"<",
"T",
"extends",
"OmiseObject",
">",
"Map",
"<",
"String",
",",
"Object",
">",
"serializeToMap",
"(",
"T",
"model",
")",
"{",
"return",
"objectMapper",
".",
"convertValue",
"(",
"model",
",",
"new",
"TypeReference",
"<",
"Map",
"<",
"String",... | Serialize the given model to a map with JSON-like structure.
@param model The {@link OmiseObject} to serialize.
@param <T> The type of the model to serialize.
@return The map containing the model's data. | [
"Serialize",
"the",
"given",
"model",
"to",
"a",
"map",
"with",
"JSON",
"-",
"like",
"structure",
"."
] | 95aafc5e8c21b44e6d00a5a9080b9e353fe98042 | https://github.com/omise/omise-java/blob/95aafc5e8c21b44e6d00a5a9080b9e353fe98042/src/main/java/co/omise/Serializer.java#L188-L191 |
136,986 | omise/omise-java | src/main/java/co/omise/Serializer.java | Serializer.serializeToQueryParams | public <T extends Enum<T>> String serializeToQueryParams(T value) {
return (String) objectMapper.convertValue(value, String.class);
} | java | public <T extends Enum<T>> String serializeToQueryParams(T value) {
return (String) objectMapper.convertValue(value, String.class);
} | [
"public",
"<",
"T",
"extends",
"Enum",
"<",
"T",
">",
">",
"String",
"serializeToQueryParams",
"(",
"T",
"value",
")",
"{",
"return",
"(",
"String",
")",
"objectMapper",
".",
"convertValue",
"(",
"value",
",",
"String",
".",
"class",
")",
";",
"}"
] | Serialize the given model to a representation suitable for using as URL query parameters.
@param value The value to serialize
@param <T> The type of the value to serialize.
@return The string value for using as query parameters. | [
"Serialize",
"the",
"given",
"model",
"to",
"a",
"representation",
"suitable",
"for",
"using",
"as",
"URL",
"query",
"parameters",
"."
] | 95aafc5e8c21b44e6d00a5a9080b9e353fe98042 | https://github.com/omise/omise-java/blob/95aafc5e8c21b44e6d00a5a9080b9e353fe98042/src/main/java/co/omise/Serializer.java#L200-L202 |
136,987 | opentracing-contrib/java-elasticsearch-client | opentracing-elasticsearch-client-common/src/main/java/io/opentracing/contrib/elasticsearch/common/ClientSpanNameProvider.java | ClientSpanNameProvider.PREFIXED_REQUEST_METHOD_NAME | public static Function<HttpRequest, String> PREFIXED_REQUEST_METHOD_NAME(final String prefix) {
return (request) -> replaceIfNull(prefix, "")
+ replaceIfNull(request.getRequestLine().getMethod(), "unknown");
} | java | public static Function<HttpRequest, String> PREFIXED_REQUEST_METHOD_NAME(final String prefix) {
return (request) -> replaceIfNull(prefix, "")
+ replaceIfNull(request.getRequestLine().getMethod(), "unknown");
} | [
"public",
"static",
"Function",
"<",
"HttpRequest",
",",
"String",
">",
"PREFIXED_REQUEST_METHOD_NAME",
"(",
"final",
"String",
"prefix",
")",
"{",
"return",
"(",
"request",
")",
"-",
">",
"replaceIfNull",
"(",
"prefix",
",",
"\"\"",
")",
"+",
"replaceIfNull",... | A configurable version of REQUEST_METHOD_NAME
@param prefix The String prefix that will be appended to the name generated by the Function.
@return A Function that, when given an HttpRequest, will return a String concatenation of the
prefix and the HTTP method of the request. | [
"A",
"configurable",
"version",
"of",
"REQUEST_METHOD_NAME"
] | 6ea02aef6d135399377dc8a4645c715ddcb56a7d | https://github.com/opentracing-contrib/java-elasticsearch-client/blob/6ea02aef6d135399377dc8a4645c715ddcb56a7d/opentracing-elasticsearch-client-common/src/main/java/io/opentracing/contrib/elasticsearch/common/ClientSpanNameProvider.java#L51-L54 |
136,988 | opentracing-contrib/java-elasticsearch-client | opentracing-elasticsearch-client-common/src/main/java/io/opentracing/contrib/elasticsearch/common/ClientSpanNameProvider.java | ClientSpanNameProvider.PREFIXED_REQUEST_TARGET_NAME | public static Function<HttpRequest, String> PREFIXED_REQUEST_TARGET_NAME(final String prefix) {
return (request) -> replaceIfNull(prefix, "")
+ replaceIfNull(standardizeUri(request.getRequestLine().getUri()), "unknown");
} | java | public static Function<HttpRequest, String> PREFIXED_REQUEST_TARGET_NAME(final String prefix) {
return (request) -> replaceIfNull(prefix, "")
+ replaceIfNull(standardizeUri(request.getRequestLine().getUri()), "unknown");
} | [
"public",
"static",
"Function",
"<",
"HttpRequest",
",",
"String",
">",
"PREFIXED_REQUEST_TARGET_NAME",
"(",
"final",
"String",
"prefix",
")",
"{",
"return",
"(",
"request",
")",
"-",
">",
"replaceIfNull",
"(",
"prefix",
",",
"\"\"",
")",
"+",
"replaceIfNull",... | A configurable version of REQUEST_TARGET_NAME
@param prefix The String prefix that will be appended to the name generated by the Function.
@return A Function that, when given an HttpRequest, will return a String concatenation of the
prefix and the Elasticsearch target of the request. | [
"A",
"configurable",
"version",
"of",
"REQUEST_TARGET_NAME"
] | 6ea02aef6d135399377dc8a4645c715ddcb56a7d | https://github.com/opentracing-contrib/java-elasticsearch-client/blob/6ea02aef6d135399377dc8a4645c715ddcb56a7d/opentracing-elasticsearch-client-common/src/main/java/io/opentracing/contrib/elasticsearch/common/ClientSpanNameProvider.java#L69-L72 |
136,989 | opentracing-contrib/java-elasticsearch-client | opentracing-elasticsearch-client-common/src/main/java/io/opentracing/contrib/elasticsearch/common/ClientSpanNameProvider.java | ClientSpanNameProvider.PREFIXED_REQUEST_METHOD_TARGET_NAME | public static Function<HttpRequest, String> PREFIXED_REQUEST_METHOD_TARGET_NAME(
final String prefix) {
return (request) -> replaceIfNull(prefix, "")
+ replaceIfNull(request.getRequestLine().getMethod(), "unknown")
+ " " + replaceIfNull(standardizeUri(request.getRequestLine().getUri()), "unknown");
} | java | public static Function<HttpRequest, String> PREFIXED_REQUEST_METHOD_TARGET_NAME(
final String prefix) {
return (request) -> replaceIfNull(prefix, "")
+ replaceIfNull(request.getRequestLine().getMethod(), "unknown")
+ " " + replaceIfNull(standardizeUri(request.getRequestLine().getUri()), "unknown");
} | [
"public",
"static",
"Function",
"<",
"HttpRequest",
",",
"String",
">",
"PREFIXED_REQUEST_METHOD_TARGET_NAME",
"(",
"final",
"String",
"prefix",
")",
"{",
"return",
"(",
"request",
")",
"-",
">",
"replaceIfNull",
"(",
"prefix",
",",
"\"\"",
")",
"+",
"replaceI... | A configurable version of REQUEST_METHOD_TARGET_NAME
@param prefix The String prefix that will be appended to the name generated by the Function.
@return A Function that, when given an HttpRequest, will return a String concatenation of the
prefix, the HTTP method of the request, and the Elasticsearch target of the request. | [
"A",
"configurable",
"version",
"of",
"REQUEST_METHOD_TARGET_NAME"
] | 6ea02aef6d135399377dc8a4645c715ddcb56a7d | https://github.com/opentracing-contrib/java-elasticsearch-client/blob/6ea02aef6d135399377dc8a4645c715ddcb56a7d/opentracing-elasticsearch-client-common/src/main/java/io/opentracing/contrib/elasticsearch/common/ClientSpanNameProvider.java#L89-L94 |
136,990 | opentracing-contrib/java-elasticsearch-client | opentracing-elasticsearch-client-common/src/main/java/io/opentracing/contrib/elasticsearch/common/ClientSpanNameProvider.java | ClientSpanNameProvider.standardizeUri | private static String standardizeUri(String uri) {
return (uri == null) ? null : regexIDPattern.matcher(
regexTaskIDPattern.matcher(
regexParameterPattern.matcher(
uri
).replaceFirst("")
).replaceAll("task_id:\\?")
).replaceAll("/\\?$1");
} | java | private static String standardizeUri(String uri) {
return (uri == null) ? null : regexIDPattern.matcher(
regexTaskIDPattern.matcher(
regexParameterPattern.matcher(
uri
).replaceFirst("")
).replaceAll("task_id:\\?")
).replaceAll("/\\?$1");
} | [
"private",
"static",
"String",
"standardizeUri",
"(",
"String",
"uri",
")",
"{",
"return",
"(",
"uri",
"==",
"null",
")",
"?",
"null",
":",
"regexIDPattern",
".",
"matcher",
"(",
"regexTaskIDPattern",
".",
"matcher",
"(",
"regexParameterPattern",
".",
"matcher... | Using regexes derived from the Elasticsearch 5.6 HTTP API, this method removes additional
parameters in the request and replaces numerical IDs with '?' to reduce granularity.
@param uri The uri of the HttpRequest that is calling out to Elasticsearch
@return A standardized version of the uri that reduces granularity. | [
"Using",
"regexes",
"derived",
"from",
"the",
"Elasticsearch",
"5",
".",
"6",
"HTTP",
"API",
"this",
"method",
"removes",
"additional",
"parameters",
"in",
"the",
"request",
"and",
"replaces",
"numerical",
"IDs",
"with",
"?",
"to",
"reduce",
"granularity",
"."... | 6ea02aef6d135399377dc8a4645c715ddcb56a7d | https://github.com/opentracing-contrib/java-elasticsearch-client/blob/6ea02aef6d135399377dc8a4645c715ddcb56a7d/opentracing-elasticsearch-client-common/src/main/java/io/opentracing/contrib/elasticsearch/common/ClientSpanNameProvider.java#L114-L122 |
136,991 | opentracing-contrib/java-elasticsearch-client | opentracing-elasticsearch-client-common/src/main/java/io/opentracing/contrib/elasticsearch/common/TracingHttpClientConfigCallback.java | TracingHttpClientConfigCallback.extract | private SpanContext extract(HttpRequest request) {
SpanContext spanContext = tracer.extract(Format.Builtin.HTTP_HEADERS,
new HttpTextMapExtractAdapter(request));
if (spanContext != null) {
return spanContext;
}
Span span = tracer.activeSpan();
if (span != null) {
return span.context();
}
return null;
} | java | private SpanContext extract(HttpRequest request) {
SpanContext spanContext = tracer.extract(Format.Builtin.HTTP_HEADERS,
new HttpTextMapExtractAdapter(request));
if (spanContext != null) {
return spanContext;
}
Span span = tracer.activeSpan();
if (span != null) {
return span.context();
}
return null;
} | [
"private",
"SpanContext",
"extract",
"(",
"HttpRequest",
"request",
")",
"{",
"SpanContext",
"spanContext",
"=",
"tracer",
".",
"extract",
"(",
"Format",
".",
"Builtin",
".",
"HTTP_HEADERS",
",",
"new",
"HttpTextMapExtractAdapter",
"(",
"request",
")",
")",
";",... | Extract context from headers or from active Span
@param request http request
@return extracted context | [
"Extract",
"context",
"from",
"headers",
"or",
"from",
"active",
"Span"
] | 6ea02aef6d135399377dc8a4645c715ddcb56a7d | https://github.com/opentracing-contrib/java-elasticsearch-client/blob/6ea02aef6d135399377dc8a4645c715ddcb56a7d/opentracing-elasticsearch-client-common/src/main/java/io/opentracing/contrib/elasticsearch/common/TracingHttpClientConfigCallback.java#L131-L145 |
136,992 | sourceallies/beanoh | src/main/java/com/sourceallies/beanoh/util/DefaultContextLocationBuilder.java | DefaultContextLocationBuilder.build | public String build(Class<?> clazz) {
String packageName = clazz.getPackage().getName();
String formattedPackageName = packageName.replace(".", "/");
return formattedPackageName + "/" + clazz.getSimpleName()
+ "-BeanohContext.xml";
} | java | public String build(Class<?> clazz) {
String packageName = clazz.getPackage().getName();
String formattedPackageName = packageName.replace(".", "/");
return formattedPackageName + "/" + clazz.getSimpleName()
+ "-BeanohContext.xml";
} | [
"public",
"String",
"build",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"String",
"packageName",
"=",
"clazz",
".",
"getPackage",
"(",
")",
".",
"getName",
"(",
")",
";",
"String",
"formattedPackageName",
"=",
"packageName",
".",
"replace",
"(",
"\"... | Builds a bootstrap name with the same name as the test plus
"-BeanohContext.xml".
@param clazz
the test class which is used to determine the location and
name of the bootstrap context
@return the name that is built based on the test class. | [
"Builds",
"a",
"bootstrap",
"name",
"with",
"the",
"same",
"name",
"as",
"the",
"test",
"plus",
"-",
"BeanohContext",
".",
"xml",
"."
] | 7f2a397af3de2a450d9ed9eaee4ec83e3a9773c6 | https://github.com/sourceallies/beanoh/blob/7f2a397af3de2a450d9ed9eaee4ec83e3a9773c6/src/main/java/com/sourceallies/beanoh/util/DefaultContextLocationBuilder.java#L37-L42 |
136,993 | sourceallies/beanoh | src/main/java/com/sourceallies/beanoh/spring/wrapper/BeanohBeanFactoryMethodInterceptor.java | BeanohBeanFactoryMethodInterceptor.intercept | @Override
public Object intercept(Object object, Method method, Object[] args,
MethodProxy methodProxy) throws Throwable {
Method delegateMethod = delegateClass.getMethod(method.getName(),
method.getParameterTypes());
if ("registerBeanDefinition".equals(method.getName())) {
if (beanDefinitionMap.containsKey(args[0])) {
List<BeanDefinition> definitions = beanDefinitionMap
.get(args[0]);
definitions.add((BeanDefinition) args[1]);
} else {
List<BeanDefinition> beanDefinitions = new ArrayList<BeanDefinition>();
beanDefinitions.add((BeanDefinition) args[1]);
beanDefinitionMap.put((String) args[0], beanDefinitions);
}
}
return delegateMethod.invoke(delegate, args);
} | java | @Override
public Object intercept(Object object, Method method, Object[] args,
MethodProxy methodProxy) throws Throwable {
Method delegateMethod = delegateClass.getMethod(method.getName(),
method.getParameterTypes());
if ("registerBeanDefinition".equals(method.getName())) {
if (beanDefinitionMap.containsKey(args[0])) {
List<BeanDefinition> definitions = beanDefinitionMap
.get(args[0]);
definitions.add((BeanDefinition) args[1]);
} else {
List<BeanDefinition> beanDefinitions = new ArrayList<BeanDefinition>();
beanDefinitions.add((BeanDefinition) args[1]);
beanDefinitionMap.put((String) args[0], beanDefinitions);
}
}
return delegateMethod.invoke(delegate, args);
} | [
"@",
"Override",
"public",
"Object",
"intercept",
"(",
"Object",
"object",
",",
"Method",
"method",
",",
"Object",
"[",
"]",
"args",
",",
"MethodProxy",
"methodProxy",
")",
"throws",
"Throwable",
"{",
"Method",
"delegateMethod",
"=",
"delegateClass",
".",
"get... | Intercepts method calls to the proxy and calls the corresponding method
on the delegate.
Collects bean definitions that are registered for later inspection. | [
"Intercepts",
"method",
"calls",
"to",
"the",
"proxy",
"and",
"calls",
"the",
"corresponding",
"method",
"on",
"the",
"delegate",
"."
] | 7f2a397af3de2a450d9ed9eaee4ec83e3a9773c6 | https://github.com/sourceallies/beanoh/blob/7f2a397af3de2a450d9ed9eaee4ec83e3a9773c6/src/main/java/com/sourceallies/beanoh/spring/wrapper/BeanohBeanFactoryMethodInterceptor.java#L68-L85 |
136,994 | sourceallies/beanoh | src/main/java/com/sourceallies/beanoh/spring/wrapper/BeanohApplicationContext.java | BeanohApplicationContext.assertUniqueBeans | public void assertUniqueBeans(Set<String> ignoredDuplicateBeanNames) {
for (BeanohBeanFactoryMethodInterceptor callback : callbacks) {
Map<String, List<BeanDefinition>> beanDefinitionMap = callback
.getBeanDefinitionMap();
for (String key : beanDefinitionMap.keySet()) {
if (!ignoredDuplicateBeanNames.contains(key)) {
List<BeanDefinition> definitions = beanDefinitionMap
.get(key);
List<String> resourceDescriptions = new ArrayList<String>();
for (BeanDefinition definition : definitions) {
String resourceDescription = definition
.getResourceDescription();
if (resourceDescription == null) {
resourceDescriptions.add(definition.getBeanClassName());
}else if (!resourceDescription
.endsWith("-BeanohContext.xml]")) {
if(!resourceDescriptions.contains(resourceDescription)){
resourceDescriptions.add(resourceDescription);
}
}
}
if (resourceDescriptions.size() > 1) {
throw new DuplicateBeanDefinitionException("Bean '"
+ key + "' was defined "
+ resourceDescriptions.size() + " times.\n"
+ "Either remove duplicate bean definitions or ignore them with the 'ignoredDuplicateBeanNames' method.\n"
+ "Configuration locations:"
+ messageUtil.list(resourceDescriptions));
}
}
}
}
} | java | public void assertUniqueBeans(Set<String> ignoredDuplicateBeanNames) {
for (BeanohBeanFactoryMethodInterceptor callback : callbacks) {
Map<String, List<BeanDefinition>> beanDefinitionMap = callback
.getBeanDefinitionMap();
for (String key : beanDefinitionMap.keySet()) {
if (!ignoredDuplicateBeanNames.contains(key)) {
List<BeanDefinition> definitions = beanDefinitionMap
.get(key);
List<String> resourceDescriptions = new ArrayList<String>();
for (BeanDefinition definition : definitions) {
String resourceDescription = definition
.getResourceDescription();
if (resourceDescription == null) {
resourceDescriptions.add(definition.getBeanClassName());
}else if (!resourceDescription
.endsWith("-BeanohContext.xml]")) {
if(!resourceDescriptions.contains(resourceDescription)){
resourceDescriptions.add(resourceDescription);
}
}
}
if (resourceDescriptions.size() > 1) {
throw new DuplicateBeanDefinitionException("Bean '"
+ key + "' was defined "
+ resourceDescriptions.size() + " times.\n"
+ "Either remove duplicate bean definitions or ignore them with the 'ignoredDuplicateBeanNames' method.\n"
+ "Configuration locations:"
+ messageUtil.list(resourceDescriptions));
}
}
}
}
} | [
"public",
"void",
"assertUniqueBeans",
"(",
"Set",
"<",
"String",
">",
"ignoredDuplicateBeanNames",
")",
"{",
"for",
"(",
"BeanohBeanFactoryMethodInterceptor",
"callback",
":",
"callbacks",
")",
"{",
"Map",
"<",
"String",
",",
"List",
"<",
"BeanDefinition",
">",
... | This will fail if there are duplicate beans in the Spring context. Beans
that are configured in the bootstrap context will not be considered
duplicate beans. | [
"This",
"will",
"fail",
"if",
"there",
"are",
"duplicate",
"beans",
"in",
"the",
"Spring",
"context",
".",
"Beans",
"that",
"are",
"configured",
"in",
"the",
"bootstrap",
"context",
"will",
"not",
"be",
"considered",
"duplicate",
"beans",
"."
] | 7f2a397af3de2a450d9ed9eaee4ec83e3a9773c6 | https://github.com/sourceallies/beanoh/blob/7f2a397af3de2a450d9ed9eaee4ec83e3a9773c6/src/main/java/com/sourceallies/beanoh/spring/wrapper/BeanohApplicationContext.java#L82-L114 |
136,995 | sourceallies/beanoh | src/main/java/com/sourceallies/beanoh/exception/MessageUtil.java | MessageUtil.list | public String list(List<String> messages) {
List<String> sortedComponents = new ArrayList<String>(messages);
Collections.sort(sortedComponents);
String output = "";
for (String component : sortedComponents) {
output += "\n" + component;
}
return output;
} | java | public String list(List<String> messages) {
List<String> sortedComponents = new ArrayList<String>(messages);
Collections.sort(sortedComponents);
String output = "";
for (String component : sortedComponents) {
output += "\n" + component;
}
return output;
} | [
"public",
"String",
"list",
"(",
"List",
"<",
"String",
">",
"messages",
")",
"{",
"List",
"<",
"String",
">",
"sortedComponents",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"messages",
")",
";",
"Collections",
".",
"sort",
"(",
"sortedComponents",
... | Separates messages on different lines for error messages.
@param messages
a list of messages to be formatted
@return a String containing a each message on a seperate line | [
"Separates",
"messages",
"on",
"different",
"lines",
"for",
"error",
"messages",
"."
] | 7f2a397af3de2a450d9ed9eaee4ec83e3a9773c6 | https://github.com/sourceallies/beanoh/blob/7f2a397af3de2a450d9ed9eaee4ec83e3a9773c6/src/main/java/com/sourceallies/beanoh/exception/MessageUtil.java#L39-L47 |
136,996 | j256/simplejmx | src/main/java/com/j256/simplejmx/server/JmxServer.java | JmxServer.stopThrow | public synchronized void stopThrow() throws JMException {
if (connector != null) {
try {
connector.stop();
} catch (IOException e) {
throw createJmException("Could not stop our Jmx connector server", e);
} finally {
connector = null;
}
}
if (rmiRegistry != null) {
try {
UnicastRemoteObject.unexportObject(rmiRegistry, true);
} catch (NoSuchObjectException e) {
throw createJmException("Could not unexport our RMI registry", e);
} finally {
rmiRegistry = null;
}
}
if (serverHostNamePropertySet) {
System.clearProperty(RMI_SERVER_HOST_NAME_PROPERTY);
serverHostNamePropertySet = false;
}
} | java | public synchronized void stopThrow() throws JMException {
if (connector != null) {
try {
connector.stop();
} catch (IOException e) {
throw createJmException("Could not stop our Jmx connector server", e);
} finally {
connector = null;
}
}
if (rmiRegistry != null) {
try {
UnicastRemoteObject.unexportObject(rmiRegistry, true);
} catch (NoSuchObjectException e) {
throw createJmException("Could not unexport our RMI registry", e);
} finally {
rmiRegistry = null;
}
}
if (serverHostNamePropertySet) {
System.clearProperty(RMI_SERVER_HOST_NAME_PROPERTY);
serverHostNamePropertySet = false;
}
} | [
"public",
"synchronized",
"void",
"stopThrow",
"(",
")",
"throws",
"JMException",
"{",
"if",
"(",
"connector",
"!=",
"null",
")",
"{",
"try",
"{",
"connector",
".",
"stop",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"creat... | Stop the JMX server by closing the connector and unpublishing it from the RMI registry. This throws a JMException
on any issues. | [
"Stop",
"the",
"JMX",
"server",
"by",
"closing",
"the",
"connector",
"and",
"unpublishing",
"it",
"from",
"the",
"RMI",
"registry",
".",
"This",
"throws",
"a",
"JMException",
"on",
"any",
"issues",
"."
] | 1a04f52512dfa0a711ba0cc7023c604dbc82a352 | https://github.com/j256/simplejmx/blob/1a04f52512dfa0a711ba0cc7023c604dbc82a352/src/main/java/com/j256/simplejmx/server/JmxServer.java#L186-L209 |
136,997 | j256/simplejmx | src/main/java/com/j256/simplejmx/server/JmxServer.java | JmxServer.register | public synchronized ObjectName register(PublishAllBeanWrapper wrapper) throws JMException {
ReflectionMbean mbean;
try {
mbean = new ReflectionMbean(wrapper);
} catch (Exception e) {
throw createJmException("Could not build mbean object for publish-all bean: " + wrapper.getTarget(), e);
}
ObjectName objectName = ObjectNameUtil.makeObjectName(wrapper.getJmxResourceInfo());
doRegister(objectName, mbean);
return objectName;
} | java | public synchronized ObjectName register(PublishAllBeanWrapper wrapper) throws JMException {
ReflectionMbean mbean;
try {
mbean = new ReflectionMbean(wrapper);
} catch (Exception e) {
throw createJmException("Could not build mbean object for publish-all bean: " + wrapper.getTarget(), e);
}
ObjectName objectName = ObjectNameUtil.makeObjectName(wrapper.getJmxResourceInfo());
doRegister(objectName, mbean);
return objectName;
} | [
"public",
"synchronized",
"ObjectName",
"register",
"(",
"PublishAllBeanWrapper",
"wrapper",
")",
"throws",
"JMException",
"{",
"ReflectionMbean",
"mbean",
";",
"try",
"{",
"mbean",
"=",
"new",
"ReflectionMbean",
"(",
"wrapper",
")",
";",
"}",
"catch",
"(",
"Exc... | Register the object parameter for exposure with JMX that is wrapped using the PublishAllBeanWrapper. | [
"Register",
"the",
"object",
"parameter",
"for",
"exposure",
"with",
"JMX",
"that",
"is",
"wrapped",
"using",
"the",
"PublishAllBeanWrapper",
"."
] | 1a04f52512dfa0a711ba0cc7023c604dbc82a352 | https://github.com/j256/simplejmx/blob/1a04f52512dfa0a711ba0cc7023c604dbc82a352/src/main/java/com/j256/simplejmx/server/JmxServer.java#L254-L264 |
136,998 | j256/simplejmx | src/main/java/com/j256/simplejmx/client/ClientUtils.java | ClientUtils.stringToParam | public static Object stringToParam(String string, String typeString) throws IllegalArgumentException {
if (typeString.equals("boolean") || typeString.equals("java.lang.Boolean")) {
return Boolean.parseBoolean(string);
} else if (typeString.equals("char") || typeString.equals("java.lang.Character")) {
if (string.length() == 0) {
// not sure what to do here
return '\0';
} else {
return string.toCharArray()[0];
}
} else if (typeString.equals("byte") || typeString.equals("java.lang.Byte")) {
return Byte.parseByte(string);
} else if (typeString.equals("short") || typeString.equals("java.lang.Short")) {
return Short.parseShort(string);
} else if (typeString.equals("int") || typeString.equals("java.lang.Integer")) {
return Integer.parseInt(string);
} else if (typeString.equals("long") || typeString.equals("java.lang.Long")) {
return Long.parseLong(string);
} else if (typeString.equals("java.lang.String")) {
return string;
} else if (typeString.equals("float") || typeString.equals("java.lang.Float")) {
return Float.parseFloat(string);
} else if (typeString.equals("double") || typeString.equals("java.lang.Double")) {
return Double.parseDouble(string);
} else {
Constructor<?> constr = getConstructor(typeString);
try {
return constr.newInstance(new Object[] { string });
} catch (Exception e) {
throw new IllegalArgumentException(
"Could not get new instance using string constructor for type " + typeString);
}
}
} | java | public static Object stringToParam(String string, String typeString) throws IllegalArgumentException {
if (typeString.equals("boolean") || typeString.equals("java.lang.Boolean")) {
return Boolean.parseBoolean(string);
} else if (typeString.equals("char") || typeString.equals("java.lang.Character")) {
if (string.length() == 0) {
// not sure what to do here
return '\0';
} else {
return string.toCharArray()[0];
}
} else if (typeString.equals("byte") || typeString.equals("java.lang.Byte")) {
return Byte.parseByte(string);
} else if (typeString.equals("short") || typeString.equals("java.lang.Short")) {
return Short.parseShort(string);
} else if (typeString.equals("int") || typeString.equals("java.lang.Integer")) {
return Integer.parseInt(string);
} else if (typeString.equals("long") || typeString.equals("java.lang.Long")) {
return Long.parseLong(string);
} else if (typeString.equals("java.lang.String")) {
return string;
} else if (typeString.equals("float") || typeString.equals("java.lang.Float")) {
return Float.parseFloat(string);
} else if (typeString.equals("double") || typeString.equals("java.lang.Double")) {
return Double.parseDouble(string);
} else {
Constructor<?> constr = getConstructor(typeString);
try {
return constr.newInstance(new Object[] { string });
} catch (Exception e) {
throw new IllegalArgumentException(
"Could not get new instance using string constructor for type " + typeString);
}
}
} | [
"public",
"static",
"Object",
"stringToParam",
"(",
"String",
"string",
",",
"String",
"typeString",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"typeString",
".",
"equals",
"(",
"\"boolean\"",
")",
"||",
"typeString",
".",
"equals",
"(",
"\"java.... | Convert a string to an object based on the type string. | [
"Convert",
"a",
"string",
"to",
"an",
"object",
"based",
"on",
"the",
"type",
"string",
"."
] | 1a04f52512dfa0a711ba0cc7023c604dbc82a352 | https://github.com/j256/simplejmx/blob/1a04f52512dfa0a711ba0cc7023c604dbc82a352/src/main/java/com/j256/simplejmx/client/ClientUtils.java#L16-L49 |
136,999 | j256/simplejmx | src/main/java/com/j256/simplejmx/client/ClientUtils.java | ClientUtils.valueToString | public static String valueToString(Object value) {
if (value == null) {
return "null";
} else if (!value.getClass().isArray()) {
return value.toString();
}
StringBuilder sb = new StringBuilder();
valueToString(sb, value);
return sb.toString();
} | java | public static String valueToString(Object value) {
if (value == null) {
return "null";
} else if (!value.getClass().isArray()) {
return value.toString();
}
StringBuilder sb = new StringBuilder();
valueToString(sb, value);
return sb.toString();
} | [
"public",
"static",
"String",
"valueToString",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"\"null\"",
";",
"}",
"else",
"if",
"(",
"!",
"value",
".",
"getClass",
"(",
")",
".",
"isArray",
"(",
")",
")",
... | Return the string version of value. | [
"Return",
"the",
"string",
"version",
"of",
"value",
"."
] | 1a04f52512dfa0a711ba0cc7023c604dbc82a352 | https://github.com/j256/simplejmx/blob/1a04f52512dfa0a711ba0cc7023c604dbc82a352/src/main/java/com/j256/simplejmx/client/ClientUtils.java#L54-L64 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.