idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
16,200
public void onSetListeners ( ) { imageViewPerson . setOnClickListener ( new View . OnClickListener ( ) { public void onClick ( View v ) { PersonHolderListener listener = getListener ( PersonHolderListener . class ) ; if ( listener != null ) { listener . onPersonImageClicked ( getItem ( ) ) ; } } } ) ; }
Optionally override onSetListeners to add listeners to the views .
16,201
public static List < Person > getMockPeopleSet1 ( ) { List < Person > listPeople = new ArrayList < Person > ( ) ; listPeople . add ( new Person ( "Henry Blair" , "07123456789" , R . drawable . male1 ) ) ; listPeople . add ( new Person ( "Jenny Curtis" , "07123456789" , R . drawable . female1 ) ) ; listPeople . add ( ne...
Returns a mock List of Person objects
16,202
public static ItemViewHolder createViewHolder ( View view , Class < ? extends ItemViewHolder > itemViewHolderClass ) { try { Constructor < ? extends ItemViewHolder > constructor = itemViewHolderClass . getConstructor ( View . class ) ; return constructor . newInstance ( view ) ; } catch ( IllegalAccessException e ) { t...
Create a new ItemViewHolder using Java reflection
16,203
public static Integer parseItemLayoutId ( Class < ? extends ItemViewHolder > itemViewHolderClass ) { Integer itemLayoutId = ClassAnnotationParser . getLayoutId ( itemViewHolderClass ) ; if ( itemLayoutId == null ) { throw new LayoutIdMissingException ( ) ; } return itemLayoutId ; }
Parses the layout ID annotation form the itemViewHolderClass
16,204
public static final String getSingletonScopeKey ( final Class < ? extends AbstractSingleton > aClass ) { ValueEnforcer . notNull ( aClass , "Class" ) ; return new StringBuilder ( DEFAULT_KEY_LENGTH ) . append ( "singleton." ) . append ( aClass . getName ( ) ) . toString ( ) ; }
Create the key which is used to reference the object within the scope .
16,205
public static final boolean isSingletonInstantiated ( final IScope aScope , final Class < ? extends AbstractSingleton > aClass ) { return getSingletonIfInstantiated ( aScope , aClass ) != null ; }
Check if a singleton is already instantiated inside a scope
16,206
public static final < T extends AbstractSingleton > T getSingleton ( final IScope aScope , final Class < T > aClass ) { ValueEnforcer . notNull ( aScope , "aScope" ) ; ValueEnforcer . notNull ( aClass , "Class" ) ; final String sSingletonScopeKey = getSingletonScopeKey ( aClass ) ; T aInstance = s_aRWLock . readLocked ...
Get the singleton object in the passed scope using the passed class . If the singleton is not yet instantiated a new instance is created .
16,207
public static final < T extends AbstractSingleton > ICommonsList < T > getAllSingletons ( final IScope aScope , final Class < T > aDesiredClass ) { ValueEnforcer . notNull ( aDesiredClass , "DesiredClass" ) ; final ICommonsList < T > ret = new CommonsArrayList < > ( ) ; if ( aScope != null ) for ( final Object aScopeVa...
Get all singleton objects registered in the respective sub - class of this class .
16,208
public final ITEMTYPE createChildItem ( final DATATYPE aData ) { final ITEMTYPE aItem = m_aFactory . create ( thisAsT ( ) ) ; if ( aItem == null ) throw new IllegalStateException ( "null item created!" ) ; aItem . setData ( aData ) ; internalAddChild ( aItem ) ; return aItem ; }
Add a child item to this item .
16,209
public static < ELEMENTTYPE > Iterator < ELEMENTTYPE > getCombinedIterator ( final Iterator < ? extends ELEMENTTYPE > aIter1 , final Iterator < ? extends ELEMENTTYPE > aIter2 ) { return new CombinedIterator < > ( aIter1 , aIter2 ) ; }
Get a merged iterator of both iterators . The first iterator is iterated first the second one afterwards .
16,210
public static < ELEMENTTYPE > Enumeration < ELEMENTTYPE > getEnumeration ( final Iterator < ELEMENTTYPE > aIter ) { if ( aIter == null ) return new EmptyEnumeration < > ( ) ; return new EnumerationFromIterator < > ( aIter ) ; }
Get an Enumeration object based on an Iterator object .
16,211
public static < KEYTYPE , VALUETYPE > Enumeration < Map . Entry < KEYTYPE , VALUETYPE > > getEnumeration ( final Map < KEYTYPE , VALUETYPE > aMap ) { if ( aMap == null ) return new EmptyEnumeration < > ( ) ; return getEnumeration ( aMap . entrySet ( ) ) ; }
Get an Enumeration object based on a Map object .
16,212
public EChange addAllFrom ( final MapBasedXPathFunctionResolver aOther , final boolean bOverwrite ) { ValueEnforcer . notNull ( aOther , "Other" ) ; EChange eChange = EChange . UNCHANGED ; for ( final Map . Entry < XPathFunctionKey , XPathFunction > aEntry : aOther . m_aMap . entrySet ( ) ) if ( bOverwrite || ! m_aMap ...
Add all functions from the other function resolver into this resolver .
16,213
public EChange removeFunctionsWithName ( final QName aName ) { EChange eChange = EChange . UNCHANGED ; if ( aName != null ) { for ( final XPathFunctionKey aKey : m_aMap . copyOfKeySet ( ) ) if ( aKey . getFunctionName ( ) . equals ( aName ) ) eChange = eChange . or ( removeFunction ( aKey ) ) ; } return eChange ; }
Remove all functions with the same name . This can be helpful when the same function is registered for multiple parameters .
16,214
public static ESuccess parseJson ( final Reader aReader , final IJsonParserHandler aParserHandler ) { return parseJson ( aReader , aParserHandler , ( IJsonParserCustomizeCallback ) null , ( IJsonParseExceptionCallback ) null ) ; }
Simple JSON parse method taking only the most basic parameters .
16,215
private static EValidity _validateJson ( final Reader aReader ) { final ESuccess eSuccess = parseJson ( aReader , new DoNothingJsonParserHandler ( ) , ( IJsonParserCustomizeCallback ) null , ex -> { } ) ; return EValidity . valueOf ( eSuccess . isSuccess ( ) ) ; }
Validate a JSON without building the tree in memory .
16,216
public static IJson readJson ( final Reader aReader , final IJsonParserCustomizeCallback aCustomizeCallback , final IJsonParseExceptionCallback aCustomExceptionCallback ) { final CollectingJsonParserHandler aHandler = new CollectingJsonParserHandler ( ) ; if ( parseJson ( aReader , aHandler , aCustomizeCallback , aCust...
Main reading of the JSON
16,217
public static boolean getBooleanValue ( final Boolean aObj , final boolean bDefault ) { return aObj == null ? bDefault : aObj . booleanValue ( ) ; }
Get the primitive value of the passed object value .
16,218
public static String urlDecode ( final String sValue , final Charset aCharset ) { ValueEnforcer . notNull ( sValue , "Value" ) ; ValueEnforcer . notNull ( aCharset , "Charset" ) ; boolean bNeedToChange = false ; final int nLen = sValue . length ( ) ; final StringBuilder aSB = new StringBuilder ( nLen ) ; int nIndex = 0...
URL - decode the passed value automatically handling charset issues . The implementation is ripped from URLDecoder but does not throw an UnsupportedEncodingException for nothing .
16,219
public static String urlEncode ( final String sValue , final Charset aCharset ) { ValueEnforcer . notNull ( sValue , "Value" ) ; ValueEnforcer . notNull ( aCharset , "Charset" ) ; NonBlockingCharArrayWriter aCAW = null ; try { final int nLen = sValue . length ( ) ; boolean bChanged = false ; final StringBuilder aSB = n...
URL - encode the passed value automatically handling charset issues . This is a ripped optimized version of URLEncoder . encode but without the UnsupportedEncodingException .
16,220
public static String getCleanURLPartWithoutUmlauts ( final String sURLPart ) { if ( s_aCleanURLOld == null ) _initCleanURL ( ) ; final char [ ] ret = StringHelper . replaceMultiple ( sURLPart , s_aCleanURLOld , s_aCleanURLNew ) ; return new String ( ret ) ; }
Clean an URL part from nasty Umlauts . This mapping needs extension!
16,221
public static ISimpleURL getAsURLData ( final String sHref , final IDecoder < String , String > aParameterDecoder ) { ValueEnforcer . notNull ( sHref , "Href" ) ; final String sRealHref = sHref . trim ( ) ; final IURLProtocol eProtocol = URLProtocolRegistry . getInstance ( ) . getProtocol ( sRealHref ) ; if ( eProtocol...
Parses the passed URL into a structured form
16,222
public void iterateAllRegisteredMicroTypeConverters ( final IMicroTypeConverterCallback aCallback ) { final ICommonsMap < Class < ? > , IMicroTypeConverter < ? > > aCopy = m_aRWLock . readLocked ( m_aMap :: getClone ) ; for ( final Map . Entry < Class < ? > , IMicroTypeConverter < ? > > aEntry : aCopy . entrySet ( ) ) ...
Iterate all registered micro type converters . For informational purposes only .
16,223
public static String safeDecodeAsString ( final String sEncoded , final Charset aCharset ) { ValueEnforcer . notNull ( aCharset , "Charset" ) ; if ( sEncoded != null ) try { final byte [ ] aDecoded = decode ( sEncoded , DONT_GUNZIP ) ; return new String ( aDecoded , aCharset ) ; } catch ( final IOException ex ) { } ret...
Decode the string and convert it back to a string .
16,224
public boolean ready ( ) throws IOException { _ensureOpen ( ) ; if ( m_bSkipLF ) { if ( m_nNextCharIndex >= m_nChars && m_aReader . ready ( ) ) _fill ( ) ; if ( m_nNextCharIndex < m_nChars ) { if ( m_aBuf [ m_nNextCharIndex ] == '\n' ) m_nNextCharIndex ++ ; m_bSkipLF = false ; } } return m_nNextCharIndex < m_nChars || ...
Tells whether this stream is ready to be read . A buffered character stream is ready if the buffer is not empty or if the underlying character stream is ready .
16,225
public EChange addAllFrom ( final MapBasedXPathVariableResolver aOther , final boolean bOverwrite ) { ValueEnforcer . notNull ( aOther , "Other" ) ; EChange eChange = EChange . UNCHANGED ; for ( final Map . Entry < String , ? > aEntry : aOther . getAllVariables ( ) . entrySet ( ) ) { final QName aKey = new QName ( aEnt...
Add all variables from the other variable resolver into this resolver . This methods creates a QName with an empty namespace URI .
16,226
public static void setDefaultJMXDomain ( final String sDefaultJMXDomain ) { ValueEnforcer . notEmpty ( sDefaultJMXDomain , "DefaultJMXDomain" ) ; if ( sDefaultJMXDomain . indexOf ( ':' ) >= 0 || sDefaultJMXDomain . indexOf ( ' ' ) >= 0 ) throw new IllegalArgumentException ( "defaultJMXDomain contains invalid chars: " +...
Set the default JMX domain
16,227
public EChange add ( final CALLBACKTYPE aCallback ) { ValueEnforcer . notNull ( aCallback , "Callback" ) ; return m_aRWLock . writeLocked ( ( ) -> m_aCallbacks . addObject ( aCallback ) ) ; }
Add a callback .
16,228
public EChange removeObject ( final CALLBACKTYPE aCallback ) { if ( aCallback == null ) return EChange . UNCHANGED ; return m_aRWLock . writeLocked ( ( ) -> m_aCallbacks . removeObject ( aCallback ) ) ; }
Remove the specified callback
16,229
public static void debugLogDOMFeatures ( ) { for ( final Map . Entry < EXMLDOMFeatureVersion , ICommonsList < String > > aEntry : s_aSupportedFeatures . entrySet ( ) ) for ( final String sFeature : aEntry . getValue ( ) ) if ( LOGGER . isInfoEnabled ( ) ) LOGGER . info ( "DOM " + aEntry . getKey ( ) . getID ( ) + " fea...
Emit all supported features to the logger .
16,230
public static Document getOwnerDocument ( final Node aNode ) { if ( aNode == null ) return null ; if ( aNode instanceof Document ) return ( Document ) aNode ; return aNode . getOwnerDocument ( ) ; }
Get the owner document of the passed node . If the node itself is a document only a cast is performed .
16,231
public static Element getFirstChildElement ( final Node aStartNode ) { if ( aStartNode == null ) return null ; return NodeListIterator . createChildNodeIterator ( aStartNode ) . findFirstMapped ( filterNodeIsElement ( ) , x -> ( Element ) x ) ; }
Get the first direct child element of the passed element .
16,232
public static boolean hasChildElementNodes ( final Node aStartNode ) { if ( aStartNode == null ) return false ; return NodeListIterator . createChildNodeIterator ( aStartNode ) . containsAny ( filterNodeIsElement ( ) ) ; }
Check if the passed node has at least one direct child element or not .
16,233
public EChange removeParameterWithName ( final String sParamName ) { if ( StringHelper . hasText ( sParamName ) ) { final int nMax = m_aParameters . size ( ) ; for ( int i = 0 ; i < nMax ; ++ i ) { final MimeTypeParameter aParam = m_aParameters . get ( i ) ; if ( aParam . getAttribute ( ) . equals ( sParamName ) ) { m_...
Remove the parameter with the specified name .
16,234
public static Matcher getMatcher ( final String sRegEx , final String sValue ) { ValueEnforcer . notNull ( sValue , "Value" ) ; return RegExCache . getPattern ( sRegEx ) . matcher ( sValue ) ; }
Get the Java Matcher object for the passed pair of regular expression and value .
16,235
public static boolean stringMatchesPattern ( final String sRegEx , final String sValue ) { return getMatcher ( sRegEx , sValue ) . matches ( ) ; }
A shortcut helper method to determine whether a string matches a certain regular expression or not .
16,236
public boolean containsCountry ( final String sCountry ) { if ( sCountry == null ) return false ; final String sValidCountry = LocaleHelper . getValidCountryCode ( sCountry ) ; if ( sValidCountry == null ) return false ; return m_aRWLock . readLocked ( ( ) -> m_aCountries . contains ( sValidCountry ) ) ; }
Check if the passed country is known .
16,237
public static int append ( final int nPrevHashCode , final Object x ) { return append ( nPrevHashCode , HashCodeImplementationRegistry . getHashCode ( x ) ) ; }
Object hash code generation .
16,238
public static HasInputStream multiple ( final ISupplier < ? extends InputStream > aISP ) { return new HasInputStream ( aISP , true ) ; }
Create a new object with a supplier that can read multiple times .
16,239
public static HasInputStream once ( final ISupplier < ? extends InputStream > aISP ) { return new HasInputStream ( aISP , false ) ; }
Create a new object with a supplier that can be read only once .
16,240
private static int _getDistance111 ( final char [ ] aStr1 , final int nLen1 , final char [ ] aStr2 , final int nLen2 ) { int [ ] aPrevRow = new int [ nLen1 + 1 ] ; int [ ] aCurRow = new int [ nLen1 + 1 ] ; for ( int i = 0 ; i <= nLen1 ; i ++ ) aPrevRow [ i ] = i ; for ( int j = 0 ; j < nLen2 ; j ++ ) { final int ch2 = ...
Main generic Levenshtein implementation that uses 1 for all costs!
16,241
private static int _getDistance ( final char [ ] aStr1 , final int nLen1 , final char [ ] aStr2 , final int nLen2 , final int nCostInsert , final int nCostDelete , final int nCostSubstitution ) { int [ ] aPrevRow = new int [ nLen1 + 1 ] ; int [ ] aCurRow = new int [ nLen1 + 1 ] ; for ( int i = 0 ; i <= nLen1 ; i ++ ) a...
Main generic Levenshtein implementation . Assume all preconditions are checked .
16,242
public static String getUnifiedEmailAddress ( final String sEmailAddress ) { return sEmailAddress == null ? null : sEmailAddress . trim ( ) . toLowerCase ( Locale . US ) ; }
Get the unified version of an email address . It trims leading and trailing spaces and lower - cases the email address .
16,243
public static boolean isValid ( final String sEmailAddress ) { if ( sEmailAddress == null ) return false ; final String sUnifiedEmail = getUnifiedEmailAddress ( sEmailAddress ) ; return s_aPattern . matcher ( sUnifiedEmail ) . matches ( ) ; }
Checks if a value is a valid e - mail address according to a certain regular expression .
16,244
public static ESuccess writeMap ( final Map < String , String > aMap , final OutputStream aOS ) { ValueEnforcer . notNull ( aMap , "Map" ) ; ValueEnforcer . notNull ( aOS , "OutputStream" ) ; try { final IMicroDocument aDoc = createMapDocument ( aMap ) ; return MicroWriter . writeToStream ( aDoc , aOS , XMLWriterSettin...
Write the passed map to the passed output stream using the predefined XML layout .
16,245
public static Transformer newTransformer ( final TransformerFactory aTransformerFactory ) { ValueEnforcer . notNull ( aTransformerFactory , "TransformerFactory" ) ; try { return aTransformerFactory . newTransformer ( ) ; } catch ( final TransformerConfigurationException ex ) { LOGGER . error ( "Failed to create transfo...
Create a new XSLT transformer for no specific resource .
16,246
public String getRest ( ) { final String ret = m_sInput . substring ( m_nCurIndex ) ; m_nCurIndex = m_nMaxIndex ; return ret ; }
Get all remaining chars and set the index to the end of the input string
16,247
public String getUntil ( final char cEndExcl ) { final int nStart = m_nCurIndex ; while ( m_nCurIndex < m_nMaxIndex && getCurrentChar ( ) != cEndExcl ) ++ m_nCurIndex ; return m_sInput . substring ( nStart , m_nCurIndex ) ; }
Get the string until the specified end character but excluding the end character .
16,248
public DATATYPE getIfChanged ( final DATATYPE aUnchangedValue ) { return m_eChange . isChanged ( ) ? m_aObj : aUnchangedValue ; }
Get the store value if this is a change . Otherwise the passed unchanged value is returned .
16,249
public DATATYPE getIfUnchanged ( final DATATYPE aChangedValue ) { return m_eChange . isUnchanged ( ) ? m_aObj : aChangedValue ; }
Get the store value if this is unchanged . Otherwise the passed changed value is returned .
16,250
public static < DATATYPE > ChangeWithValue < DATATYPE > createChanged ( final DATATYPE aValue ) { return new ChangeWithValue < > ( EChange . CHANGED , aValue ) ; }
Create a new changed object with the given value .
16,251
public static < DATATYPE > ChangeWithValue < DATATYPE > createUnchanged ( final DATATYPE aValue ) { return new ChangeWithValue < > ( EChange . UNCHANGED , aValue ) ; }
Create a new unchanged object with the given value .
16,252
public static ICommonsList < IAuthToken > getAllTokensOfSubject ( final IAuthSubject aSubject ) { ValueEnforcer . notNull ( aSubject , "Subject" ) ; return s_aRWLock . readLocked ( ( ) -> CommonsArrayList . createFiltered ( s_aMap . values ( ) , aToken -> aToken . getIdentification ( ) . hasAuthSubject ( aSubject ) ) )...
Get all tokens of the specified auth subject . All tokens are returned no matter whether they are expired or not .
16,253
public static int removeAllTokensOfSubject ( final IAuthSubject aSubject ) { ValueEnforcer . notNull ( aSubject , "Subject" ) ; final ICommonsList < String > aDelTokenIDs = new CommonsArrayList < > ( ) ; s_aRWLock . readLocked ( ( ) -> { for ( final Map . Entry < String , AuthToken > aEntry : s_aMap . entrySet ( ) ) if...
Remove all tokens of the given subject
16,254
public static < ENUMTYPE extends Enum < ENUMTYPE > & IHasName > ENUMTYPE getFromNameCaseInsensitiveOrNull ( final Class < ENUMTYPE > aClass , final String sName ) { return getFromNameCaseInsensitiveOrDefault ( aClass , sName , null ) ; }
Get the enum value with the passed name case insensitive
16,255
public static String getEnumID ( final Enum < ? > aEnum ) { return aEnum . getClass ( ) . getName ( ) + '.' + aEnum . name ( ) ; }
Get the unique name of the passed enum entry .
16,256
protected IReadableResource internalResolveResource ( final String sType , final String sNamespaceURI , final String sPublicId , final String sSystemId , final String sBaseURI ) throws Exception { if ( DEBUG_RESOLVE ) if ( LOGGER . isInfoEnabled ( ) ) LOGGER . info ( "internalResolveResource (" + sType + ", " + sNamesp...
Internal resource resolving
16,257
public final LSInput mainResolveResource ( final String sType , final String sNamespaceURI , final String sPublicId , final String sSystemId , final String sBaseURI ) { try { final IReadableResource aResolvedResource = internalResolveResource ( sType , sNamespaceURI , sPublicId , sSystemId , sBaseURI ) ; return new Res...
Resolve a resource with the passed parameters
16,258
public static < ELEMENTTYPE > NonBlockingStack < ELEMENTTYPE > newStack ( final ELEMENTTYPE aValue ) { final NonBlockingStack < ELEMENTTYPE > ret = newStack ( ) ; ret . push ( aValue ) ; return ret ; }
Create a new stack with a single element .
16,259
public static < ELEMENTTYPE > NonBlockingStack < ELEMENTTYPE > newStack ( final ELEMENTTYPE ... aValues ) { return new NonBlockingStack < > ( aValues ) ; }
Create a new stack from the given array .
16,260
public static < ELEMENTTYPE > NonBlockingStack < ELEMENTTYPE > newStack ( final Collection < ? extends ELEMENTTYPE > aValues ) { return new NonBlockingStack < > ( aValues ) ; }
Create a new stack from the given collection .
16,261
protected void validateOutgoingBusinessDocument ( final Element aXML ) throws AS2ClientBuilderException { if ( m_aVESRegistry == null ) { m_aVESRegistry = createValidationRegistry ( ) ; } final IValidationExecutorSet aVES = m_aVESRegistry . getOfID ( m_aVESID ) ; if ( aVES == null ) throw new AS2ClientBuilderException ...
Perform the standard PEPPOL validation of the outgoing business document before sending takes place . In case validation fails an exception is thrown . The validation is configured using the validation key . This method is only called when a validation key was set .
16,262
public ISessionScope getSessionScopeOfID ( final String sScopeID ) { if ( StringHelper . hasNoText ( sScopeID ) ) return null ; return m_aRWLock . readLocked ( ( ) -> m_aSessionScopes . get ( sScopeID ) ) ; }
Get the session scope with the specified ID . If no such scope exists no further actions are taken .
16,263
public void onScopeEnd ( final ISessionScope aSessionScope ) { ValueEnforcer . notNull ( aSessionScope , "SessionScope" ) ; if ( aSessionScope . isValid ( ) ) { final String sSessionID = aSessionScope . getID ( ) ; final boolean bCanDestroyScope = m_aRWLock . writeLocked ( ( ) -> { boolean bWLCanDestroyScope = false ; ...
Close the passed session scope gracefully . Each managed scope is guaranteed to be destroyed only once . First the SPI manager is invoked and afterwards the scope is destroyed .
16,264
public void destroyAllSessions ( ) { for ( final ISessionScope aSessionScope : getAllSessionScopes ( ) ) { if ( aSessionScope . selfDestruct ( ) . isContinue ( ) ) { onScopeEnd ( aSessionScope ) ; } } _checkIfAnySessionsExist ( ) ; }
Destroy all known session scopes . After this method it is ensured that the internal session map is empty .
16,265
public static IGlobalScope onGlobalBegin ( final String sScopeID ) { return onGlobalBegin ( sScopeID , GlobalScope :: new ) ; }
This method is used to set the initial global scope .
16,266
public static void onGlobalEnd ( ) { s_aGlobalLock . locked ( ( ) -> { if ( s_aGlobalScope != null ) { ScopeSPIManager . getInstance ( ) . onGlobalScopeEnd ( s_aGlobalScope ) ; final String sDestroyedScopeID = s_aGlobalScope . getID ( ) ; s_aGlobalScope . destroyScope ( ) ; s_aGlobalScope = null ; if ( ScopeHelper . de...
To be called when the singleton global context is to be destroyed .
16,267
public static void destroySessionScope ( final ISessionScope aSessionScope ) { ValueEnforcer . notNull ( aSessionScope , "SessionScope" ) ; ScopeSessionManager . getInstance ( ) . onScopeEnd ( aSessionScope ) ; }
Manually destroy the passed session scope .
16,268
public static void onRequestEnd ( ) { final IRequestScope aRequestScope = getRequestScopeOrNull ( ) ; try { if ( aRequestScope != null ) { _destroyRequestScope ( aRequestScope ) ; } else { LOGGER . warn ( "No request scope present that could be ended!" ) ; } } finally { internalClearRequestScope ( ) ; } }
To be called after a request finished .
16,269
public void onDocumentType ( final String sQualifiedElementName , final String sPublicID , final String sSystemID ) { ValueEnforcer . notNull ( sQualifiedElementName , "QualifiedElementName" ) ; final String sDocType = getDocTypeXMLRepresentation ( m_eXMLVersion , m_aXMLWriterSettings . getIncorrectCharacterHandling ( ...
On XML document type .
16,270
public void onProcessingInstruction ( final String sTarget , final String sData ) { _append ( PI_START ) . _append ( sTarget ) ; if ( StringHelper . hasText ( sData ) ) _append ( ' ' ) . _append ( sData ) ; _append ( PI_END ) ; newLine ( ) ; }
On processing instruction
16,271
public void onEntityReference ( final String sEntityRef ) { _append ( ER_START ) . _append ( sEntityRef ) . _append ( ER_END ) ; }
On entity reference .
16,272
public void onContentElementWhitespace ( final CharSequence aWhitespaces ) { if ( StringHelper . hasText ( aWhitespaces ) ) _append ( aWhitespaces . toString ( ) ) ; }
Ignorable whitespace characters .
16,273
public void onComment ( final String sComment ) { if ( StringHelper . hasText ( sComment ) ) { if ( isThrowExceptionOnNestedComments ( ) ) if ( sComment . contains ( COMMENT_START ) || sComment . contains ( COMMENT_END ) ) throw new IllegalArgumentException ( "XML comment contains nested XML comment: " + sComment ) ; _...
Comment node .
16,274
public void onText ( final char [ ] aText , final int nOfs , final int nLen ) { onText ( aText , nOfs , nLen , true ) ; }
XML text node .
16,275
public void onCDATA ( final String sText ) { if ( StringHelper . hasText ( sText ) ) { if ( sText . indexOf ( CDATA_END ) >= 0 ) { final ICommonsList < String > aParts = StringHelper . getExploded ( CDATA_END , sText ) ; final int nParts = aParts . size ( ) ; for ( int i = 0 ; i < nParts ; ++ i ) { _append ( CDATA_STAR...
CDATA node .
16,276
public void onElementStart ( final String sNamespacePrefix , final String sTagName , final Map < QName , String > aAttrs , final EXMLSerializeBracketMode eBracketMode ) { elementStartOpen ( sNamespacePrefix , sTagName ) ; if ( aAttrs != null && ! aAttrs . isEmpty ( ) ) { if ( m_bOrderAttributesAndNamespaces ) { final I...
Start of an element .
16,277
public void onElementEnd ( final String sNamespacePrefix , final String sTagName , final EXMLSerializeBracketMode eBracketMode ) { if ( eBracketMode . isOpenClose ( ) ) { _append ( "</" ) ; if ( StringHelper . hasText ( sNamespacePrefix ) ) _appendMasked ( EXMLCharMode . ELEMENT_NAME , sNamespacePrefix ) . _append ( CX...
End of an element .
16,278
private void _registerTypeConverter ( final Class < ? > aSrcClass , final Class < ? > aDstClass , final ITypeConverter < ? , ? > aConverter ) { ValueEnforcer . notNull ( aSrcClass , "SrcClass" ) ; ValueEnforcer . isTrue ( ClassHelper . isPublic ( aSrcClass ) , ( ) -> "Source " + aSrcClass + " is no public class!" ) ; V...
Register a default type converter .
16,279
private void _iterateFuzzyConverters ( final Class < ? > aSrcClass , final Class < ? > aDstClass , final ITypeConverterCallback aCallback ) { for ( final WeakReference < Class < ? > > aCurWRSrcClass : ClassHierarchyCache . getClassHierarchyIterator ( aSrcClass ) ) { final Class < ? > aCurSrcClass = aCurWRSrcClass . get...
Iterate all possible fuzzy converters from source class to destination class .
16,280
public void iterateAllRegisteredTypeConverters ( final ITypeConverterCallback aCallback ) { final Map < Class < ? > , Map < Class < ? > , ITypeConverter < ? , ? > > > aCopy = m_aRWLock . readLocked ( ( ) -> new CommonsHashMap < > ( m_aConverter ) ) ; outer : for ( final Map . Entry < Class < ? > , Map < Class < ? > , I...
Iterate all registered type converters . For informational purposes only .
16,281
public static Class < ? > [ ] getClassArray ( final Object ... aObjs ) { if ( ArrayHelper . isEmpty ( aObjs ) ) return EMPTY_CLASS_ARRAY ; final Class < ? > [ ] ret = new Class < ? > [ aObjs . length ] ; for ( int i = 0 ; i < aObjs . length ; ++ i ) ret [ i ] = aObjs [ i ] . getClass ( ) ; return ret ; }
Get an array with all the classes of the passed object array .
16,282
public static < RETURNTYPE > RETURNTYPE invokeMethod ( final Object aSrcObj , final String sMethodName , final Object ... aArgs ) throws NoSuchMethodException , IllegalAccessException , InvocationTargetException { return GenericReflection . < RETURNTYPE > invokeMethod ( aSrcObj , sMethodName , getClassArray ( aArgs ) ,...
This method dynamically invokes the method with the given name on the given object .
16,283
public static < DATATYPE > DATATYPE newInstance ( final DATATYPE aObj ) throws IllegalAccessException , NoSuchMethodException , InvocationTargetException , InstantiationException { return findConstructor ( aObj ) . newInstance ( ) ; }
Create a new instance of the class identified by the passed object . The default constructor will be invoked .
16,284
public static final < T extends AbstractRequestSingleton > T getRequestSingleton ( final Class < T > aClass ) { return getSingleton ( _getStaticScope ( true ) , aClass ) ; }
Get the singleton object in the current request scope using the passed class . If the singleton is not yet instantiated a new instance is created .
16,285
public static void forAllClassPathEntries ( final Consumer < ? super String > aConsumer ) { StringHelper . explode ( SystemProperties . getPathSeparator ( ) , SystemProperties . getJavaClassPath ( ) , aConsumer ) ; }
Add all class path entries into the provided target list .
16,286
public static void printClassPathEntries ( final PrintStream aPS , final String sItemSeparator ) { forAllClassPathEntries ( x -> { aPS . print ( x ) ; aPS . print ( sItemSeparator ) ; } ) ; }
Print all class path entries on the passed print stream using the passed separator
16,287
public static ESuccess writeToStream ( final IMicroNode aNode , final OutputStream aOS ) { return writeToStream ( aNode , aOS , XMLWriterSettings . DEFAULT_XML_SETTINGS ) ; }
Write a Micro Node to an output stream using the default settings .
16,288
public static String getNodeAsString ( final IMicroNode aNode , final IXMLWriterSettings aSettings ) { ValueEnforcer . notNull ( aNode , "Node" ) ; ValueEnforcer . notNull ( aSettings , "Settings" ) ; try ( final NonBlockingStringWriter aWriter = new NonBlockingStringWriter ( 50 * CGlobal . BYTES_PER_KILOBYTE ) ) { if ...
Convert the passed micro node to an XML string using the provided settings .
16,289
public static byte [ ] getNodeAsBytes ( final IMicroNode aNode , final IXMLWriterSettings aSettings ) { ValueEnforcer . notNull ( aNode , "Node" ) ; ValueEnforcer . notNull ( aSettings , "Settings" ) ; try ( final NonBlockingByteArrayOutputStream aBAOS = new NonBlockingByteArrayOutputStream ( 50 * CGlobal . BYTES_PER_K...
Convert the passed micro node to an XML byte array using the provided settings .
16,290
public static < KEYTYPE , DATATYPE , ITEMTYPE extends ITreeItemWithID < KEYTYPE , DATATYPE , ITEMTYPE > > void sortByID ( final IBasicTree < DATATYPE , ITEMTYPE > aTree , final Comparator < ? super KEYTYPE > aKeyComparator ) { _sort ( aTree , Comparator . comparing ( IHasID :: getID , aKeyComparator ) ) ; }
Sort each level of the passed tree on the ID with the specified comparator .
16,291
public static < KEYTYPE , DATATYPE , ITEMTYPE extends ITreeItemWithID < KEYTYPE , DATATYPE , ITEMTYPE > > void sortByValue ( final IBasicTree < DATATYPE , ITEMTYPE > aTree , final Comparator < ? super DATATYPE > aValueComparator ) { _sort ( aTree , Comparator . comparing ( IBasicTreeItem :: getData , aValueComparator )...
Sort each level of the passed tree on the value with the specified comparator .
16,292
public final EChange start ( ) { if ( m_nStartDT > 0 ) return EChange . UNCHANGED ; m_nStartDT = getCurrentNanoTime ( ) ; return EChange . CHANGED ; }
Start the stop watch .
16,293
public EChange stop ( ) { if ( m_nStartDT == 0 ) return EChange . UNCHANGED ; final long nCurrentNanoTime = getCurrentNanoTime ( ) ; m_nDurationNanos += ( nCurrentNanoTime - m_nStartDT ) ; m_nStartDT = 0 ; return EChange . CHANGED ; }
Stop the stop watch .
16,294
public static TimeValue runMeasured ( final Runnable aRunnable ) { final StopWatch aSW = createdStarted ( ) ; aRunnable . run ( ) ; final long nNanos = aSW . stopAndGetNanos ( ) ; return new TimeValue ( TimeUnit . NANOSECONDS , nNanos ) ; }
Run the passed runnable and measure the time .
16,295
public ErrorTextProvider addItem ( final EField eField , final String sText ) { return addItem ( new FormattableItem ( eField , sText ) ) ; }
Add an error item to be disabled .
16,296
public int compareTo ( final Version rhs ) { ValueEnforcer . notNull ( rhs , "Rhs" ) ; int ret = m_nMajor - rhs . m_nMajor ; if ( ret == 0 ) { ret = m_nMinor - rhs . m_nMinor ; if ( ret == 0 ) { ret = m_nMicro - rhs . m_nMicro ; if ( ret == 0 ) { if ( m_sQualifier != null ) { if ( rhs . m_sQualifier != null ) { ret = m...
Compares two Version objects .
16,297
public String getAsString ( final boolean bPrintZeroElements , final boolean bPrintAtLeastMajorAndMinor ) { final StringBuilder aSB = new StringBuilder ( m_sQualifier != null ? m_sQualifier : "" ) ; if ( m_nMicro > 0 || aSB . length ( ) > 0 || bPrintZeroElements ) { if ( aSB . length ( ) > 0 ) aSB . insert ( 0 , '.' ) ...
Get the string representation of the version number .
16,298
public static Version parse ( final String sVersionString , final boolean bOldVersion ) { final String s = sVersionString == null ? "" : sVersionString . trim ( ) ; if ( s . length ( ) == 0 ) return DEFAULT_VERSION ; int nMajor ; int nMinor ; int nMicro ; String sQualifier ; if ( bOldVersion ) { final String [ ] aParts...
Construct a version object from a string .
16,299
private void _appendOptionGroup ( final StringBuilder aSB , final OptionGroup aGroup ) { if ( ! aGroup . isRequired ( ) ) aSB . append ( '[' ) ; final ICommonsList < Option > optList = aGroup . getAllOptions ( ) ; if ( m_aOptionComparator != null ) optList . sort ( m_aOptionComparator ) ; final Iterator < Option > it =...
Appends the usage clause for an OptionGroup to a StringBuilder . The clause is wrapped in square brackets if the group is required . The display of the options is handled by appendOption