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,600
recombee/java-api-client
src/main/java/com/recombee/api_client/bindings/RecommendationResponse.java
RecommendationResponse.getIds
public String[] getIds() { String[] ids = new String[recomms.length]; for(int i = 0; i< recomms.length; i++) ids[i] = recomms[i].getId(); return ids; }
java
public String[] getIds() { String[] ids = new String[recomms.length]; for(int i = 0; i< recomms.length; i++) ids[i] = recomms[i].getId(); return ids; }
[ "public", "String", "[", "]", "getIds", "(", ")", "{", "String", "[", "]", "ids", "=", "new", "String", "[", "recomms", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "recomms", ".", "length", ";", "i", "++", ")", "...
Get ids of recommended entities
[ "Get", "ids", "of", "recommended", "entities" ]
a00389554a419410ac0bdd8c4d0f1d3ea514f120
https://github.com/recombee/java-api-client/blob/a00389554a419410ac0bdd8c4d0f1d3ea514f120/src/main/java/com/recombee/api_client/bindings/RecommendationResponse.java#L61-L66
136,601
ribot/easy-adapter
library/src/main/java/uk/co/ribot/easyadapter/ItemViewHolder.java
ItemViewHolder.getListener
@Nullable public <P> P getListener(Class<P> type) { if (mListener != null) { return type.cast(mListener); } return null; }
java
@Nullable public <P> P getListener(Class<P> type) { if (mListener != null) { return type.cast(mListener); } return null; }
[ "@", "Nullable", "public", "<", "P", ">", "P", "getListener", "(", "Class", "<", "P", ">", "type", ")", "{", "if", "(", "mListener", "!=", "null", ")", "{", "return", "type", ".", "cast", "(", "mListener", ")", ";", "}", "return", "null", ";", "}...
Gets the listener object that was passed into the Adapter through its constructor and cast it to a given type. @param type the type of the listener @return the listener casted to the given type or null if not listener was set into the Adapter.
[ "Gets", "the", "listener", "object", "that", "was", "passed", "into", "the", "Adapter", "through", "its", "constructor", "and", "cast", "it", "to", "a", "given", "type", "." ]
8cf85023a79c781aa2013e9dc39fd66734fb2019
https://github.com/ribot/easy-adapter/blob/8cf85023a79c781aa2013e9dc39fd66734fb2019/library/src/main/java/uk/co/ribot/easyadapter/ItemViewHolder.java#L108-L114
136,602
ribot/easy-adapter
demo/src/main/java/uk/co/ribot/easyadapterdemo/PersonViewHolder.java
PersonViewHolder.onSetListeners
@Override public void onSetListeners() { imageViewPerson.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { PersonHolderListener listener = getListener(PersonHolderListener.class); if (listener != null) { listener.onPersonImageClicked(getItem()); } } }); }
java
@Override public void onSetListeners() { imageViewPerson.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { PersonHolderListener listener = getListener(PersonHolderListener.class); if (listener != null) { listener.onPersonImageClicked(getItem()); } } }); }
[ "@", "Override", "public", "void", "onSetListeners", "(", ")", "{", "imageViewPerson", ".", "setOnClickListener", "(", "new", "View", ".", "OnClickListener", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "View", "v", ")", "{", "PersonHold...
Optionally override onSetListeners to add listeners to the views.
[ "Optionally", "override", "onSetListeners", "to", "add", "listeners", "to", "the", "views", "." ]
8cf85023a79c781aa2013e9dc39fd66734fb2019
https://github.com/ribot/easy-adapter/blob/8cf85023a79c781aa2013e9dc39fd66734fb2019/demo/src/main/java/uk/co/ribot/easyadapterdemo/PersonViewHolder.java#L60-L71
136,603
ribot/easy-adapter
demo/src/main/java/uk/co/ribot/easyadapterdemo/DataProvider.java
DataProvider.getMockPeopleSet1
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(new Person("Vincent Green", "07123456789", R.drawable.male2)); listPeople.add(new Person("Ada Underwood", "07123456789", R.drawable.female2)); listPeople.add(new Person("Daniel Erickson", "07123456789", R.drawable.male3)); listPeople.add(new Person("Maria Ramsey", "07123456789", R.drawable.female3)); listPeople.add(new Person("Rosemary Munoz", "07123456789", R.drawable.female4)); listPeople.add(new Person("John Singleton", "07123456789", R.drawable.male4)); listPeople.add(new Person("Lorena Bowen", "07123456789", R.drawable.female5)); listPeople.add(new Person("Kevin Stokes", "07123456789", R.drawable.male5)); listPeople.add(new Person("Johnny Sanders", "07123456789", R.drawable.male6)); listPeople.add(new Person("Jim Ramirez", "07123456789", R.drawable.male7)); listPeople.add(new Person("Cassandra Hunter", "07123456789", R.drawable.female6)); listPeople.add(new Person("Viola Guerrero", "07123456789", R.drawable.female7)); return listPeople; }
java
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(new Person("Vincent Green", "07123456789", R.drawable.male2)); listPeople.add(new Person("Ada Underwood", "07123456789", R.drawable.female2)); listPeople.add(new Person("Daniel Erickson", "07123456789", R.drawable.male3)); listPeople.add(new Person("Maria Ramsey", "07123456789", R.drawable.female3)); listPeople.add(new Person("Rosemary Munoz", "07123456789", R.drawable.female4)); listPeople.add(new Person("John Singleton", "07123456789", R.drawable.male4)); listPeople.add(new Person("Lorena Bowen", "07123456789", R.drawable.female5)); listPeople.add(new Person("Kevin Stokes", "07123456789", R.drawable.male5)); listPeople.add(new Person("Johnny Sanders", "07123456789", R.drawable.male6)); listPeople.add(new Person("Jim Ramirez", "07123456789", R.drawable.male7)); listPeople.add(new Person("Cassandra Hunter", "07123456789", R.drawable.female6)); listPeople.add(new Person("Viola Guerrero", "07123456789", R.drawable.female7)); return listPeople; }
[ "public", "static", "List", "<", "Person", ">", "getMockPeopleSet1", "(", ")", "{", "List", "<", "Person", ">", "listPeople", "=", "new", "ArrayList", "<", "Person", ">", "(", ")", ";", "listPeople", ".", "add", "(", "new", "Person", "(", "\"Henry Blair\...
Returns a mock List of Person objects
[ "Returns", "a", "mock", "List", "of", "Person", "objects" ]
8cf85023a79c781aa2013e9dc39fd66734fb2019
https://github.com/ribot/easy-adapter/blob/8cf85023a79c781aa2013e9dc39fd66734fb2019/demo/src/main/java/uk/co/ribot/easyadapterdemo/DataProvider.java#L24-L41
136,604
ribot/easy-adapter
library/src/main/java/uk/co/ribot/easyadapter/EasyAdapterUtil.java
EasyAdapterUtil.createViewHolder
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) { throw new RuntimeException(e); } catch (NoSuchMethodException e) { throw new RuntimeException("Unable to find a public constructor that takes an argument View in " + itemViewHolderClass.getSimpleName(), e); } catch (InvocationTargetException e) { throw new RuntimeException(e.getTargetException()); } catch (InstantiationException e) { throw new RuntimeException("Unable to instantiate " + itemViewHolderClass.getSimpleName(), e); } }
java
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) { throw new RuntimeException(e); } catch (NoSuchMethodException e) { throw new RuntimeException("Unable to find a public constructor that takes an argument View in " + itemViewHolderClass.getSimpleName(), e); } catch (InvocationTargetException e) { throw new RuntimeException(e.getTargetException()); } catch (InstantiationException e) { throw new RuntimeException("Unable to instantiate " + itemViewHolderClass.getSimpleName(), e); } }
[ "public", "static", "ItemViewHolder", "createViewHolder", "(", "View", "view", ",", "Class", "<", "?", "extends", "ItemViewHolder", ">", "itemViewHolderClass", ")", "{", "try", "{", "Constructor", "<", "?", "extends", "ItemViewHolder", ">", "constructor", "=", "...
Create a new ItemViewHolder using Java reflection
[ "Create", "a", "new", "ItemViewHolder", "using", "Java", "reflection" ]
8cf85023a79c781aa2013e9dc39fd66734fb2019
https://github.com/ribot/easy-adapter/blob/8cf85023a79c781aa2013e9dc39fd66734fb2019/library/src/main/java/uk/co/ribot/easyadapter/EasyAdapterUtil.java#L13-L27
136,605
ribot/easy-adapter
library/src/main/java/uk/co/ribot/easyadapter/EasyAdapterUtil.java
EasyAdapterUtil.parseItemLayoutId
public static Integer parseItemLayoutId(Class<? extends ItemViewHolder> itemViewHolderClass) { Integer itemLayoutId = ClassAnnotationParser.getLayoutId(itemViewHolderClass); if (itemLayoutId == null) { throw new LayoutIdMissingException(); } return itemLayoutId; }
java
public static Integer parseItemLayoutId(Class<? extends ItemViewHolder> itemViewHolderClass) { Integer itemLayoutId = ClassAnnotationParser.getLayoutId(itemViewHolderClass); if (itemLayoutId == null) { throw new LayoutIdMissingException(); } return itemLayoutId; }
[ "public", "static", "Integer", "parseItemLayoutId", "(", "Class", "<", "?", "extends", "ItemViewHolder", ">", "itemViewHolderClass", ")", "{", "Integer", "itemLayoutId", "=", "ClassAnnotationParser", ".", "getLayoutId", "(", "itemViewHolderClass", ")", ";", "if", "(...
Parses the layout ID annotation form the itemViewHolderClass
[ "Parses", "the", "layout", "ID", "annotation", "form", "the", "itemViewHolderClass" ]
8cf85023a79c781aa2013e9dc39fd66734fb2019
https://github.com/ribot/easy-adapter/blob/8cf85023a79c781aa2013e9dc39fd66734fb2019/library/src/main/java/uk/co/ribot/easyadapter/EasyAdapterUtil.java#L30-L36
136,606
phax/ph-commons
ph-scopes/src/main/java/com/helger/scope/singleton/AbstractSingleton.java
AbstractSingleton.getSingletonScopeKey
@Nonnull public static final String getSingletonScopeKey (@Nonnull final Class <? extends AbstractSingleton> aClass) { ValueEnforcer.notNull (aClass, "Class"); // Preallocate some bytes return new StringBuilder (DEFAULT_KEY_LENGTH).append ("singleton.").append (aClass.getName ()).toString (); }
java
@Nonnull public static final String getSingletonScopeKey (@Nonnull final Class <? extends AbstractSingleton> aClass) { ValueEnforcer.notNull (aClass, "Class"); // Preallocate some bytes return new StringBuilder (DEFAULT_KEY_LENGTH).append ("singleton.").append (aClass.getName ()).toString (); }
[ "@", "Nonnull", "public", "static", "final", "String", "getSingletonScopeKey", "(", "@", "Nonnull", "final", "Class", "<", "?", "extends", "AbstractSingleton", ">", "aClass", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aClass", ",", "\"Class\"", ")", ";",...
Create the key which is used to reference the object within the scope. @param aClass The class for which the key is to be created. May not be <code>null</code>. @return The non-<code>null</code> key.
[ "Create", "the", "key", "which", "is", "used", "to", "reference", "the", "object", "within", "the", "scope", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-scopes/src/main/java/com/helger/scope/singleton/AbstractSingleton.java#L387-L394
136,607
phax/ph-commons
ph-scopes/src/main/java/com/helger/scope/singleton/AbstractSingleton.java
AbstractSingleton.isSingletonInstantiated
public static final boolean isSingletonInstantiated (@Nullable final IScope aScope, @Nonnull final Class <? extends AbstractSingleton> aClass) { return getSingletonIfInstantiated (aScope, aClass) != null; }
java
public static final boolean isSingletonInstantiated (@Nullable final IScope aScope, @Nonnull final Class <? extends AbstractSingleton> aClass) { return getSingletonIfInstantiated (aScope, aClass) != null; }
[ "public", "static", "final", "boolean", "isSingletonInstantiated", "(", "@", "Nullable", "final", "IScope", "aScope", ",", "@", "Nonnull", "final", "Class", "<", "?", "extends", "AbstractSingleton", ">", "aClass", ")", "{", "return", "getSingletonIfInstantiated", ...
Check if a singleton is already instantiated inside a scope @param aScope The scope to check. May be <code>null</code> to avoid constructing a scope. @param aClass The class to be checked. May not be <code>null</code>. @return <code>true</code> if the singleton for the specified class is already instantiated, <code>false</code> otherwise.
[ "Check", "if", "a", "singleton", "is", "already", "instantiated", "inside", "a", "scope" ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-scopes/src/main/java/com/helger/scope/singleton/AbstractSingleton.java#L447-L451
136,608
phax/ph-commons
ph-scopes/src/main/java/com/helger/scope/singleton/AbstractSingleton.java
AbstractSingleton.getSingleton
@Nonnull public static final <T extends AbstractSingleton> T getSingleton (@Nonnull final IScope aScope, @Nonnull final Class <T> aClass) { ValueEnforcer.notNull (aScope, "aScope"); ValueEnforcer.notNull (aClass, "Class"); final String sSingletonScopeKey = getSingletonScopeKey (aClass); // check if already contained in passed scope T aInstance = s_aRWLock.readLocked ( () -> aScope.attrs ().getCastedValue (sSingletonScopeKey)); if (aInstance == null || aInstance.isInInstantiation ()) { // Not yet present or just in instantiation // Safe instantiation check in write lock s_aRWLock.writeLock ().lock (); try { // Check again in write lock aInstance = aScope.attrs ().getCastedValue (sSingletonScopeKey); if (aInstance == null) { // Main instantiation aInstance = _instantiateSingleton (aClass, aScope); // Set in scope so that recursive calls to the same singleton are // caught appropriately aScope.attrs ().putIn (sSingletonScopeKey, aInstance); // Start the initialization process // Do this after the instance was added to the scope aInstance.setInInstantiation (true); try { // Invoke callback method aInstance.onAfterInstantiation (aScope); // Set "instantiated" only if no exception was thrown aInstance.setInstantiated (true); } finally { // Ensure field is reset even in case of an exception aInstance.setInInstantiation (false); } // And some statistics s_aStatsCounterInstantiate.increment (sSingletonScopeKey); } else { // May not be instantiated if this method is called from the same // thread as the original instantiation } // We have the instance - maybe from re-querying the scope, maybe from // instantiation } finally { s_aRWLock.writeLock ().unlock (); } } // This happens too often in practice, therefore this is disabled if (SingletonHelper.isDebugConsistency ()) { // Just a small note in case we're returning an unusable object if (!aInstance.isUsableObject ()) if (LOGGER.isWarnEnabled ()) LOGGER.warn ("Singleton '" + aClass.getName () + "' is not usable - please check your calling order: " + aInstance.toString (), SingletonHelper.getDebugStackTrace ()); } return aInstance; }
java
@Nonnull public static final <T extends AbstractSingleton> T getSingleton (@Nonnull final IScope aScope, @Nonnull final Class <T> aClass) { ValueEnforcer.notNull (aScope, "aScope"); ValueEnforcer.notNull (aClass, "Class"); final String sSingletonScopeKey = getSingletonScopeKey (aClass); // check if already contained in passed scope T aInstance = s_aRWLock.readLocked ( () -> aScope.attrs ().getCastedValue (sSingletonScopeKey)); if (aInstance == null || aInstance.isInInstantiation ()) { // Not yet present or just in instantiation // Safe instantiation check in write lock s_aRWLock.writeLock ().lock (); try { // Check again in write lock aInstance = aScope.attrs ().getCastedValue (sSingletonScopeKey); if (aInstance == null) { // Main instantiation aInstance = _instantiateSingleton (aClass, aScope); // Set in scope so that recursive calls to the same singleton are // caught appropriately aScope.attrs ().putIn (sSingletonScopeKey, aInstance); // Start the initialization process // Do this after the instance was added to the scope aInstance.setInInstantiation (true); try { // Invoke callback method aInstance.onAfterInstantiation (aScope); // Set "instantiated" only if no exception was thrown aInstance.setInstantiated (true); } finally { // Ensure field is reset even in case of an exception aInstance.setInInstantiation (false); } // And some statistics s_aStatsCounterInstantiate.increment (sSingletonScopeKey); } else { // May not be instantiated if this method is called from the same // thread as the original instantiation } // We have the instance - maybe from re-querying the scope, maybe from // instantiation } finally { s_aRWLock.writeLock ().unlock (); } } // This happens too often in practice, therefore this is disabled if (SingletonHelper.isDebugConsistency ()) { // Just a small note in case we're returning an unusable object if (!aInstance.isUsableObject ()) if (LOGGER.isWarnEnabled ()) LOGGER.warn ("Singleton '" + aClass.getName () + "' is not usable - please check your calling order: " + aInstance.toString (), SingletonHelper.getDebugStackTrace ()); } return aInstance; }
[ "@", "Nonnull", "public", "static", "final", "<", "T", "extends", "AbstractSingleton", ">", "T", "getSingleton", "(", "@", "Nonnull", "final", "IScope", "aScope", ",", "@", "Nonnull", "final", "Class", "<", "T", ">", "aClass", ")", "{", "ValueEnforcer", "....
Get the singleton object in the passed scope, using the passed class. If the singleton is not yet instantiated, a new instance is created. @param <T> The singleton type @param aScope The scope to be used. May not be <code>null</code>. @param aClass The class to be used. May not be <code>null</code>. The class must be public as needs to have a public no-argument constructor. @return The singleton object and never <code>null</code>.
[ "Get", "the", "singleton", "object", "in", "the", "passed", "scope", "using", "the", "passed", "class", ".", "If", "the", "singleton", "is", "not", "yet", "instantiated", "a", "new", "instance", "is", "created", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-scopes/src/main/java/com/helger/scope/singleton/AbstractSingleton.java#L532-L611
136,609
phax/ph-commons
ph-scopes/src/main/java/com/helger/scope/singleton/AbstractSingleton.java
AbstractSingleton.getAllSingletons
@Nonnull @ReturnsMutableCopy public static final <T extends AbstractSingleton> ICommonsList <T> getAllSingletons (@Nullable final IScope aScope, @Nonnull final Class <T> aDesiredClass) { ValueEnforcer.notNull (aDesiredClass, "DesiredClass"); final ICommonsList <T> ret = new CommonsArrayList <> (); if (aScope != null) for (final Object aScopeValue : aScope.attrs ().values ()) if (aScopeValue != null && aDesiredClass.isAssignableFrom (aScopeValue.getClass ())) ret.add (aDesiredClass.cast (aScopeValue)); return ret; }
java
@Nonnull @ReturnsMutableCopy public static final <T extends AbstractSingleton> ICommonsList <T> getAllSingletons (@Nullable final IScope aScope, @Nonnull final Class <T> aDesiredClass) { ValueEnforcer.notNull (aDesiredClass, "DesiredClass"); final ICommonsList <T> ret = new CommonsArrayList <> (); if (aScope != null) for (final Object aScopeValue : aScope.attrs ().values ()) if (aScopeValue != null && aDesiredClass.isAssignableFrom (aScopeValue.getClass ())) ret.add (aDesiredClass.cast (aScopeValue)); return ret; }
[ "@", "Nonnull", "@", "ReturnsMutableCopy", "public", "static", "final", "<", "T", "extends", "AbstractSingleton", ">", "ICommonsList", "<", "T", ">", "getAllSingletons", "(", "@", "Nullable", "final", "IScope", "aScope", ",", "@", "Nonnull", "final", "Class", ...
Get all singleton objects registered in the respective sub-class of this class. @param <T> The singleton type to be retrieved @param aScope The scope to use. May be <code>null</code> to avoid creating a new scope. @param aDesiredClass The desired sub-class of this class. May not be <code>null</code>. @return A non-<code>null</code> list with all instances of the passed class in the passed scope.
[ "Get", "all", "singleton", "objects", "registered", "in", "the", "respective", "sub", "-", "class", "of", "this", "class", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-scopes/src/main/java/com/helger/scope/singleton/AbstractSingleton.java#L627-L640
136,610
phax/ph-commons
ph-tree/src/main/java/com/helger/tree/BasicTreeItem.java
BasicTreeItem.createChildItem
@Nonnull public final ITEMTYPE createChildItem (@Nullable final DATATYPE aData) { // create new item final ITEMTYPE aItem = m_aFactory.create (thisAsT ()); if (aItem == null) throw new IllegalStateException ("null item created!"); aItem.setData (aData); internalAddChild (aItem); return aItem; }
java
@Nonnull public final ITEMTYPE createChildItem (@Nullable final DATATYPE aData) { // create new item final ITEMTYPE aItem = m_aFactory.create (thisAsT ()); if (aItem == null) throw new IllegalStateException ("null item created!"); aItem.setData (aData); internalAddChild (aItem); return aItem; }
[ "@", "Nonnull", "public", "final", "ITEMTYPE", "createChildItem", "(", "@", "Nullable", "final", "DATATYPE", "aData", ")", "{", "// create new item", "final", "ITEMTYPE", "aItem", "=", "m_aFactory", ".", "create", "(", "thisAsT", "(", ")", ")", ";", "if", "(...
Add a child item to this item. @param aData the data associated with this item @return the created TreeItem object or <code>null</code> if the ID is already in use and bAllowOverwrite is false
[ "Add", "a", "child", "item", "to", "this", "item", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-tree/src/main/java/com/helger/tree/BasicTreeItem.java#L172-L182
136,611
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/collection/IteratorHelper.java
IteratorHelper.getCombinedIterator
@Nonnull public static <ELEMENTTYPE> Iterator <ELEMENTTYPE> getCombinedIterator (@Nullable final Iterator <? extends ELEMENTTYPE> aIter1, @Nullable final Iterator <? extends ELEMENTTYPE> aIter2) { return new CombinedIterator <> (aIter1, aIter2); }
java
@Nonnull public static <ELEMENTTYPE> Iterator <ELEMENTTYPE> getCombinedIterator (@Nullable final Iterator <? extends ELEMENTTYPE> aIter1, @Nullable final Iterator <? extends ELEMENTTYPE> aIter2) { return new CombinedIterator <> (aIter1, aIter2); }
[ "@", "Nonnull", "public", "static", "<", "ELEMENTTYPE", ">", "Iterator", "<", "ELEMENTTYPE", ">", "getCombinedIterator", "(", "@", "Nullable", "final", "Iterator", "<", "?", "extends", "ELEMENTTYPE", ">", "aIter1", ",", "@", "Nullable", "final", "Iterator", "<...
Get a merged iterator of both iterators. The first iterator is iterated first, the second one afterwards. @param <ELEMENTTYPE> The type of elements to be enumerated. @param aIter1 First iterator. May be <code>null</code>. @param aIter2 Second iterator. May be <code>null</code>. @return The merged iterator. Never <code>null</code>.
[ "Get", "a", "merged", "iterator", "of", "both", "iterators", ".", "The", "first", "iterator", "is", "iterated", "first", "the", "second", "one", "afterwards", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/collection/IteratorHelper.java#L185-L190
136,612
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/collection/IteratorHelper.java
IteratorHelper.getEnumeration
@Nonnull public static <ELEMENTTYPE> Enumeration <ELEMENTTYPE> getEnumeration (@Nullable final Iterator <ELEMENTTYPE> aIter) { if (aIter == null) return new EmptyEnumeration <> (); return new EnumerationFromIterator <> (aIter); }
java
@Nonnull public static <ELEMENTTYPE> Enumeration <ELEMENTTYPE> getEnumeration (@Nullable final Iterator <ELEMENTTYPE> aIter) { if (aIter == null) return new EmptyEnumeration <> (); return new EnumerationFromIterator <> (aIter); }
[ "@", "Nonnull", "public", "static", "<", "ELEMENTTYPE", ">", "Enumeration", "<", "ELEMENTTYPE", ">", "getEnumeration", "(", "@", "Nullable", "final", "Iterator", "<", "ELEMENTTYPE", ">", "aIter", ")", "{", "if", "(", "aIter", "==", "null", ")", "return", "...
Get an Enumeration object based on an Iterator object. @param <ELEMENTTYPE> the type of the elements in the container @param aIter iterator object to use @return an Enumeration object
[ "Get", "an", "Enumeration", "object", "based", "on", "an", "Iterator", "object", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/collection/IteratorHelper.java#L232-L238
136,613
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/collection/IteratorHelper.java
IteratorHelper.getEnumeration
@Nonnull public static <KEYTYPE, VALUETYPE> Enumeration <Map.Entry <KEYTYPE, VALUETYPE>> getEnumeration (@Nullable final Map <KEYTYPE, VALUETYPE> aMap) { if (aMap == null) return new EmptyEnumeration <> (); return getEnumeration (aMap.entrySet ()); }
java
@Nonnull public static <KEYTYPE, VALUETYPE> Enumeration <Map.Entry <KEYTYPE, VALUETYPE>> getEnumeration (@Nullable final Map <KEYTYPE, VALUETYPE> aMap) { if (aMap == null) return new EmptyEnumeration <> (); return getEnumeration (aMap.entrySet ()); }
[ "@", "Nonnull", "public", "static", "<", "KEYTYPE", ",", "VALUETYPE", ">", "Enumeration", "<", "Map", ".", "Entry", "<", "KEYTYPE", ",", "VALUETYPE", ">", ">", "getEnumeration", "(", "@", "Nullable", "final", "Map", "<", "KEYTYPE", ",", "VALUETYPE", ">", ...
Get an Enumeration object based on a Map object. @param <KEYTYPE> map key type @param <VALUETYPE> map value type @param aMap map object to use @return an Enumeration object
[ "Get", "an", "Enumeration", "object", "based", "on", "a", "Map", "object", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/collection/IteratorHelper.java#L251-L257
136,614
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/xpath/MapBasedXPathFunctionResolver.java
MapBasedXPathFunctionResolver.addAllFrom
@Nonnull public EChange addAllFrom (@Nonnull 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.containsKey (aEntry.getKey ())) { m_aMap.put (aEntry.getKey (), aEntry.getValue ()); eChange = EChange.CHANGED; } return eChange; }
java
@Nonnull public EChange addAllFrom (@Nonnull 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.containsKey (aEntry.getKey ())) { m_aMap.put (aEntry.getKey (), aEntry.getValue ()); eChange = EChange.CHANGED; } return eChange; }
[ "@", "Nonnull", "public", "EChange", "addAllFrom", "(", "@", "Nonnull", "final", "MapBasedXPathFunctionResolver", "aOther", ",", "final", "boolean", "bOverwrite", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aOther", ",", "\"Other\"", ")", ";", "EChange", "e...
Add all functions from the other function resolver into this resolver. @param aOther The function resolver to import the functions from. May not be <code>null</code>. @param bOverwrite if <code>true</code> existing functions will be overwritten with the new functions, otherwise the old functions are kept. @return {@link EChange}
[ "Add", "all", "functions", "from", "the", "other", "function", "resolver", "into", "this", "resolver", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/xpath/MapBasedXPathFunctionResolver.java#L129-L141
136,615
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/xpath/MapBasedXPathFunctionResolver.java
MapBasedXPathFunctionResolver.removeFunctionsWithName
@Nonnull public EChange removeFunctionsWithName (@Nullable final QName aName) { EChange eChange = EChange.UNCHANGED; if (aName != null) { // Make a copy of the key set to allow for inline modification for (final XPathFunctionKey aKey : m_aMap.copyOfKeySet ()) if (aKey.getFunctionName ().equals (aName)) eChange = eChange.or (removeFunction (aKey)); } return eChange; }
java
@Nonnull public EChange removeFunctionsWithName (@Nullable final QName aName) { EChange eChange = EChange.UNCHANGED; if (aName != null) { // Make a copy of the key set to allow for inline modification for (final XPathFunctionKey aKey : m_aMap.copyOfKeySet ()) if (aKey.getFunctionName ().equals (aName)) eChange = eChange.or (removeFunction (aKey)); } return eChange; }
[ "@", "Nonnull", "public", "EChange", "removeFunctionsWithName", "(", "@", "Nullable", "final", "QName", "aName", ")", "{", "EChange", "eChange", "=", "EChange", ".", "UNCHANGED", ";", "if", "(", "aName", "!=", "null", ")", "{", "// Make a copy of the key set to ...
Remove all functions with the same name. This can be helpful when the same function is registered for multiple parameters. @param aName The name to be removed. May be <code>null</code>. @return {@link EChange#CHANGED} if at least one function was removed.
[ "Remove", "all", "functions", "with", "the", "same", "name", ".", "This", "can", "be", "helpful", "when", "the", "same", "function", "is", "registered", "for", "multiple", "parameters", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/xpath/MapBasedXPathFunctionResolver.java#L182-L194
136,616
phax/ph-commons
ph-json/src/main/java/com/helger/json/serialize/JsonReader.java
JsonReader.parseJson
@Nonnull public static ESuccess parseJson (@Nonnull @WillClose final Reader aReader, @Nonnull final IJsonParserHandler aParserHandler) { return parseJson (aReader, aParserHandler, (IJsonParserCustomizeCallback) null, (IJsonParseExceptionCallback) null); }
java
@Nonnull public static ESuccess parseJson (@Nonnull @WillClose final Reader aReader, @Nonnull final IJsonParserHandler aParserHandler) { return parseJson (aReader, aParserHandler, (IJsonParserCustomizeCallback) null, (IJsonParseExceptionCallback) null); }
[ "@", "Nonnull", "public", "static", "ESuccess", "parseJson", "(", "@", "Nonnull", "@", "WillClose", "final", "Reader", "aReader", ",", "@", "Nonnull", "final", "IJsonParserHandler", "aParserHandler", ")", "{", "return", "parseJson", "(", "aReader", ",", "aParser...
Simple JSON parse method taking only the most basic parameters. @param aReader The reader to read from. Should be buffered. May not be <code>null</code>. @param aParserHandler The parser handler. May not be <code>null</code>. @return {@link ESuccess}
[ "Simple", "JSON", "parse", "method", "taking", "only", "the", "most", "basic", "parameters", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-json/src/main/java/com/helger/json/serialize/JsonReader.java#L114-L119
136,617
phax/ph-commons
ph-json/src/main/java/com/helger/json/serialize/JsonReader.java
JsonReader._validateJson
@Nonnull private static EValidity _validateJson (@Nonnull @WillClose final Reader aReader) { // Force silent parsing :) final ESuccess eSuccess = parseJson (aReader, new DoNothingJsonParserHandler (), (IJsonParserCustomizeCallback) null, ex -> {}); return EValidity.valueOf (eSuccess.isSuccess ()); }
java
@Nonnull private static EValidity _validateJson (@Nonnull @WillClose final Reader aReader) { // Force silent parsing :) final ESuccess eSuccess = parseJson (aReader, new DoNothingJsonParserHandler (), (IJsonParserCustomizeCallback) null, ex -> {}); return EValidity.valueOf (eSuccess.isSuccess ()); }
[ "@", "Nonnull", "private", "static", "EValidity", "_validateJson", "(", "@", "Nonnull", "@", "WillClose", "final", "Reader", "aReader", ")", "{", "// Force silent parsing :)", "final", "ESuccess", "eSuccess", "=", "parseJson", "(", "aReader", ",", "new", "DoNothin...
Validate a JSON without building the tree in memory. @param aReader The reader to read from. Should be buffered. May not be <code>null</code>. @return {@link EValidity#VALID} if the JSON is valid, {@link EValidity#INVALID} otherwise.
[ "Validate", "a", "JSON", "without", "building", "the", "tree", "in", "memory", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-json/src/main/java/com/helger/json/serialize/JsonReader.java#L178-L187
136,618
phax/ph-commons
ph-json/src/main/java/com/helger/json/serialize/JsonReader.java
JsonReader.readJson
@Nullable public static IJson readJson (@Nonnull @WillClose final Reader aReader, @Nullable final IJsonParserCustomizeCallback aCustomizeCallback, @Nullable final IJsonParseExceptionCallback aCustomExceptionCallback) { final CollectingJsonParserHandler aHandler = new CollectingJsonParserHandler (); if (parseJson (aReader, aHandler, aCustomizeCallback, aCustomExceptionCallback).isFailure ()) return null; return aHandler.getJson (); }
java
@Nullable public static IJson readJson (@Nonnull @WillClose final Reader aReader, @Nullable final IJsonParserCustomizeCallback aCustomizeCallback, @Nullable final IJsonParseExceptionCallback aCustomExceptionCallback) { final CollectingJsonParserHandler aHandler = new CollectingJsonParserHandler (); if (parseJson (aReader, aHandler, aCustomizeCallback, aCustomExceptionCallback).isFailure ()) return null; return aHandler.getJson (); }
[ "@", "Nullable", "public", "static", "IJson", "readJson", "(", "@", "Nonnull", "@", "WillClose", "final", "Reader", "aReader", ",", "@", "Nullable", "final", "IJsonParserCustomizeCallback", "aCustomizeCallback", ",", "@", "Nullable", "final", "IJsonParseExceptionCallb...
Main reading of the JSON @param aReader The reader to read from. Should be buffered. May not be <code>null</code>. @param aCustomizeCallback An optional {@link JsonParser} customization callback. May be <code>null</code>. @param aCustomExceptionCallback A custom handler for unrecoverable errors. May be <code>null</code>. @return <code>null</code> if parsing failed with an unrecoverable error (and no throwing exception handler is used), or <code>null</code> if a recoverable error occurred or non-<code>null</code> if parsing succeeded. @since 9.1.8
[ "Main", "reading", "of", "the", "JSON" ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-json/src/main/java/com/helger/json/serialize/JsonReader.java#L414-L423
136,619
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/lang/BooleanHelper.java
BooleanHelper.getBooleanValue
public static boolean getBooleanValue (@Nullable final Boolean aObj, final boolean bDefault) { return aObj == null ? bDefault : aObj.booleanValue (); }
java
public static boolean getBooleanValue (@Nullable final Boolean aObj, final boolean bDefault) { return aObj == null ? bDefault : aObj.booleanValue (); }
[ "public", "static", "boolean", "getBooleanValue", "(", "@", "Nullable", "final", "Boolean", "aObj", ",", "final", "boolean", "bDefault", ")", "{", "return", "aObj", "==", "null", "?", "bDefault", ":", "aObj", ".", "booleanValue", "(", ")", ";", "}" ]
Get the primitive value of the passed object value. @param aObj The Boolean value to be converted @param bDefault The default value to be returned, if the passed obj is <code>null</code>. @return Either the primitive boolean value or the default value
[ "Get", "the", "primitive", "value", "of", "the", "passed", "object", "value", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/BooleanHelper.java#L48-L51
136,620
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/url/URLHelper.java
URLHelper.urlDecode
@Nonnull public static String urlDecode (@Nonnull final String sValue, @Nonnull 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; byte [] aBytes = null; while (nIndex < nLen) { char c = sValue.charAt (nIndex); switch (c) { case '+': aSB.append (' '); nIndex++; bNeedToChange = true; break; case '%': /* * Starting with this instance of %, process all consecutive * substrings of the form %xy. Each substring %xy will yield a byte. * Convert all consecutive bytes obtained this way to whatever * character(s) they represent in the provided encoding. */ try { // (numChars-i)/3 is an upper bound for the number // of remaining bytes if (aBytes == null) aBytes = new byte [(nLen - nIndex) / 3]; int nPos = 0; while ((nIndex + 2) < nLen && c == '%') { final int nValue = Integer.parseInt (sValue.substring (nIndex + 1, nIndex + 3), 16); if (nValue < 0) throw new IllegalArgumentException ("URLDecoder: Illegal hex characters in escape (%) pattern - negative value"); aBytes[nPos++] = (byte) nValue; nIndex += 3; if (nIndex < nLen) c = sValue.charAt (nIndex); } // A trailing, incomplete byte encoding such as // "%x" will cause an exception to be thrown if (nIndex < nLen && c == '%') throw new IllegalArgumentException ("URLDecoder: Incomplete trailing escape (%) pattern"); aSB.append (StringHelper.decodeBytesToChars (aBytes, 0, nPos, aCharset)); } catch (final NumberFormatException e) { throw new IllegalArgumentException ("URLDecoder: Illegal hex characters in escape (%) pattern - " + e.getMessage ()); } bNeedToChange = true; break; default: aSB.append (c); nIndex++; break; } } return bNeedToChange ? aSB.toString () : sValue; }
java
@Nonnull public static String urlDecode (@Nonnull final String sValue, @Nonnull 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; byte [] aBytes = null; while (nIndex < nLen) { char c = sValue.charAt (nIndex); switch (c) { case '+': aSB.append (' '); nIndex++; bNeedToChange = true; break; case '%': /* * Starting with this instance of %, process all consecutive * substrings of the form %xy. Each substring %xy will yield a byte. * Convert all consecutive bytes obtained this way to whatever * character(s) they represent in the provided encoding. */ try { // (numChars-i)/3 is an upper bound for the number // of remaining bytes if (aBytes == null) aBytes = new byte [(nLen - nIndex) / 3]; int nPos = 0; while ((nIndex + 2) < nLen && c == '%') { final int nValue = Integer.parseInt (sValue.substring (nIndex + 1, nIndex + 3), 16); if (nValue < 0) throw new IllegalArgumentException ("URLDecoder: Illegal hex characters in escape (%) pattern - negative value"); aBytes[nPos++] = (byte) nValue; nIndex += 3; if (nIndex < nLen) c = sValue.charAt (nIndex); } // A trailing, incomplete byte encoding such as // "%x" will cause an exception to be thrown if (nIndex < nLen && c == '%') throw new IllegalArgumentException ("URLDecoder: Incomplete trailing escape (%) pattern"); aSB.append (StringHelper.decodeBytesToChars (aBytes, 0, nPos, aCharset)); } catch (final NumberFormatException e) { throw new IllegalArgumentException ("URLDecoder: Illegal hex characters in escape (%) pattern - " + e.getMessage ()); } bNeedToChange = true; break; default: aSB.append (c); nIndex++; break; } } return bNeedToChange ? aSB.toString () : sValue; }
[ "@", "Nonnull", "public", "static", "String", "urlDecode", "(", "@", "Nonnull", "final", "String", "sValue", ",", "@", "Nonnull", "final", "Charset", "aCharset", ")", "{", "ValueEnforcer", ".", "notNull", "(", "sValue", ",", "\"Value\"", ")", ";", "ValueEnfo...
URL-decode the passed value automatically handling charset issues. The implementation is ripped from URLDecoder but does not throw an UnsupportedEncodingException for nothing. @param sValue The value to be decoded. May not be <code>null</code>. @param aCharset The charset to use. May not be <code>null</code>. @return The decoded value. @see URLDecoder#decode(String, String)
[ "URL", "-", "decode", "the", "passed", "value", "automatically", "handling", "charset", "issues", ".", "The", "implementation", "is", "ripped", "from", "URLDecoder", "but", "does", "not", "throw", "an", "UnsupportedEncodingException", "for", "nothing", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/url/URLHelper.java#L197-L266
136,621
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/url/URLHelper.java
URLHelper.urlEncode
@Nonnull public static String urlEncode (@Nonnull final String sValue, @Nonnull 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 = new StringBuilder (nLen * 2); final char [] aSrcChars = sValue.toCharArray (); int nIndex = 0; while (nIndex < nLen) { char c = aSrcChars[nIndex]; if (NO_URL_ENCODE.get (c)) { if (c == ' ') { c = '+'; bChanged = true; } aSB.append (c); nIndex++; } else { // convert to external encoding before hex conversion if (aCAW == null) aCAW = new NonBlockingCharArrayWriter (); else aCAW.reset (); while (true) { aCAW.write (c); /* * If this character represents the start of a Unicode surrogate * pair, then pass in two characters. It's not clear what should be * done if a bytes reserved in the surrogate pairs range occurs * outside of a legal surrogate pair. For now, just treat it as if * it were any other character. */ if (Character.isHighSurrogate (c) && nIndex + 1 < nLen) { final char d = aSrcChars[nIndex + 1]; if (Character.isLowSurrogate (d)) { aCAW.write (d); nIndex++; } } nIndex++; if (nIndex >= nLen) break; // Try next char c = aSrcChars[nIndex]; if (NO_URL_ENCODE.get (c)) break; } final byte [] aEncodedBytes = aCAW.toByteArray (aCharset); for (final byte nEncByte : aEncodedBytes) { aSB.append ('%').append (URL_ENCODE_CHARS[(nEncByte >> 4) & 0xF]).append (URL_ENCODE_CHARS[nEncByte & 0xF]); } bChanged = true; } } return bChanged ? aSB.toString () : sValue; } finally { StreamHelper.close (aCAW); } }
java
@Nonnull public static String urlEncode (@Nonnull final String sValue, @Nonnull 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 = new StringBuilder (nLen * 2); final char [] aSrcChars = sValue.toCharArray (); int nIndex = 0; while (nIndex < nLen) { char c = aSrcChars[nIndex]; if (NO_URL_ENCODE.get (c)) { if (c == ' ') { c = '+'; bChanged = true; } aSB.append (c); nIndex++; } else { // convert to external encoding before hex conversion if (aCAW == null) aCAW = new NonBlockingCharArrayWriter (); else aCAW.reset (); while (true) { aCAW.write (c); /* * If this character represents the start of a Unicode surrogate * pair, then pass in two characters. It's not clear what should be * done if a bytes reserved in the surrogate pairs range occurs * outside of a legal surrogate pair. For now, just treat it as if * it were any other character. */ if (Character.isHighSurrogate (c) && nIndex + 1 < nLen) { final char d = aSrcChars[nIndex + 1]; if (Character.isLowSurrogate (d)) { aCAW.write (d); nIndex++; } } nIndex++; if (nIndex >= nLen) break; // Try next char c = aSrcChars[nIndex]; if (NO_URL_ENCODE.get (c)) break; } final byte [] aEncodedBytes = aCAW.toByteArray (aCharset); for (final byte nEncByte : aEncodedBytes) { aSB.append ('%').append (URL_ENCODE_CHARS[(nEncByte >> 4) & 0xF]).append (URL_ENCODE_CHARS[nEncByte & 0xF]); } bChanged = true; } } return bChanged ? aSB.toString () : sValue; } finally { StreamHelper.close (aCAW); } }
[ "@", "Nonnull", "public", "static", "String", "urlEncode", "(", "@", "Nonnull", "final", "String", "sValue", ",", "@", "Nonnull", "final", "Charset", "aCharset", ")", "{", "ValueEnforcer", ".", "notNull", "(", "sValue", ",", "\"Value\"", ")", ";", "ValueEnfo...
URL-encode the passed value automatically handling charset issues. This is a ripped, optimized version of URLEncoder.encode but without the UnsupportedEncodingException. @param sValue The value to be encoded. May not be <code>null</code>. @param aCharset The charset to use. May not be <code>null</code>. @return The encoded value.
[ "URL", "-", "encode", "the", "passed", "value", "automatically", "handling", "charset", "issues", ".", "This", "is", "a", "ripped", "optimized", "version", "of", "URLEncoder", ".", "encode", "but", "without", "the", "UnsupportedEncodingException", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/url/URLHelper.java#L293-L372
136,622
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/url/URLHelper.java
URLHelper.getCleanURLPartWithoutUmlauts
@Nullable public static String getCleanURLPartWithoutUmlauts (@Nullable final String sURLPart) { if (s_aCleanURLOld == null) _initCleanURL (); final char [] ret = StringHelper.replaceMultiple (sURLPart, s_aCleanURLOld, s_aCleanURLNew); return new String (ret); }
java
@Nullable public static String getCleanURLPartWithoutUmlauts (@Nullable final String sURLPart) { if (s_aCleanURLOld == null) _initCleanURL (); final char [] ret = StringHelper.replaceMultiple (sURLPart, s_aCleanURLOld, s_aCleanURLNew); return new String (ret); }
[ "@", "Nullable", "public", "static", "String", "getCleanURLPartWithoutUmlauts", "(", "@", "Nullable", "final", "String", "sURLPart", ")", "{", "if", "(", "s_aCleanURLOld", "==", "null", ")", "_initCleanURL", "(", ")", ";", "final", "char", "[", "]", "ret", "...
Clean an URL part from nasty Umlauts. This mapping needs extension! @param sURLPart The original URL part. May be <code>null</code>. @return The cleaned version or <code>null</code> if the input was <code>null</code>.
[ "Clean", "an", "URL", "part", "from", "nasty", "Umlauts", ".", "This", "mapping", "needs", "extension!" ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/url/URLHelper.java#L430-L437
136,623
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/url/URLHelper.java
URLHelper.getAsURLData
@Nonnull public static ISimpleURL getAsURLData (@Nonnull final String sHref, @Nullable final IDecoder <String, String> aParameterDecoder) { ValueEnforcer.notNull (sHref, "Href"); final String sRealHref = sHref.trim (); // Is it a protocol that does not allow for query parameters? final IURLProtocol eProtocol = URLProtocolRegistry.getInstance ().getProtocol (sRealHref); if (eProtocol != null && !eProtocol.allowsForQueryParameters ()) return new URLData (sRealHref, null, null); if (GlobalDebug.isDebugMode ()) if (eProtocol != null) try { new URL (sRealHref); } catch (final MalformedURLException ex) { if (LOGGER.isWarnEnabled ()) LOGGER.warn ("java.net.URL claims URL '" + sRealHref + "' to be invalid: " + ex.getMessage ()); } String sPath; URLParameterList aParams = null; String sAnchor; // First get the anchor out String sRemainingHref = sRealHref; final int nIndexAnchor = sRemainingHref.indexOf (HASH); if (nIndexAnchor >= 0) { // Extract anchor sAnchor = sRemainingHref.substring (nIndexAnchor + 1).trim (); sRemainingHref = sRemainingHref.substring (0, nIndexAnchor).trim (); } else sAnchor = null; // Find parameters final int nQuestionIndex = sRemainingHref.indexOf (QUESTIONMARK); if (nQuestionIndex >= 0) { // Use everything after the '?' final String sQueryString = sRemainingHref.substring (nQuestionIndex + 1).trim (); // Maybe empty, if the URL ends with a '?' if (StringHelper.hasText (sQueryString)) aParams = getParsedQueryParameters (sQueryString, aParameterDecoder); sPath = sRemainingHref.substring (0, nQuestionIndex).trim (); } else sPath = sRemainingHref; return new URLData (sPath, aParams, sAnchor); }
java
@Nonnull public static ISimpleURL getAsURLData (@Nonnull final String sHref, @Nullable final IDecoder <String, String> aParameterDecoder) { ValueEnforcer.notNull (sHref, "Href"); final String sRealHref = sHref.trim (); // Is it a protocol that does not allow for query parameters? final IURLProtocol eProtocol = URLProtocolRegistry.getInstance ().getProtocol (sRealHref); if (eProtocol != null && !eProtocol.allowsForQueryParameters ()) return new URLData (sRealHref, null, null); if (GlobalDebug.isDebugMode ()) if (eProtocol != null) try { new URL (sRealHref); } catch (final MalformedURLException ex) { if (LOGGER.isWarnEnabled ()) LOGGER.warn ("java.net.URL claims URL '" + sRealHref + "' to be invalid: " + ex.getMessage ()); } String sPath; URLParameterList aParams = null; String sAnchor; // First get the anchor out String sRemainingHref = sRealHref; final int nIndexAnchor = sRemainingHref.indexOf (HASH); if (nIndexAnchor >= 0) { // Extract anchor sAnchor = sRemainingHref.substring (nIndexAnchor + 1).trim (); sRemainingHref = sRemainingHref.substring (0, nIndexAnchor).trim (); } else sAnchor = null; // Find parameters final int nQuestionIndex = sRemainingHref.indexOf (QUESTIONMARK); if (nQuestionIndex >= 0) { // Use everything after the '?' final String sQueryString = sRemainingHref.substring (nQuestionIndex + 1).trim (); // Maybe empty, if the URL ends with a '?' if (StringHelper.hasText (sQueryString)) aParams = getParsedQueryParameters (sQueryString, aParameterDecoder); sPath = sRemainingHref.substring (0, nQuestionIndex).trim (); } else sPath = sRemainingHref; return new URLData (sPath, aParams, sAnchor); }
[ "@", "Nonnull", "public", "static", "ISimpleURL", "getAsURLData", "(", "@", "Nonnull", "final", "String", "sHref", ",", "@", "Nullable", "final", "IDecoder", "<", "String", ",", "String", ">", "aParameterDecoder", ")", "{", "ValueEnforcer", ".", "notNull", "("...
Parses the passed URL into a structured form @param sHref The URL to be parsed @param aParameterDecoder The parameter decoder to use. May be <code>null</code>. @return the corresponding {@link ISimpleURL} representation of the passed URL
[ "Parses", "the", "passed", "URL", "into", "a", "structured", "form" ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/url/URLHelper.java#L455-L513
136,624
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/microdom/convert/MicroTypeConverterRegistry.java
MicroTypeConverterRegistry.iterateAllRegisteredMicroTypeConverters
public void iterateAllRegisteredMicroTypeConverters (@Nonnull final IMicroTypeConverterCallback aCallback) { // Create a static copy of the map (HashMap not weak!) final ICommonsMap <Class <?>, IMicroTypeConverter <?>> aCopy = m_aRWLock.readLocked (m_aMap::getClone); // And iterate the copy for (final Map.Entry <Class <?>, IMicroTypeConverter <?>> aEntry : aCopy.entrySet ()) if (aCallback.call (aEntry.getKey (), aEntry.getValue ()).isBreak ()) break; }
java
public void iterateAllRegisteredMicroTypeConverters (@Nonnull final IMicroTypeConverterCallback aCallback) { // Create a static copy of the map (HashMap not weak!) final ICommonsMap <Class <?>, IMicroTypeConverter <?>> aCopy = m_aRWLock.readLocked (m_aMap::getClone); // And iterate the copy for (final Map.Entry <Class <?>, IMicroTypeConverter <?>> aEntry : aCopy.entrySet ()) if (aCallback.call (aEntry.getKey (), aEntry.getValue ()).isBreak ()) break; }
[ "public", "void", "iterateAllRegisteredMicroTypeConverters", "(", "@", "Nonnull", "final", "IMicroTypeConverterCallback", "aCallback", ")", "{", "// Create a static copy of the map (HashMap not weak!)", "final", "ICommonsMap", "<", "Class", "<", "?", ">", ",", "IMicroTypeConv...
Iterate all registered micro type converters. For informational purposes only. @param aCallback The callback invoked for all iterations.
[ "Iterate", "all", "registered", "micro", "type", "converters", ".", "For", "informational", "purposes", "only", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/microdom/convert/MicroTypeConverterRegistry.java#L210-L219
136,625
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/base64/Base64.java
Base64.safeDecodeAsString
@Nullable public static String safeDecodeAsString (@Nullable final String sEncoded, @Nonnull 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) { // Fall through } return null; }
java
@Nullable public static String safeDecodeAsString (@Nullable final String sEncoded, @Nonnull 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) { // Fall through } return null; }
[ "@", "Nullable", "public", "static", "String", "safeDecodeAsString", "(", "@", "Nullable", "final", "String", "sEncoded", ",", "@", "Nonnull", "final", "Charset", "aCharset", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aCharset", ",", "\"Charset\"", ")", ...
Decode the string and convert it back to a string. @param sEncoded The encoded string. @param aCharset The character set to be used. @return <code>null</code> if decoding failed.
[ "Decode", "the", "string", "and", "convert", "it", "back", "to", "a", "string", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/base64/Base64.java#L2664-L2679
136,626
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/io/stream/NonBlockingBufferedReader.java
NonBlockingBufferedReader.ready
@Override public boolean ready () throws IOException { _ensureOpen (); /* * If newline needs to be skipped and the next char to be read is a newline * character, then just skip it right away. */ if (m_bSkipLF) { /* * Note that in.ready() will return true if and only if the next read on * the stream will not block. */ 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 || m_aReader.ready (); }
java
@Override public boolean ready () throws IOException { _ensureOpen (); /* * If newline needs to be skipped and the next char to be read is a newline * character, then just skip it right away. */ if (m_bSkipLF) { /* * Note that in.ready() will return true if and only if the next read on * the stream will not block. */ 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 || m_aReader.ready (); }
[ "@", "Override", "public", "boolean", "ready", "(", ")", "throws", "IOException", "{", "_ensureOpen", "(", ")", ";", "/*\n * If newline needs to be skipped and the next char to be read is a newline\n * character, then just skip it right away.\n */", "if", "(", "m_bSkipL...
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. @return <code>true</code> if the reader is ready @exception IOException If an I/O error occurs
[ "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", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/NonBlockingBufferedReader.java#L440-L465
136,627
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/xpath/MapBasedXPathVariableResolverQName.java
MapBasedXPathVariableResolverQName.addAllFrom
@Nonnull public EChange addAllFrom (@Nonnull final MapBasedXPathVariableResolver aOther, final boolean bOverwrite) { ValueEnforcer.notNull (aOther, "Other"); EChange eChange = EChange.UNCHANGED; for (final Map.Entry <String, ?> aEntry : aOther.getAllVariables ().entrySet ()) { // Local part only to QName final QName aKey = new QName (aEntry.getKey ()); if (bOverwrite || !m_aMap.containsKey (aKey)) { m_aMap.put (aKey, aEntry.getValue ()); eChange = EChange.CHANGED; } } return eChange; }
java
@Nonnull public EChange addAllFrom (@Nonnull final MapBasedXPathVariableResolver aOther, final boolean bOverwrite) { ValueEnforcer.notNull (aOther, "Other"); EChange eChange = EChange.UNCHANGED; for (final Map.Entry <String, ?> aEntry : aOther.getAllVariables ().entrySet ()) { // Local part only to QName final QName aKey = new QName (aEntry.getKey ()); if (bOverwrite || !m_aMap.containsKey (aKey)) { m_aMap.put (aKey, aEntry.getValue ()); eChange = EChange.CHANGED; } } return eChange; }
[ "@", "Nonnull", "public", "EChange", "addAllFrom", "(", "@", "Nonnull", "final", "MapBasedXPathVariableResolver", "aOther", ",", "final", "boolean", "bOverwrite", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aOther", ",", "\"Other\"", ")", ";", "EChange", "e...
Add all variables from the other variable resolver into this resolver. This methods creates a QName with an empty namespace URI. @param aOther The variable resolver to import the variable from. May not be <code>null</code>. @param bOverwrite if <code>true</code> existing variables will be overwritten with the new variables, otherwise the old variables are kept. @return {@link EChange}
[ "Add", "all", "variables", "from", "the", "other", "variable", "resolver", "into", "this", "resolver", ".", "This", "methods", "creates", "a", "QName", "with", "an", "empty", "namespace", "URI", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/xpath/MapBasedXPathVariableResolverQName.java#L142-L159
136,628
phax/ph-commons
ph-less-commons/src/main/java/com/helger/lesscommons/jmx/ObjectNameHelper.java
ObjectNameHelper.setDefaultJMXDomain
public static void setDefaultJMXDomain (@Nonnull @Nonempty final String sDefaultJMXDomain) { ValueEnforcer.notEmpty (sDefaultJMXDomain, "DefaultJMXDomain"); if (sDefaultJMXDomain.indexOf (':') >= 0 || sDefaultJMXDomain.indexOf (' ') >= 0) throw new IllegalArgumentException ("defaultJMXDomain contains invalid chars: " + sDefaultJMXDomain); s_aRWLock.writeLocked ( () -> s_sDefaultJMXDomain = sDefaultJMXDomain); }
java
public static void setDefaultJMXDomain (@Nonnull @Nonempty final String sDefaultJMXDomain) { ValueEnforcer.notEmpty (sDefaultJMXDomain, "DefaultJMXDomain"); if (sDefaultJMXDomain.indexOf (':') >= 0 || sDefaultJMXDomain.indexOf (' ') >= 0) throw new IllegalArgumentException ("defaultJMXDomain contains invalid chars: " + sDefaultJMXDomain); s_aRWLock.writeLocked ( () -> s_sDefaultJMXDomain = sDefaultJMXDomain); }
[ "public", "static", "void", "setDefaultJMXDomain", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sDefaultJMXDomain", ")", "{", "ValueEnforcer", ".", "notEmpty", "(", "sDefaultJMXDomain", ",", "\"DefaultJMXDomain\"", ")", ";", "if", "(", "sDefaultJMXDomai...
Set the default JMX domain @param sDefaultJMXDomain The new JMX domain. May neither be <code>null</code> nor empty nor may it contains ":" or " "
[ "Set", "the", "default", "JMX", "domain" ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-less-commons/src/main/java/com/helger/lesscommons/jmx/ObjectNameHelper.java#L60-L67
136,629
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/callback/CallbackList.java
CallbackList.add
@Nonnull public EChange add (@Nonnull final CALLBACKTYPE aCallback) { ValueEnforcer.notNull (aCallback, "Callback"); return m_aRWLock.writeLocked ( () -> m_aCallbacks.addObject (aCallback)); }
java
@Nonnull public EChange add (@Nonnull final CALLBACKTYPE aCallback) { ValueEnforcer.notNull (aCallback, "Callback"); return m_aRWLock.writeLocked ( () -> m_aCallbacks.addObject (aCallback)); }
[ "@", "Nonnull", "public", "EChange", "add", "(", "@", "Nonnull", "final", "CALLBACKTYPE", "aCallback", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aCallback", ",", "\"Callback\"", ")", ";", "return", "m_aRWLock", ".", "writeLocked", "(", "(", ")", "->",...
Add a callback. @param aCallback May not be <code>null</code>. @return {@link EChange}
[ "Add", "a", "callback", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/callback/CallbackList.java#L94-L100
136,630
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/callback/CallbackList.java
CallbackList.removeObject
@Nonnull public EChange removeObject (@Nullable final CALLBACKTYPE aCallback) { if (aCallback == null) return EChange.UNCHANGED; return m_aRWLock.writeLocked ( () -> m_aCallbacks.removeObject (aCallback)); }
java
@Nonnull public EChange removeObject (@Nullable final CALLBACKTYPE aCallback) { if (aCallback == null) return EChange.UNCHANGED; return m_aRWLock.writeLocked ( () -> m_aCallbacks.removeObject (aCallback)); }
[ "@", "Nonnull", "public", "EChange", "removeObject", "(", "@", "Nullable", "final", "CALLBACKTYPE", "aCallback", ")", "{", "if", "(", "aCallback", "==", "null", ")", "return", "EChange", ".", "UNCHANGED", ";", "return", "m_aRWLock", ".", "writeLocked", "(", ...
Remove the specified callback @param aCallback May be <code>null</code>. @return {@link EChange}
[ "Remove", "the", "specified", "callback" ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/callback/CallbackList.java#L118-L125
136,631
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/XMLDebug.java
XMLDebug.debugLogDOMFeatures
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 () + " feature '" + sFeature + "' is present"); }
java
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 () + " feature '" + sFeature + "' is present"); }
[ "public", "static", "void", "debugLogDOMFeatures", "(", ")", "{", "for", "(", "final", "Map", ".", "Entry", "<", "EXMLDOMFeatureVersion", ",", "ICommonsList", "<", "String", ">", ">", "aEntry", ":", "s_aSupportedFeatures", ".", "entrySet", "(", ")", ")", "fo...
Emit all supported features to the logger.
[ "Emit", "all", "supported", "features", "to", "the", "logger", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/XMLDebug.java#L108-L114
136,632
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/XMLHelper.java
XMLHelper.getOwnerDocument
@Nullable public static Document getOwnerDocument (@Nullable final Node aNode) { if (aNode == null) return null; if (aNode instanceof Document) return (Document) aNode; return aNode.getOwnerDocument (); }
java
@Nullable public static Document getOwnerDocument (@Nullable final Node aNode) { if (aNode == null) return null; if (aNode instanceof Document) return (Document) aNode; return aNode.getOwnerDocument (); }
[ "@", "Nullable", "public", "static", "Document", "getOwnerDocument", "(", "@", "Nullable", "final", "Node", "aNode", ")", "{", "if", "(", "aNode", "==", "null", ")", "return", "null", ";", "if", "(", "aNode", "instanceof", "Document", ")", "return", "(", ...
Get the owner document of the passed node. If the node itself is a document, only a cast is performed. @param aNode The node to get the document from. May be <code>null</code>. @return <code>null</code> if the passed node was <code>null</code>.
[ "Get", "the", "owner", "document", "of", "the", "passed", "node", ".", "If", "the", "node", "itself", "is", "a", "document", "only", "a", "cast", "is", "performed", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/XMLHelper.java#L76-L84
136,633
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/XMLHelper.java
XMLHelper.getFirstChildElement
@Nullable public static Element getFirstChildElement (@Nullable final Node aStartNode) { if (aStartNode == null) return null; return NodeListIterator.createChildNodeIterator (aStartNode) .findFirstMapped (filterNodeIsElement (), x -> (Element) x); }
java
@Nullable public static Element getFirstChildElement (@Nullable final Node aStartNode) { if (aStartNode == null) return null; return NodeListIterator.createChildNodeIterator (aStartNode) .findFirstMapped (filterNodeIsElement (), x -> (Element) x); }
[ "@", "Nullable", "public", "static", "Element", "getFirstChildElement", "(", "@", "Nullable", "final", "Node", "aStartNode", ")", "{", "if", "(", "aStartNode", "==", "null", ")", "return", "null", ";", "return", "NodeListIterator", ".", "createChildNodeIterator", ...
Get the first direct child element of the passed element. @param aStartNode The element to start searching. May be <code>null</code>. @return <code>null</code> if the passed element does not have any direct child element.
[ "Get", "the", "first", "direct", "child", "element", "of", "the", "passed", "element", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/XMLHelper.java#L214-L221
136,634
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/XMLHelper.java
XMLHelper.hasChildElementNodes
public static boolean hasChildElementNodes (@Nullable final Node aStartNode) { if (aStartNode == null) return false; return NodeListIterator.createChildNodeIterator (aStartNode).containsAny (filterNodeIsElement ()); }
java
public static boolean hasChildElementNodes (@Nullable final Node aStartNode) { if (aStartNode == null) return false; return NodeListIterator.createChildNodeIterator (aStartNode).containsAny (filterNodeIsElement ()); }
[ "public", "static", "boolean", "hasChildElementNodes", "(", "@", "Nullable", "final", "Node", "aStartNode", ")", "{", "if", "(", "aStartNode", "==", "null", ")", "return", "false", ";", "return", "NodeListIterator", ".", "createChildNodeIterator", "(", "aStartNode...
Check if the passed node has at least one direct child element or not. @param aStartNode The parent element to be searched. May be <code>null</code>. @return <code>true</code> if the passed node has at least one child element, <code>false</code> otherwise.
[ "Check", "if", "the", "passed", "node", "has", "at", "least", "one", "direct", "child", "element", "or", "not", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/XMLHelper.java#L231-L236
136,635
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/mime/MimeType.java
MimeType.removeParameterWithName
@Nonnull public EChange removeParameterWithName (@Nullable 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_aParameters.remove (i); return EChange.CHANGED; } } } return EChange.UNCHANGED; }
java
@Nonnull public EChange removeParameterWithName (@Nullable 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_aParameters.remove (i); return EChange.CHANGED; } } } return EChange.UNCHANGED; }
[ "@", "Nonnull", "public", "EChange", "removeParameterWithName", "(", "@", "Nullable", "final", "String", "sParamName", ")", "{", "if", "(", "StringHelper", ".", "hasText", "(", "sParamName", ")", ")", "{", "final", "int", "nMax", "=", "m_aParameters", ".", "...
Remove the parameter with the specified name. @param sParamName The name of the parameter to remove. May be <code>null</code>. @return {@link EChange#CHANGED} if the parameter was removed, {@link EChange#UNCHANGED} otherwise.
[ "Remove", "the", "parameter", "with", "the", "specified", "name", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/mime/MimeType.java#L251-L268
136,636
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/regex/RegExHelper.java
RegExHelper.getMatcher
@Nonnull public static Matcher getMatcher (@Nonnull @RegEx final String sRegEx, @Nonnull final String sValue) { ValueEnforcer.notNull (sValue, "Value"); return RegExCache.getPattern (sRegEx).matcher (sValue); }
java
@Nonnull public static Matcher getMatcher (@Nonnull @RegEx final String sRegEx, @Nonnull final String sValue) { ValueEnforcer.notNull (sValue, "Value"); return RegExCache.getPattern (sRegEx).matcher (sValue); }
[ "@", "Nonnull", "public", "static", "Matcher", "getMatcher", "(", "@", "Nonnull", "@", "RegEx", "final", "String", "sRegEx", ",", "@", "Nonnull", "final", "String", "sValue", ")", "{", "ValueEnforcer", ".", "notNull", "(", "sValue", ",", "\"Value\"", ")", ...
Get the Java Matcher object for the passed pair of regular expression and value. @param sRegEx The regular expression to use. May neither be <code>null</code> nor empty. @param sValue The value to create the matcher for. May not be <code>null</code>. @return A non-<code>null</code> matcher.
[ "Get", "the", "Java", "Matcher", "object", "for", "the", "passed", "pair", "of", "regular", "expression", "and", "value", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/regex/RegExHelper.java#L162-L168
136,637
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/regex/RegExHelper.java
RegExHelper.stringMatchesPattern
public static boolean stringMatchesPattern (@Nonnull @RegEx final String sRegEx, @Nonnull final String sValue) { return getMatcher (sRegEx, sValue).matches (); }
java
public static boolean stringMatchesPattern (@Nonnull @RegEx final String sRegEx, @Nonnull final String sValue) { return getMatcher (sRegEx, sValue).matches (); }
[ "public", "static", "boolean", "stringMatchesPattern", "(", "@", "Nonnull", "@", "RegEx", "final", "String", "sRegEx", ",", "@", "Nonnull", "final", "String", "sValue", ")", "{", "return", "getMatcher", "(", "sRegEx", ",", "sValue", ")", ".", "matches", "(",...
A shortcut helper method to determine whether a string matches a certain regular expression or not. @param sRegEx The regular expression to be used. The compiled regular expression pattern is cached. May neither be <code>null</code> nor empty. @param sValue The string value to compare against the regular expression. @return <code>true</code> if the string matches the regular expression, <code>false</code> otherwise.
[ "A", "shortcut", "helper", "method", "to", "determine", "whether", "a", "string", "matches", "a", "certain", "regular", "expression", "or", "not", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/regex/RegExHelper.java#L206-L209
136,638
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/locale/country/CountryCache.java
CountryCache.containsCountry
public boolean containsCountry (@Nullable 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)); }
java
public boolean containsCountry (@Nullable 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)); }
[ "public", "boolean", "containsCountry", "(", "@", "Nullable", "final", "String", "sCountry", ")", "{", "if", "(", "sCountry", "==", "null", ")", "return", "false", ";", "final", "String", "sValidCountry", "=", "LocaleHelper", ".", "getValidCountryCode", "(", "...
Check if the passed country is known. @param sCountry The country to check. May be <code>null</code>. @return <code>true</code> if the passed country is contained, <code>false</code> otherwise.
[ "Check", "if", "the", "passed", "country", "is", "known", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/locale/country/CountryCache.java#L165-L174
136,639
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/hashcode/HashCodeCalculator.java
HashCodeCalculator.append
public static int append (final int nPrevHashCode, @Nullable final Object x) { return append (nPrevHashCode, HashCodeImplementationRegistry.getHashCode (x)); }
java
public static int append (final int nPrevHashCode, @Nullable final Object x) { return append (nPrevHashCode, HashCodeImplementationRegistry.getHashCode (x)); }
[ "public", "static", "int", "append", "(", "final", "int", "nPrevHashCode", ",", "@", "Nullable", "final", "Object", "x", ")", "{", "return", "append", "(", "nPrevHashCode", ",", "HashCodeImplementationRegistry", ".", "getHashCode", "(", "x", ")", ")", ";", "...
Object hash code generation. @param nPrevHashCode The previous hash code used as the basis for calculation @param x Object to add. May be <code>null</code>. @return The updated hash code
[ "Object", "hash", "code", "generation", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/hashcode/HashCodeCalculator.java#L173-L176
136,640
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/io/stream/HasInputStream.java
HasInputStream.multiple
@Nonnull @ReturnsMutableCopy public static HasInputStream multiple (@Nonnull final ISupplier <? extends InputStream> aISP) { return new HasInputStream (aISP, true); }
java
@Nonnull @ReturnsMutableCopy public static HasInputStream multiple (@Nonnull final ISupplier <? extends InputStream> aISP) { return new HasInputStream (aISP, true); }
[ "@", "Nonnull", "@", "ReturnsMutableCopy", "public", "static", "HasInputStream", "multiple", "(", "@", "Nonnull", "final", "ISupplier", "<", "?", "extends", "InputStream", ">", "aISP", ")", "{", "return", "new", "HasInputStream", "(", "aISP", ",", "true", ")",...
Create a new object with a supplier that can read multiple times. @param aISP {@link InputStream} provider. May not be <code>null</code>. @return Never <code>null</code>.
[ "Create", "a", "new", "object", "with", "a", "supplier", "that", "can", "read", "multiple", "times", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/HasInputStream.java#L81-L86
136,641
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/io/stream/HasInputStream.java
HasInputStream.once
@Nonnull @ReturnsMutableCopy public static HasInputStream once (@Nonnull final ISupplier <? extends InputStream> aISP) { return new HasInputStream (aISP, false); }
java
@Nonnull @ReturnsMutableCopy public static HasInputStream once (@Nonnull final ISupplier <? extends InputStream> aISP) { return new HasInputStream (aISP, false); }
[ "@", "Nonnull", "@", "ReturnsMutableCopy", "public", "static", "HasInputStream", "once", "(", "@", "Nonnull", "final", "ISupplier", "<", "?", "extends", "InputStream", ">", "aISP", ")", "{", "return", "new", "HasInputStream", "(", "aISP", ",", "false", ")", ...
Create a new object with a supplier that can be read only once. @param aISP {@link InputStream} provider. May not be <code>null</code>. @return Never <code>null</code>.
[ "Create", "a", "new", "object", "with", "a", "supplier", "that", "can", "be", "read", "only", "once", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/HasInputStream.java#L95-L100
136,642
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/util/LevenshteinDistance.java
LevenshteinDistance._getDistance111
private static int _getDistance111 (@Nonnull final char [] aStr1, @Nonnegative final int nLen1, @Nonnull final char [] aStr2, @Nonnegative final int nLen2) { // previous cost array, horizontally int [] aPrevRow = new int [nLen1 + 1]; // cost array, horizontally int [] aCurRow = new int [nLen1 + 1]; // init for (int i = 0; i <= nLen1; i++) aPrevRow[i] = i; for (int j = 0; j < nLen2; j++) { final int ch2 = aStr2[j]; aCurRow[0] = j + 1; for (int i = 0; i < nLen1; i++) { final int nSubstVal = aStr1[i] == ch2 ? 0 : 1; aCurRow[i + 1] = Math.min (Math.min (aCurRow[i] + 1, aPrevRow[i + 1] + 1), aPrevRow[i] + nSubstVal); } // swap current distance counts to 'previous row' distance counts final int [] tmp = aPrevRow; aPrevRow = aCurRow; aCurRow = tmp; } // our last action in the above loop was to switch d and p, so p now // actually has the most recent cost counts return aPrevRow[nLen1]; }
java
private static int _getDistance111 (@Nonnull final char [] aStr1, @Nonnegative final int nLen1, @Nonnull final char [] aStr2, @Nonnegative final int nLen2) { // previous cost array, horizontally int [] aPrevRow = new int [nLen1 + 1]; // cost array, horizontally int [] aCurRow = new int [nLen1 + 1]; // init for (int i = 0; i <= nLen1; i++) aPrevRow[i] = i; for (int j = 0; j < nLen2; j++) { final int ch2 = aStr2[j]; aCurRow[0] = j + 1; for (int i = 0; i < nLen1; i++) { final int nSubstVal = aStr1[i] == ch2 ? 0 : 1; aCurRow[i + 1] = Math.min (Math.min (aCurRow[i] + 1, aPrevRow[i + 1] + 1), aPrevRow[i] + nSubstVal); } // swap current distance counts to 'previous row' distance counts final int [] tmp = aPrevRow; aPrevRow = aCurRow; aCurRow = tmp; } // our last action in the above loop was to switch d and p, so p now // actually has the most recent cost counts return aPrevRow[nLen1]; }
[ "private", "static", "int", "_getDistance111", "(", "@", "Nonnull", "final", "char", "[", "]", "aStr1", ",", "@", "Nonnegative", "final", "int", "nLen1", ",", "@", "Nonnull", "final", "char", "[", "]", "aStr2", ",", "@", "Nonnegative", "final", "int", "n...
Main generic Levenshtein implementation that uses "1" for all costs! @param aStr1 Not null @param nLen1 &gt; 0 @param aStr2 Not null @param nLen2 &gt; 0 @return non negative distance
[ "Main", "generic", "Levenshtein", "implementation", "that", "uses", "1", "for", "all", "costs!" ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/util/LevenshteinDistance.java#L55-L90
136,643
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/util/LevenshteinDistance.java
LevenshteinDistance._getDistance
private static int _getDistance (@Nonnull final char [] aStr1, @Nonnegative final int nLen1, @Nonnull final char [] aStr2, @Nonnegative final int nLen2, @Nonnegative final int nCostInsert, @Nonnegative final int nCostDelete, @Nonnegative final int nCostSubstitution) { // previous cost array, horizontally int [] aPrevRow = new int [nLen1 + 1]; // cost array, horizontally int [] aCurRow = new int [nLen1 + 1]; // init for (int i = 0; i <= nLen1; i++) aPrevRow[i] = i * nCostInsert; for (int j = 0; j < nLen2; j++) { final int ch2 = aStr2[j]; aCurRow[0] = (j + 1) * nCostDelete; for (int i = 0; i < nLen1; i++) { final int nSubstCost = aStr1[i] == ch2 ? 0 : nCostSubstitution; aCurRow[i + 1] = Math.min (Math.min (aCurRow[i] + nCostInsert, aPrevRow[i + 1] + nCostDelete), aPrevRow[i] + nSubstCost); } // swap current distance counts to 'previous row' distance counts final int [] tmp = aPrevRow; aPrevRow = aCurRow; aCurRow = tmp; } // our last action in the above loop was to switch d and p, so p now // actually has the most recent cost counts return aPrevRow[nLen1]; }
java
private static int _getDistance (@Nonnull final char [] aStr1, @Nonnegative final int nLen1, @Nonnull final char [] aStr2, @Nonnegative final int nLen2, @Nonnegative final int nCostInsert, @Nonnegative final int nCostDelete, @Nonnegative final int nCostSubstitution) { // previous cost array, horizontally int [] aPrevRow = new int [nLen1 + 1]; // cost array, horizontally int [] aCurRow = new int [nLen1 + 1]; // init for (int i = 0; i <= nLen1; i++) aPrevRow[i] = i * nCostInsert; for (int j = 0; j < nLen2; j++) { final int ch2 = aStr2[j]; aCurRow[0] = (j + 1) * nCostDelete; for (int i = 0; i < nLen1; i++) { final int nSubstCost = aStr1[i] == ch2 ? 0 : nCostSubstitution; aCurRow[i + 1] = Math.min (Math.min (aCurRow[i] + nCostInsert, aPrevRow[i + 1] + nCostDelete), aPrevRow[i] + nSubstCost); } // swap current distance counts to 'previous row' distance counts final int [] tmp = aPrevRow; aPrevRow = aCurRow; aCurRow = tmp; } // our last action in the above loop was to switch d and p, so p now // actually has the most recent cost counts return aPrevRow[nLen1]; }
[ "private", "static", "int", "_getDistance", "(", "@", "Nonnull", "final", "char", "[", "]", "aStr1", ",", "@", "Nonnegative", "final", "int", "nLen1", ",", "@", "Nonnull", "final", "char", "[", "]", "aStr2", ",", "@", "Nonnegative", "final", "int", "nLen...
Main generic Levenshtein implementation. Assume all preconditions are checked. @param aStr1 Not null @param nLen1 &gt; 0 @param aStr2 Not null @param nLen2 &gt; 0 @param nCostInsert &ge; 0 @param nCostDelete &ge; 0 @param nCostSubstitution &ge; 0 @return non negative distance
[ "Main", "generic", "Levenshtein", "implementation", ".", "Assume", "all", "preconditions", "are", "checked", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/util/LevenshteinDistance.java#L112-L151
136,644
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/email/EmailAddressHelper.java
EmailAddressHelper.getUnifiedEmailAddress
@Nullable public static String getUnifiedEmailAddress (@Nullable final String sEmailAddress) { return sEmailAddress == null ? null : sEmailAddress.trim ().toLowerCase (Locale.US); }
java
@Nullable public static String getUnifiedEmailAddress (@Nullable final String sEmailAddress) { return sEmailAddress == null ? null : sEmailAddress.trim ().toLowerCase (Locale.US); }
[ "@", "Nullable", "public", "static", "String", "getUnifiedEmailAddress", "(", "@", "Nullable", "final", "String", "sEmailAddress", ")", "{", "return", "sEmailAddress", "==", "null", "?", "null", ":", "sEmailAddress", ".", "trim", "(", ")", ".", "toLowerCase", ...
Get the unified version of an email address. It trims leading and trailing spaces and lower-cases the email address. @param sEmailAddress The email address to unify. May be <code>null</code>. @return The unified email address or <code>null</code> if the input address is <code>null</code>.
[ "Get", "the", "unified", "version", "of", "an", "email", "address", ".", "It", "trims", "leading", "and", "trailing", "spaces", "and", "lower", "-", "cases", "the", "email", "address", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/email/EmailAddressHelper.java#L53-L57
136,645
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/email/EmailAddressHelper.java
EmailAddressHelper.isValid
public static boolean isValid (@Nullable final String sEmailAddress) { if (sEmailAddress == null) return false; // Unify (lowercase) final String sUnifiedEmail = getUnifiedEmailAddress (sEmailAddress); // Pattern matching return s_aPattern.matcher (sUnifiedEmail).matches (); }
java
public static boolean isValid (@Nullable final String sEmailAddress) { if (sEmailAddress == null) return false; // Unify (lowercase) final String sUnifiedEmail = getUnifiedEmailAddress (sEmailAddress); // Pattern matching return s_aPattern.matcher (sUnifiedEmail).matches (); }
[ "public", "static", "boolean", "isValid", "(", "@", "Nullable", "final", "String", "sEmailAddress", ")", "{", "if", "(", "sEmailAddress", "==", "null", ")", "return", "false", ";", "// Unify (lowercase)", "final", "String", "sUnifiedEmail", "=", "getUnifiedEmailAd...
Checks if a value is a valid e-mail address according to a certain regular expression. @param sEmailAddress The value validation is being performed on. A <code>null</code> value is considered invalid. @return <code>true</code> if the email address is valid, <code>false</code> otherwise.
[ "Checks", "if", "a", "value", "is", "a", "valid", "e", "-", "mail", "address", "according", "to", "a", "certain", "regular", "expression", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/email/EmailAddressHelper.java#L69-L79
136,646
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/microdom/util/XMLMapHandler.java
XMLMapHandler.writeMap
@Nonnull public static ESuccess writeMap (@Nonnull final Map <String, String> aMap, @Nonnull @WillClose final OutputStream aOS) { ValueEnforcer.notNull (aMap, "Map"); ValueEnforcer.notNull (aOS, "OutputStream"); try { final IMicroDocument aDoc = createMapDocument (aMap); return MicroWriter.writeToStream (aDoc, aOS, XMLWriterSettings.DEFAULT_XML_SETTINGS); } finally { StreamHelper.close (aOS); } }
java
@Nonnull public static ESuccess writeMap (@Nonnull final Map <String, String> aMap, @Nonnull @WillClose final OutputStream aOS) { ValueEnforcer.notNull (aMap, "Map"); ValueEnforcer.notNull (aOS, "OutputStream"); try { final IMicroDocument aDoc = createMapDocument (aMap); return MicroWriter.writeToStream (aDoc, aOS, XMLWriterSettings.DEFAULT_XML_SETTINGS); } finally { StreamHelper.close (aOS); } }
[ "@", "Nonnull", "public", "static", "ESuccess", "writeMap", "(", "@", "Nonnull", "final", "Map", "<", "String", ",", "String", ">", "aMap", ",", "@", "Nonnull", "@", "WillClose", "final", "OutputStream", "aOS", ")", "{", "ValueEnforcer", ".", "notNull", "(...
Write the passed map to the passed output stream using the predefined XML layout. @param aMap The map to be written. May not be <code>null</code>. @param aOS The output stream to write to. The stream is closed independent of success or failure. May not be <code>null</code>. @return {@link ESuccess#SUCCESS} when everything went well, {@link ESuccess#FAILURE} otherwise.
[ "Write", "the", "passed", "map", "to", "the", "passed", "output", "stream", "using", "the", "predefined", "XML", "layout", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/microdom/util/XMLMapHandler.java#L228-L243
136,647
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/transform/XMLTransformerFactory.java
XMLTransformerFactory.newTransformer
@Nullable public static Transformer newTransformer (@Nonnull final TransformerFactory aTransformerFactory) { ValueEnforcer.notNull (aTransformerFactory, "TransformerFactory"); try { return aTransformerFactory.newTransformer (); } catch (final TransformerConfigurationException ex) { LOGGER.error ("Failed to create transformer", ex); return null; } }
java
@Nullable public static Transformer newTransformer (@Nonnull final TransformerFactory aTransformerFactory) { ValueEnforcer.notNull (aTransformerFactory, "TransformerFactory"); try { return aTransformerFactory.newTransformer (); } catch (final TransformerConfigurationException ex) { LOGGER.error ("Failed to create transformer", ex); return null; } }
[ "@", "Nullable", "public", "static", "Transformer", "newTransformer", "(", "@", "Nonnull", "final", "TransformerFactory", "aTransformerFactory", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aTransformerFactory", ",", "\"TransformerFactory\"", ")", ";", "try", "{",...
Create a new XSLT transformer for no specific resource. @param aTransformerFactory The transformer factory to be used. May not be <code>null</code>. @return <code>null</code> if something goes wrong
[ "Create", "a", "new", "XSLT", "transformer", "for", "no", "specific", "resource", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/transform/XMLTransformerFactory.java#L147-L161
136,648
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/util/StringScanner.java
StringScanner.getRest
@Nonnull public String getRest () { final String ret = m_sInput.substring (m_nCurIndex); m_nCurIndex = m_nMaxIndex; return ret; }
java
@Nonnull public String getRest () { final String ret = m_sInput.substring (m_nCurIndex); m_nCurIndex = m_nMaxIndex; return ret; }
[ "@", "Nonnull", "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 @return The remaining string. May not be <code>null</code> but may be empty.
[ "Get", "all", "remaining", "chars", "and", "set", "the", "index", "to", "the", "end", "of", "the", "input", "string" ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/util/StringScanner.java#L129-L135
136,649
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/util/StringScanner.java
StringScanner.getUntil
@Nonnull 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); }
java
@Nonnull 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); }
[ "@", "Nonnull", "public", "String", "getUntil", "(", "final", "char", "cEndExcl", ")", "{", "final", "int", "nStart", "=", "m_nCurIndex", ";", "while", "(", "m_nCurIndex", "<", "m_nMaxIndex", "&&", "getCurrentChar", "(", ")", "!=", "cEndExcl", ")", "++", "...
Get the string until the specified end character, but excluding the end character. @param cEndExcl The end character to search. @return A non-<code>null</code> string with all characters from the current index until the end character, but not including the end character.
[ "Get", "the", "string", "until", "the", "specified", "end", "character", "but", "excluding", "the", "end", "character", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/util/StringScanner.java#L163-L170
136,650
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/state/ChangeWithValue.java
ChangeWithValue.getIfChanged
@Nullable public DATATYPE getIfChanged (@Nullable final DATATYPE aUnchangedValue) { return m_eChange.isChanged () ? m_aObj : aUnchangedValue; }
java
@Nullable public DATATYPE getIfChanged (@Nullable final DATATYPE aUnchangedValue) { return m_eChange.isChanged () ? m_aObj : aUnchangedValue; }
[ "@", "Nullable", "public", "DATATYPE", "getIfChanged", "(", "@", "Nullable", "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. @param aUnchangedValue The unchanged value to be used. May be <code>null</code>. @return Either the stored value or the unchanged value. May be <code>null</code>.
[ "Get", "the", "store", "value", "if", "this", "is", "a", "change", ".", "Otherwise", "the", "passed", "unchanged", "value", "is", "returned", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/state/ChangeWithValue.java#L79-L83
136,651
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/state/ChangeWithValue.java
ChangeWithValue.getIfUnchanged
@Nullable public DATATYPE getIfUnchanged (@Nullable final DATATYPE aChangedValue) { return m_eChange.isUnchanged () ? m_aObj : aChangedValue; }
java
@Nullable public DATATYPE getIfUnchanged (@Nullable final DATATYPE aChangedValue) { return m_eChange.isUnchanged () ? m_aObj : aChangedValue; }
[ "@", "Nullable", "public", "DATATYPE", "getIfUnchanged", "(", "@", "Nullable", "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. @param aChangedValue The changed value to be used. May be <code>null</code>. @return Either the stored value or the changed value. May be <code>null</code>.
[ "Get", "the", "store", "value", "if", "this", "is", "unchanged", ".", "Otherwise", "the", "passed", "changed", "value", "is", "returned", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/state/ChangeWithValue.java#L106-L110
136,652
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/state/ChangeWithValue.java
ChangeWithValue.createChanged
@Nonnull public static <DATATYPE> ChangeWithValue <DATATYPE> createChanged (@Nullable final DATATYPE aValue) { return new ChangeWithValue <> (EChange.CHANGED, aValue); }
java
@Nonnull public static <DATATYPE> ChangeWithValue <DATATYPE> createChanged (@Nullable final DATATYPE aValue) { return new ChangeWithValue <> (EChange.CHANGED, aValue); }
[ "@", "Nonnull", "public", "static", "<", "DATATYPE", ">", "ChangeWithValue", "<", "DATATYPE", ">", "createChanged", "(", "@", "Nullable", "final", "DATATYPE", "aValue", ")", "{", "return", "new", "ChangeWithValue", "<>", "(", "EChange", ".", "CHANGED", ",", ...
Create a new changed object with the given value. @param <DATATYPE> The data type that is wrapped together with the change indicator @param aValue The value to be used. May be <code>null</code>. @return Never <code>null</code>.
[ "Create", "a", "new", "changed", "object", "with", "the", "given", "value", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/state/ChangeWithValue.java#L156-L160
136,653
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/state/ChangeWithValue.java
ChangeWithValue.createUnchanged
@Nonnull public static <DATATYPE> ChangeWithValue <DATATYPE> createUnchanged (@Nullable final DATATYPE aValue) { return new ChangeWithValue <> (EChange.UNCHANGED, aValue); }
java
@Nonnull public static <DATATYPE> ChangeWithValue <DATATYPE> createUnchanged (@Nullable final DATATYPE aValue) { return new ChangeWithValue <> (EChange.UNCHANGED, aValue); }
[ "@", "Nonnull", "public", "static", "<", "DATATYPE", ">", "ChangeWithValue", "<", "DATATYPE", ">", "createUnchanged", "(", "@", "Nullable", "final", "DATATYPE", "aValue", ")", "{", "return", "new", "ChangeWithValue", "<>", "(", "EChange", ".", "UNCHANGED", ","...
Create a new unchanged object with the given value. @param <DATATYPE> The data type that is wrapped together with the change indicator @param aValue The value to be used. May be <code>null</code>. @return Never <code>null</code>.
[ "Create", "a", "new", "unchanged", "object", "with", "the", "given", "value", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/state/ChangeWithValue.java#L171-L175
136,654
phax/ph-commons
ph-security/src/main/java/com/helger/security/authentication/result/AuthTokenRegistry.java
AuthTokenRegistry.getAllTokensOfSubject
@Nonnull public static ICommonsList <IAuthToken> getAllTokensOfSubject (@Nonnull final IAuthSubject aSubject) { ValueEnforcer.notNull (aSubject, "Subject"); return s_aRWLock.readLocked ( () -> CommonsArrayList.createFiltered (s_aMap.values (), aToken -> aToken.getIdentification () .hasAuthSubject (aSubject))); }
java
@Nonnull public static ICommonsList <IAuthToken> getAllTokensOfSubject (@Nonnull final IAuthSubject aSubject) { ValueEnforcer.notNull (aSubject, "Subject"); return s_aRWLock.readLocked ( () -> CommonsArrayList.createFiltered (s_aMap.values (), aToken -> aToken.getIdentification () .hasAuthSubject (aSubject))); }
[ "@", "Nonnull", "public", "static", "ICommonsList", "<", "IAuthToken", ">", "getAllTokensOfSubject", "(", "@", "Nonnull", "final", "IAuthSubject", "aSubject", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aSubject", ",", "\"Subject\"", ")", ";", "return", "s_...
Get all tokens of the specified auth subject. All tokens are returned, no matter whether they are expired or not. @param aSubject The subject to query. May not be <code>null</code>. @return The list and never <code>null</code>.
[ "Get", "all", "tokens", "of", "the", "specified", "auth", "subject", ".", "All", "tokens", "are", "returned", "no", "matter", "whether", "they", "are", "expired", "or", "not", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-security/src/main/java/com/helger/security/authentication/result/AuthTokenRegistry.java#L116-L124
136,655
phax/ph-commons
ph-security/src/main/java/com/helger/security/authentication/result/AuthTokenRegistry.java
AuthTokenRegistry.removeAllTokensOfSubject
@Nonnegative public static int removeAllTokensOfSubject (@Nonnull final IAuthSubject aSubject) { ValueEnforcer.notNull (aSubject, "Subject"); // get all token IDs matching a given subject // Note: required IAuthSubject to implement equals! final ICommonsList <String> aDelTokenIDs = new CommonsArrayList <> (); s_aRWLock.readLocked ( () -> { for (final Map.Entry <String, AuthToken> aEntry : s_aMap.entrySet ()) if (aEntry.getValue ().getIdentification ().hasAuthSubject (aSubject)) aDelTokenIDs.add (aEntry.getKey ()); }); for (final String sDelTokenID : aDelTokenIDs) removeToken (sDelTokenID); return aDelTokenIDs.size (); }
java
@Nonnegative public static int removeAllTokensOfSubject (@Nonnull final IAuthSubject aSubject) { ValueEnforcer.notNull (aSubject, "Subject"); // get all token IDs matching a given subject // Note: required IAuthSubject to implement equals! final ICommonsList <String> aDelTokenIDs = new CommonsArrayList <> (); s_aRWLock.readLocked ( () -> { for (final Map.Entry <String, AuthToken> aEntry : s_aMap.entrySet ()) if (aEntry.getValue ().getIdentification ().hasAuthSubject (aSubject)) aDelTokenIDs.add (aEntry.getKey ()); }); for (final String sDelTokenID : aDelTokenIDs) removeToken (sDelTokenID); return aDelTokenIDs.size (); }
[ "@", "Nonnegative", "public", "static", "int", "removeAllTokensOfSubject", "(", "@", "Nonnull", "final", "IAuthSubject", "aSubject", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aSubject", ",", "\"Subject\"", ")", ";", "// get all token IDs matching a given subject"...
Remove all tokens of the given subject @param aSubject The subject for which the tokens should be removed. @return The number of removed tokens. Always &ge; 0.
[ "Remove", "all", "tokens", "of", "the", "given", "subject" ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-security/src/main/java/com/helger/security/authentication/result/AuthTokenRegistry.java#L133-L151
136,656
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/lang/EnumHelper.java
EnumHelper.getFromNameCaseInsensitiveOrNull
@Nullable public static <ENUMTYPE extends Enum <ENUMTYPE> & IHasName> ENUMTYPE getFromNameCaseInsensitiveOrNull (@Nonnull final Class <ENUMTYPE> aClass, @Nullable final String sName) { return getFromNameCaseInsensitiveOrDefault (aClass, sName, null); }
java
@Nullable public static <ENUMTYPE extends Enum <ENUMTYPE> & IHasName> ENUMTYPE getFromNameCaseInsensitiveOrNull (@Nonnull final Class <ENUMTYPE> aClass, @Nullable final String sName) { return getFromNameCaseInsensitiveOrDefault (aClass, sName, null); }
[ "@", "Nullable", "public", "static", "<", "ENUMTYPE", "extends", "Enum", "<", "ENUMTYPE", ">", "&", "IHasName", ">", "ENUMTYPE", "getFromNameCaseInsensitiveOrNull", "(", "@", "Nonnull", "final", "Class", "<", "ENUMTYPE", ">", "aClass", ",", "@", "Nullable", "f...
Get the enum value with the passed name case insensitive @param <ENUMTYPE> The enum type @param aClass The enum class @param sName The name to search @return <code>null</code> if no enum item with the given ID is present.
[ "Get", "the", "enum", "value", "with", "the", "passed", "name", "case", "insensitive" ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/EnumHelper.java#L418-L423
136,657
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/lang/EnumHelper.java
EnumHelper.getEnumID
@Nonnull public static String getEnumID (@Nonnull final Enum <?> aEnum) { // No explicit null check, because this method is used heavily in // locale resolving, so we want to spare some CPU cycles :) return aEnum.getClass ().getName () + '.' + aEnum.name (); }
java
@Nonnull public static String getEnumID (@Nonnull final Enum <?> aEnum) { // No explicit null check, because this method is used heavily in // locale resolving, so we want to spare some CPU cycles :) return aEnum.getClass ().getName () + '.' + aEnum.name (); }
[ "@", "Nonnull", "public", "static", "String", "getEnumID", "(", "@", "Nonnull", "final", "Enum", "<", "?", ">", "aEnum", ")", "{", "// No explicit null check, because this method is used heavily in", "// locale resolving, so we want to spare some CPU cycles :)", "return", "aE...
Get the unique name of the passed enum entry. @param aEnum The enum to use. May not be <code>null</code>. @return The unique ID as a combination of the class name and the enum entry name. Never <code>null</code>.
[ "Get", "the", "unique", "name", "of", "the", "passed", "enum", "entry", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/EnumHelper.java#L483-L489
136,658
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/ls/SimpleLSResourceResolver.java
SimpleLSResourceResolver.internalResolveResource
@OverrideOnDemand @Nullable protected IReadableResource internalResolveResource (@Nonnull @Nonempty final String sType, @Nullable final String sNamespaceURI, @Nullable final String sPublicId, @Nullable final String sSystemId, @Nullable final String sBaseURI) throws Exception { if (DEBUG_RESOLVE) if (LOGGER.isInfoEnabled ()) LOGGER.info ("internalResolveResource (" + sType + ", " + sNamespaceURI + ", " + sPublicId + ", " + sSystemId + ", " + sBaseURI + ")"); return DefaultResourceResolver.getResolvedResource (sSystemId, sBaseURI, getClassLoader ()); }
java
@OverrideOnDemand @Nullable protected IReadableResource internalResolveResource (@Nonnull @Nonempty final String sType, @Nullable final String sNamespaceURI, @Nullable final String sPublicId, @Nullable final String sSystemId, @Nullable final String sBaseURI) throws Exception { if (DEBUG_RESOLVE) if (LOGGER.isInfoEnabled ()) LOGGER.info ("internalResolveResource (" + sType + ", " + sNamespaceURI + ", " + sPublicId + ", " + sSystemId + ", " + sBaseURI + ")"); return DefaultResourceResolver.getResolvedResource (sSystemId, sBaseURI, getClassLoader ()); }
[ "@", "OverrideOnDemand", "@", "Nullable", "protected", "IReadableResource", "internalResolveResource", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sType", ",", "@", "Nullable", "final", "String", "sNamespaceURI", ",", "@", "Nullable", "final", "String"...
Internal resource resolving @param sType The type of the resource being resolved. For XML [ <a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>] resources (i.e. entities), applications must use the value <code> "http://www.w3.org/TR/REC-xml"</code>. For XML Schema [ <a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/'>XML Schema Part 1</a>] , applications must use the value <code> "http://www.w3.org/2001/XMLSchema"</code>. Other types of resources are outside the scope of this specification and therefore should recommend an absolute URI in order to use this method. @param sNamespaceURI The namespace of the resource being resolved, e.g. the target namespace of the XML Schema [ <a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/'>XML Schema Part 1</a>] when resolving XML Schema resources. @param sPublicId The public identifier of the external entity being referenced, or <code>null</code> if no public identifier was supplied or if the resource is not an entity. @param sSystemId the path of the resource to find - may be relative to the including resource. The system identifier, a URI reference [ <a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>], of the external resource being referenced, or <code>null</code> if no system identifier was supplied. @param sBaseURI The systemId of the including resource.The absolute base URI of the resource being parsed, or <code>null</code> if there is no base URI. @return <code>null</code> if the resource could not be resolved. @throws Exception in case something goes wrong
[ "Internal", "resource", "resolving" ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/ls/SimpleLSResourceResolver.java#L97-L120
136,659
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/ls/SimpleLSResourceResolver.java
SimpleLSResourceResolver.mainResolveResource
@Override @Nullable public final LSInput mainResolveResource (@Nonnull @Nonempty final String sType, @Nullable final String sNamespaceURI, @Nullable final String sPublicId, @Nullable final String sSystemId, @Nullable final String sBaseURI) { try { // Try to get the resource final IReadableResource aResolvedResource = internalResolveResource (sType, sNamespaceURI, sPublicId, sSystemId, sBaseURI); return new ResourceLSInput (aResolvedResource); } catch (final Exception ex) { throw new IllegalStateException ("Failed to resolve resource '" + sType + "', '" + sNamespaceURI + "', '" + sPublicId + "', '" + sSystemId + "', '" + sBaseURI + "'", ex); } }
java
@Override @Nullable public final LSInput mainResolveResource (@Nonnull @Nonempty final String sType, @Nullable final String sNamespaceURI, @Nullable final String sPublicId, @Nullable final String sSystemId, @Nullable final String sBaseURI) { try { // Try to get the resource final IReadableResource aResolvedResource = internalResolveResource (sType, sNamespaceURI, sPublicId, sSystemId, sBaseURI); return new ResourceLSInput (aResolvedResource); } catch (final Exception ex) { throw new IllegalStateException ("Failed to resolve resource '" + sType + "', '" + sNamespaceURI + "', '" + sPublicId + "', '" + sSystemId + "', '" + sBaseURI + "'", ex); } }
[ "@", "Override", "@", "Nullable", "public", "final", "LSInput", "mainResolveResource", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sType", ",", "@", "Nullable", "final", "String", "sNamespaceURI", ",", "@", "Nullable", "final", "String", "sPublicId...
Resolve a resource with the passed parameters @param sType The type of the resource being resolved. For XML [ <a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>] resources (i.e. entities), applications must use the value <code> "http://www.w3.org/TR/REC-xml"</code>. For XML Schema [ <a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/'>XML Schema Part 1</a>] , applications must use the value <code> "http://www.w3.org/2001/XMLSchema"</code>. Other types of resources are outside the scope of this specification and therefore should recommend an absolute URI in order to use this method. @param sNamespaceURI The namespace of the resource being resolved, e.g. the target namespace of the XML Schema [ <a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/'>XML Schema Part 1</a>] when resolving XML Schema resources. @param sPublicId The public identifier of the external entity being referenced, or <code>null</code> if no public identifier was supplied or if the resource is not an entity. @param sSystemId the path of the resource to find - may be relative to the including resource. The system identifier, a URI reference [ <a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>], of the external resource being referenced, or <code>null</code> if no system identifier was supplied. @param sBaseURI The systemId of the including resource.The absolute base URI of the resource being parsed, or <code>null</code> if there is no base URI. @return <code>null</code> if the resource could not be resolved.
[ "Resolve", "a", "resource", "with", "the", "passed", "parameters" ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/ls/SimpleLSResourceResolver.java#L155-L188
136,660
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/collection/StackHelper.java
StackHelper.newStack
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> NonBlockingStack <ELEMENTTYPE> newStack (@Nullable final ELEMENTTYPE aValue) { final NonBlockingStack <ELEMENTTYPE> ret = newStack (); ret.push (aValue); return ret; }
java
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> NonBlockingStack <ELEMENTTYPE> newStack (@Nullable final ELEMENTTYPE aValue) { final NonBlockingStack <ELEMENTTYPE> ret = newStack (); ret.push (aValue); return ret; }
[ "@", "Nonnull", "@", "ReturnsMutableCopy", "public", "static", "<", "ELEMENTTYPE", ">", "NonBlockingStack", "<", "ELEMENTTYPE", ">", "newStack", "(", "@", "Nullable", "final", "ELEMENTTYPE", "aValue", ")", "{", "final", "NonBlockingStack", "<", "ELEMENTTYPE", ">",...
Create a new stack with a single element. @param <ELEMENTTYPE> The type of elements contained in the stack. @param aValue The value to push. Maybe <code>null</code>. @return A non-<code>null</code> stack.
[ "Create", "a", "new", "stack", "with", "a", "single", "element", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/collection/StackHelper.java#L85-L92
136,661
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/collection/StackHelper.java
StackHelper.newStack
@Nonnull @ReturnsMutableCopy @SafeVarargs public static <ELEMENTTYPE> NonBlockingStack <ELEMENTTYPE> newStack (@Nullable final ELEMENTTYPE... aValues) { return new NonBlockingStack <> (aValues); }
java
@Nonnull @ReturnsMutableCopy @SafeVarargs public static <ELEMENTTYPE> NonBlockingStack <ELEMENTTYPE> newStack (@Nullable final ELEMENTTYPE... aValues) { return new NonBlockingStack <> (aValues); }
[ "@", "Nonnull", "@", "ReturnsMutableCopy", "@", "SafeVarargs", "public", "static", "<", "ELEMENTTYPE", ">", "NonBlockingStack", "<", "ELEMENTTYPE", ">", "newStack", "(", "@", "Nullable", "final", "ELEMENTTYPE", "...", "aValues", ")", "{", "return", "new", "NonBl...
Create a new stack from the given array. @param <ELEMENTTYPE> The type of elements contained in the stack. @param aValues The values that are to be pushed on the stack. The last element will be the top element on the stack. May not be <code>null</code> . @return A non-<code>null</code> stack object.
[ "Create", "a", "new", "stack", "from", "the", "given", "array", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/collection/StackHelper.java#L104-L110
136,662
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/collection/StackHelper.java
StackHelper.newStack
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> NonBlockingStack <ELEMENTTYPE> newStack (@Nullable final Collection <? extends ELEMENTTYPE> aValues) { return new NonBlockingStack <> (aValues); }
java
@Nonnull @ReturnsMutableCopy public static <ELEMENTTYPE> NonBlockingStack <ELEMENTTYPE> newStack (@Nullable final Collection <? extends ELEMENTTYPE> aValues) { return new NonBlockingStack <> (aValues); }
[ "@", "Nonnull", "@", "ReturnsMutableCopy", "public", "static", "<", "ELEMENTTYPE", ">", "NonBlockingStack", "<", "ELEMENTTYPE", ">", "newStack", "(", "@", "Nullable", "final", "Collection", "<", "?", "extends", "ELEMENTTYPE", ">", "aValues", ")", "{", "return", ...
Create a new stack from the given collection. @param <ELEMENTTYPE> The type of elements contained in the stack. @param aValues The values that are to be pushed on the stack. The last element will be the top element on the stack. May not be <code>null</code> . @return A non-<code>null</code> stack object.
[ "Create", "a", "new", "stack", "from", "the", "given", "collection", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/collection/StackHelper.java#L134-L139
136,663
phax/as2-peppol-client
src/main/java/com/helger/peppol/as2client/AS2ClientBuilder.java
AS2ClientBuilder.validateOutgoingBusinessDocument
@OverrideOnDemand protected void validateOutgoingBusinessDocument (@Nonnull final Element aXML) throws AS2ClientBuilderException { if (m_aVESRegistry == null) { // Create lazily m_aVESRegistry = createValidationRegistry (); } final IValidationExecutorSet aVES = m_aVESRegistry.getOfID (m_aVESID); if (aVES == null) throw new AS2ClientBuilderException ("The validation executor set ID " + m_aVESID.getAsSingleID () + " is unknown!"); final ValidationExecutionManager aVEM = aVES.createExecutionManager (); final ValidationResultList aValidationResult = aVEM.executeValidation (ValidationSource.create (null, aXML), (Locale) null); if (aValidationResult.containsAtLeastOneError ()) throw new AS2ClientBuilderValidationException (aValidationResult); }
java
@OverrideOnDemand protected void validateOutgoingBusinessDocument (@Nonnull final Element aXML) throws AS2ClientBuilderException { if (m_aVESRegistry == null) { // Create lazily m_aVESRegistry = createValidationRegistry (); } final IValidationExecutorSet aVES = m_aVESRegistry.getOfID (m_aVESID); if (aVES == null) throw new AS2ClientBuilderException ("The validation executor set ID " + m_aVESID.getAsSingleID () + " is unknown!"); final ValidationExecutionManager aVEM = aVES.createExecutionManager (); final ValidationResultList aValidationResult = aVEM.executeValidation (ValidationSource.create (null, aXML), (Locale) null); if (aValidationResult.containsAtLeastOneError ()) throw new AS2ClientBuilderValidationException (aValidationResult); }
[ "@", "OverrideOnDemand", "protected", "void", "validateOutgoingBusinessDocument", "(", "@", "Nonnull", "final", "Element", "aXML", ")", "throws", "AS2ClientBuilderException", "{", "if", "(", "m_aVESRegistry", "==", "null", ")", "{", "// Create lazily", "m_aVESRegistry",...
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. @param aXML The DOM Element with the business document to be validated. @throws AS2ClientBuilderException In case the validation executor set ID is unknown. @throws AS2ClientBuilderValidationException In case validation failed. @see #setValidationKey(VESID)
[ "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...
499fea5938df1a3c69aade5bf8be26b6e261988f
https://github.com/phax/as2-peppol-client/blob/499fea5938df1a3c69aade5bf8be26b6e261988f/src/main/java/com/helger/peppol/as2client/AS2ClientBuilder.java#L1029-L1048
136,664
phax/ph-commons
ph-scopes/src/main/java/com/helger/scope/mgr/ScopeSessionManager.java
ScopeSessionManager.getSessionScopeOfID
@Nullable public ISessionScope getSessionScopeOfID (@Nullable final String sScopeID) { if (StringHelper.hasNoText (sScopeID)) return null; return m_aRWLock.readLocked ( () -> m_aSessionScopes.get (sScopeID)); }
java
@Nullable public ISessionScope getSessionScopeOfID (@Nullable final String sScopeID) { if (StringHelper.hasNoText (sScopeID)) return null; return m_aRWLock.readLocked ( () -> m_aSessionScopes.get (sScopeID)); }
[ "@", "Nullable", "public", "ISessionScope", "getSessionScopeOfID", "(", "@", "Nullable", "final", "String", "sScopeID", ")", "{", "if", "(", "StringHelper", ".", "hasNoText", "(", "sScopeID", ")", ")", "return", "null", ";", "return", "m_aRWLock", ".", "readLo...
Get the session scope with the specified ID. If no such scope exists, no further actions are taken. @param sScopeID The ID to be resolved. May be <code>null</code>. @return <code>null</code> if no such scope exists.
[ "Get", "the", "session", "scope", "with", "the", "specified", "ID", ".", "If", "no", "such", "scope", "exists", "no", "further", "actions", "are", "taken", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-scopes/src/main/java/com/helger/scope/mgr/ScopeSessionManager.java#L104-L111
136,665
phax/ph-commons
ph-scopes/src/main/java/com/helger/scope/mgr/ScopeSessionManager.java
ScopeSessionManager.onScopeEnd
public void onScopeEnd (@Nonnull final ISessionScope aSessionScope) { ValueEnforcer.notNull (aSessionScope, "SessionScope"); // Only handle scopes that are not yet destructed if (aSessionScope.isValid ()) { final String sSessionID = aSessionScope.getID (); final boolean bCanDestroyScope = m_aRWLock.writeLocked ( () -> { boolean bWLCanDestroyScope = false; // Only if we're not just in destruction of exactly this session if (m_aSessionsInDestruction.add (sSessionID)) { // Remove from map final ISessionScope aRemovedScope = m_aSessionScopes.remove (sSessionID); if (!EqualsHelper.identityEqual (aRemovedScope, aSessionScope)) { LOGGER.error ("Ending an unknown session with ID '" + sSessionID + "'"); LOGGER.error (" Scope to be removed: " + aSessionScope); LOGGER.error (" Removed scope: " + aRemovedScope); } bWLCanDestroyScope = true; } else LOGGER.info ("Already destructing session '" + sSessionID + "'"); return bWLCanDestroyScope; }); if (bCanDestroyScope) { // Destroy scope outside of write lock try { // Invoke SPIs ScopeSPIManager.getInstance ().onSessionScopeEnd (aSessionScope); // Destroy the scope aSessionScope.destroyScope (); } finally { // Remove from "in destruction" list m_aRWLock.writeLocked ( () -> m_aSessionsInDestruction.remove (sSessionID)); } } } }
java
public void onScopeEnd (@Nonnull final ISessionScope aSessionScope) { ValueEnforcer.notNull (aSessionScope, "SessionScope"); // Only handle scopes that are not yet destructed if (aSessionScope.isValid ()) { final String sSessionID = aSessionScope.getID (); final boolean bCanDestroyScope = m_aRWLock.writeLocked ( () -> { boolean bWLCanDestroyScope = false; // Only if we're not just in destruction of exactly this session if (m_aSessionsInDestruction.add (sSessionID)) { // Remove from map final ISessionScope aRemovedScope = m_aSessionScopes.remove (sSessionID); if (!EqualsHelper.identityEqual (aRemovedScope, aSessionScope)) { LOGGER.error ("Ending an unknown session with ID '" + sSessionID + "'"); LOGGER.error (" Scope to be removed: " + aSessionScope); LOGGER.error (" Removed scope: " + aRemovedScope); } bWLCanDestroyScope = true; } else LOGGER.info ("Already destructing session '" + sSessionID + "'"); return bWLCanDestroyScope; }); if (bCanDestroyScope) { // Destroy scope outside of write lock try { // Invoke SPIs ScopeSPIManager.getInstance ().onSessionScopeEnd (aSessionScope); // Destroy the scope aSessionScope.destroyScope (); } finally { // Remove from "in destruction" list m_aRWLock.writeLocked ( () -> m_aSessionsInDestruction.remove (sSessionID)); } } } }
[ "public", "void", "onScopeEnd", "(", "@", "Nonnull", "final", "ISessionScope", "aSessionScope", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aSessionScope", ",", "\"SessionScope\"", ")", ";", "// Only handle scopes that are not yet destructed", "if", "(", "aSessionS...
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. @param aSessionScope The session scope to be ended. May not be <code>null</code>.
[ "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", "dest...
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-scopes/src/main/java/com/helger/scope/mgr/ScopeSessionManager.java#L150-L197
136,666
phax/ph-commons
ph-scopes/src/main/java/com/helger/scope/mgr/ScopeSessionManager.java
ScopeSessionManager.destroyAllSessions
public void destroyAllSessions () { // destroy all session scopes (use a copy, because we're invalidating // the sessions internally!) for (final ISessionScope aSessionScope : getAllSessionScopes ()) { // Unfortunately we need a special handling here if (aSessionScope.selfDestruct ().isContinue ()) { // Remove from map onScopeEnd (aSessionScope); } // Else the destruction was already started! } // Sanity check in case something went wrong _checkIfAnySessionsExist (); }
java
public void destroyAllSessions () { // destroy all session scopes (use a copy, because we're invalidating // the sessions internally!) for (final ISessionScope aSessionScope : getAllSessionScopes ()) { // Unfortunately we need a special handling here if (aSessionScope.selfDestruct ().isContinue ()) { // Remove from map onScopeEnd (aSessionScope); } // Else the destruction was already started! } // Sanity check in case something went wrong _checkIfAnySessionsExist (); }
[ "public", "void", "destroyAllSessions", "(", ")", "{", "// destroy all session scopes (use a copy, because we're invalidating", "// the sessions internally!)", "for", "(", "final", "ISessionScope", "aSessionScope", ":", "getAllSessionScopes", "(", ")", ")", "{", "// Unfortunate...
Destroy all known session scopes. After this method it is ensured that the internal session map is empty.
[ "Destroy", "all", "known", "session", "scopes", ".", "After", "this", "method", "it", "is", "ensured", "that", "the", "internal", "session", "map", "is", "empty", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-scopes/src/main/java/com/helger/scope/mgr/ScopeSessionManager.java#L246-L263
136,667
phax/ph-commons
ph-scopes/src/main/java/com/helger/scope/mgr/ScopeManager.java
ScopeManager.onGlobalBegin
@Nonnull public static IGlobalScope onGlobalBegin (@Nonnull @Nonempty final String sScopeID) { return onGlobalBegin (sScopeID, GlobalScope::new); }
java
@Nonnull public static IGlobalScope onGlobalBegin (@Nonnull @Nonempty final String sScopeID) { return onGlobalBegin (sScopeID, GlobalScope::new); }
[ "@", "Nonnull", "public", "static", "IGlobalScope", "onGlobalBegin", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sScopeID", ")", "{", "return", "onGlobalBegin", "(", "sScopeID", ",", "GlobalScope", "::", "new", ")", ";", "}" ]
This method is used to set the initial global scope. @param sScopeID The scope ID to use @return The created global scope object. Never <code>null</code>.
[ "This", "method", "is", "used", "to", "set", "the", "initial", "global", "scope", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-scopes/src/main/java/com/helger/scope/mgr/ScopeManager.java#L123-L127
136,668
phax/ph-commons
ph-scopes/src/main/java/com/helger/scope/mgr/ScopeManager.java
ScopeManager.onGlobalEnd
public static void onGlobalEnd () { s_aGlobalLock.locked ( () -> { /** * This code removes all attributes set for the global context. This is * necessary, since the attributes would survive a Tomcat servlet context * reload if we don't kill them manually.<br> * Global scope variable may be null if onGlobalBegin() was never called! */ if (s_aGlobalScope != null) { // Invoke SPI ScopeSPIManager.getInstance ().onGlobalScopeEnd (s_aGlobalScope); // Destroy and invalidate scope final String sDestroyedScopeID = s_aGlobalScope.getID (); s_aGlobalScope.destroyScope (); s_aGlobalScope = null; // done if (ScopeHelper.debugGlobalScopeLifeCycle (LOGGER)) LOGGER.info ("Global scope '" + sDestroyedScopeID + "' shut down!", ScopeHelper.getDebugStackTrace ()); } else LOGGER.warn ("No global scope present that could be shut down!"); }); }
java
public static void onGlobalEnd () { s_aGlobalLock.locked ( () -> { /** * This code removes all attributes set for the global context. This is * necessary, since the attributes would survive a Tomcat servlet context * reload if we don't kill them manually.<br> * Global scope variable may be null if onGlobalBegin() was never called! */ if (s_aGlobalScope != null) { // Invoke SPI ScopeSPIManager.getInstance ().onGlobalScopeEnd (s_aGlobalScope); // Destroy and invalidate scope final String sDestroyedScopeID = s_aGlobalScope.getID (); s_aGlobalScope.destroyScope (); s_aGlobalScope = null; // done if (ScopeHelper.debugGlobalScopeLifeCycle (LOGGER)) LOGGER.info ("Global scope '" + sDestroyedScopeID + "' shut down!", ScopeHelper.getDebugStackTrace ()); } else LOGGER.warn ("No global scope present that could be shut down!"); }); }
[ "public", "static", "void", "onGlobalEnd", "(", ")", "{", "s_aGlobalLock", ".", "locked", "(", "(", ")", "->", "{", "/**\n * This code removes all attributes set for the global context. This is\n * necessary, since the attributes would survive a Tomcat servlet context\n ...
To be called when the singleton global context is to be destroyed.
[ "To", "be", "called", "when", "the", "singleton", "global", "context", "is", "to", "be", "destroyed", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-scopes/src/main/java/com/helger/scope/mgr/ScopeManager.java#L165-L191
136,669
phax/ph-commons
ph-scopes/src/main/java/com/helger/scope/mgr/ScopeManager.java
ScopeManager.destroySessionScope
public static void destroySessionScope (@Nonnull final ISessionScope aSessionScope) { ValueEnforcer.notNull (aSessionScope, "SessionScope"); ScopeSessionManager.getInstance ().onScopeEnd (aSessionScope); }
java
public static void destroySessionScope (@Nonnull final ISessionScope aSessionScope) { ValueEnforcer.notNull (aSessionScope, "SessionScope"); ScopeSessionManager.getInstance ().onScopeEnd (aSessionScope); }
[ "public", "static", "void", "destroySessionScope", "(", "@", "Nonnull", "final", "ISessionScope", "aSessionScope", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aSessionScope", ",", "\"SessionScope\"", ")", ";", "ScopeSessionManager", ".", "getInstance", "(", ")"...
Manually destroy the passed session scope. @param aSessionScope The session scope to be destroyed. May not be <code>null</code>.
[ "Manually", "destroy", "the", "passed", "session", "scope", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-scopes/src/main/java/com/helger/scope/mgr/ScopeManager.java#L274-L279
136,670
phax/ph-commons
ph-scopes/src/main/java/com/helger/scope/mgr/ScopeManager.java
ScopeManager.onRequestEnd
public static void onRequestEnd () { final IRequestScope aRequestScope = getRequestScopeOrNull (); try { // Do we have something to destroy? if (aRequestScope != null) { _destroyRequestScope (aRequestScope); } else { // Happens after an internal redirect happened in a web-application // (e.g. for 404 page) for the original scope LOGGER.warn ("No request scope present that could be ended!"); } } finally { // Remove from ThreadLocal internalClearRequestScope (); } }
java
public static void onRequestEnd () { final IRequestScope aRequestScope = getRequestScopeOrNull (); try { // Do we have something to destroy? if (aRequestScope != null) { _destroyRequestScope (aRequestScope); } else { // Happens after an internal redirect happened in a web-application // (e.g. for 404 page) for the original scope LOGGER.warn ("No request scope present that could be ended!"); } } finally { // Remove from ThreadLocal internalClearRequestScope (); } }
[ "public", "static", "void", "onRequestEnd", "(", ")", "{", "final", "IRequestScope", "aRequestScope", "=", "getRequestScopeOrNull", "(", ")", ";", "try", "{", "// Do we have something to destroy?", "if", "(", "aRequestScope", "!=", "null", ")", "{", "_destroyRequest...
To be called after a request finished.
[ "To", "be", "called", "after", "a", "request", "finished", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-scopes/src/main/java/com/helger/scope/mgr/ScopeManager.java#L394-L416
136,671
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/serialize/write/XMLEmitter.java
XMLEmitter.onDocumentType
public void onDocumentType (@Nonnull final String sQualifiedElementName, @Nullable final String sPublicID, @Nullable final String sSystemID) { ValueEnforcer.notNull (sQualifiedElementName, "QualifiedElementName"); final String sDocType = getDocTypeXMLRepresentation (m_eXMLVersion, m_aXMLWriterSettings.getIncorrectCharacterHandling (), sQualifiedElementName, sPublicID, sSystemID); _append (sDocType); newLine (); }
java
public void onDocumentType (@Nonnull final String sQualifiedElementName, @Nullable final String sPublicID, @Nullable final String sSystemID) { ValueEnforcer.notNull (sQualifiedElementName, "QualifiedElementName"); final String sDocType = getDocTypeXMLRepresentation (m_eXMLVersion, m_aXMLWriterSettings.getIncorrectCharacterHandling (), sQualifiedElementName, sPublicID, sSystemID); _append (sDocType); newLine (); }
[ "public", "void", "onDocumentType", "(", "@", "Nonnull", "final", "String", "sQualifiedElementName", ",", "@", "Nullable", "final", "String", "sPublicID", ",", "@", "Nullable", "final", "String", "sSystemID", ")", "{", "ValueEnforcer", ".", "notNull", "(", "sQua...
On XML document type. @param sQualifiedElementName Qualified name of the root element. @param sPublicID Document type public ID @param sSystemID Document type system ID
[ "On", "XML", "document", "type", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLEmitter.java#L369-L382
136,672
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/serialize/write/XMLEmitter.java
XMLEmitter.onProcessingInstruction
public void onProcessingInstruction (@Nonnull final String sTarget, @Nullable final String sData) { _append (PI_START)._append (sTarget); if (StringHelper.hasText (sData)) _append (' ')._append (sData); _append (PI_END); newLine (); }
java
public void onProcessingInstruction (@Nonnull final String sTarget, @Nullable final String sData) { _append (PI_START)._append (sTarget); if (StringHelper.hasText (sData)) _append (' ')._append (sData); _append (PI_END); newLine (); }
[ "public", "void", "onProcessingInstruction", "(", "@", "Nonnull", "final", "String", "sTarget", ",", "@", "Nullable", "final", "String", "sData", ")", "{", "_append", "(", "PI_START", ")", ".", "_append", "(", "sTarget", ")", ";", "if", "(", "StringHelper", ...
On processing instruction @param sTarget The target @param sData The data (attributes as a string)
[ "On", "processing", "instruction" ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLEmitter.java#L392-L399
136,673
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/serialize/write/XMLEmitter.java
XMLEmitter.onEntityReference
public void onEntityReference (@Nonnull final String sEntityRef) { _append (ER_START)._append (sEntityRef)._append (ER_END); }
java
public void onEntityReference (@Nonnull final String sEntityRef) { _append (ER_START)._append (sEntityRef)._append (ER_END); }
[ "public", "void", "onEntityReference", "(", "@", "Nonnull", "final", "String", "sEntityRef", ")", "{", "_append", "(", "ER_START", ")", ".", "_append", "(", "sEntityRef", ")", ".", "_append", "(", "ER_END", ")", ";", "}" ]
On entity reference. @param sEntityRef The reference (without '&amp;' and ';' !!)
[ "On", "entity", "reference", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLEmitter.java#L407-L410
136,674
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/serialize/write/XMLEmitter.java
XMLEmitter.onContentElementWhitespace
public void onContentElementWhitespace (@Nullable final CharSequence aWhitespaces) { if (StringHelper.hasText (aWhitespaces)) _append (aWhitespaces.toString ()); }
java
public void onContentElementWhitespace (@Nullable final CharSequence aWhitespaces) { if (StringHelper.hasText (aWhitespaces)) _append (aWhitespaces.toString ()); }
[ "public", "void", "onContentElementWhitespace", "(", "@", "Nullable", "final", "CharSequence", "aWhitespaces", ")", "{", "if", "(", "StringHelper", ".", "hasText", "(", "aWhitespaces", ")", ")", "_append", "(", "aWhitespaces", ".", "toString", "(", ")", ")", "...
Ignorable whitespace characters. @param aWhitespaces The whitespace character sequence
[ "Ignorable", "whitespace", "characters", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLEmitter.java#L418-L422
136,675
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/serialize/write/XMLEmitter.java
XMLEmitter.onComment
public void onComment (@Nullable 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); _append (COMMENT_START)._append (sComment)._append (COMMENT_END); } }
java
public void onComment (@Nullable 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); _append (COMMENT_START)._append (sComment)._append (COMMENT_END); } }
[ "public", "void", "onComment", "(", "@", "Nullable", "final", "String", "sComment", ")", "{", "if", "(", "StringHelper", ".", "hasText", "(", "sComment", ")", ")", "{", "if", "(", "isThrowExceptionOnNestedComments", "(", ")", ")", "if", "(", "sComment", "....
Comment node. @param sComment The comment text
[ "Comment", "node", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLEmitter.java#L430-L440
136,676
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/serialize/write/XMLEmitter.java
XMLEmitter.onText
public void onText (@Nonnull final char [] aText, @Nonnegative final int nOfs, @Nonnegative final int nLen) { onText (aText, nOfs, nLen, true); }
java
public void onText (@Nonnull final char [] aText, @Nonnegative final int nOfs, @Nonnegative final int nLen) { onText (aText, nOfs, nLen, true); }
[ "public", "void", "onText", "(", "@", "Nonnull", "final", "char", "[", "]", "aText", ",", "@", "Nonnegative", "final", "int", "nOfs", ",", "@", "Nonnegative", "final", "int", "nLen", ")", "{", "onText", "(", "aText", ",", "nOfs", ",", "nLen", ",", "t...
XML text node. @param aText The contained text array @param nOfs Offset into the array where to start @param nLen Number of chars to use, starting from the provided offset.
[ "XML", "text", "node", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLEmitter.java#L463-L466
136,677
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/serialize/write/XMLEmitter.java
XMLEmitter.onCDATA
public void onCDATA (@Nullable final String sText) { if (StringHelper.hasText (sText)) { if (sText.indexOf (CDATA_END) >= 0) { // Split CDATA sections if they contain the illegal "]]>" marker final ICommonsList <String> aParts = StringHelper.getExploded (CDATA_END, sText); final int nParts = aParts.size (); for (int i = 0; i < nParts; ++i) { _append (CDATA_START); if (i > 0) _append ('>'); _appendMasked (EXMLCharMode.CDATA, aParts.get (i)); if (i < nParts - 1) _append ("]]"); _append (CDATA_END); } } else { // No special handling required _append (CDATA_START)._appendMasked (EXMLCharMode.CDATA, sText)._append (CDATA_END); } } }
java
public void onCDATA (@Nullable final String sText) { if (StringHelper.hasText (sText)) { if (sText.indexOf (CDATA_END) >= 0) { // Split CDATA sections if they contain the illegal "]]>" marker final ICommonsList <String> aParts = StringHelper.getExploded (CDATA_END, sText); final int nParts = aParts.size (); for (int i = 0; i < nParts; ++i) { _append (CDATA_START); if (i > 0) _append ('>'); _appendMasked (EXMLCharMode.CDATA, aParts.get (i)); if (i < nParts - 1) _append ("]]"); _append (CDATA_END); } } else { // No special handling required _append (CDATA_START)._appendMasked (EXMLCharMode.CDATA, sText)._append (CDATA_END); } } }
[ "public", "void", "onCDATA", "(", "@", "Nullable", "final", "String", "sText", ")", "{", "if", "(", "StringHelper", ".", "hasText", "(", "sText", ")", ")", "{", "if", "(", "sText", ".", "indexOf", "(", "CDATA_END", ")", ">=", "0", ")", "{", "// Split...
CDATA node. @param sText The contained text
[ "CDATA", "node", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLEmitter.java#L517-L543
136,678
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/serialize/write/XMLEmitter.java
XMLEmitter.onElementStart
public void onElementStart (@Nullable final String sNamespacePrefix, @Nonnull final String sTagName, @Nullable final Map <QName, String> aAttrs, @Nonnull final EXMLSerializeBracketMode eBracketMode) { elementStartOpen (sNamespacePrefix, sTagName); if (aAttrs != null && !aAttrs.isEmpty ()) { if (m_bOrderAttributesAndNamespaces) { // first separate in NS and non-NS attributes // Sort namespace attributes by assigned prefix final ICommonsSortedMap <QName, String> aNamespaceAttrs = new CommonsTreeMap <> (CXML.getComparatorQNameForNamespacePrefix ()); final ICommonsSortedMap <QName, String> aNonNamespaceAttrs = new CommonsTreeMap <> (CXML.getComparatorQNameNamespaceURIBeforeLocalPart ()); for (final Map.Entry <QName, String> aEntry : aAttrs.entrySet ()) { final QName aAttrName = aEntry.getKey (); if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals (aAttrName.getNamespaceURI ())) aNamespaceAttrs.put (aAttrName, aEntry.getValue ()); else aNonNamespaceAttrs.put (aAttrName, aEntry.getValue ()); } // emit namespace attributes first for (final Map.Entry <QName, String> aEntry : aNamespaceAttrs.entrySet ()) { final QName aAttrName = aEntry.getKey (); elementAttr (aAttrName.getPrefix (), aAttrName.getLocalPart (), aEntry.getValue ()); } // emit non-namespace attributes afterwards for (final Map.Entry <QName, String> aEntry : aNonNamespaceAttrs.entrySet ()) { final QName aAttrName = aEntry.getKey (); elementAttr (aAttrName.getPrefix (), aAttrName.getLocalPart (), aEntry.getValue ()); } } else { // assuming that the order of the passed attributes is consistent! // Emit all attributes for (final Map.Entry <QName, String> aEntry : aAttrs.entrySet ()) { final QName aAttrName = aEntry.getKey (); elementAttr (aAttrName.getPrefix (), aAttrName.getLocalPart (), aEntry.getValue ()); } } } elementStartClose (eBracketMode); }
java
public void onElementStart (@Nullable final String sNamespacePrefix, @Nonnull final String sTagName, @Nullable final Map <QName, String> aAttrs, @Nonnull final EXMLSerializeBracketMode eBracketMode) { elementStartOpen (sNamespacePrefix, sTagName); if (aAttrs != null && !aAttrs.isEmpty ()) { if (m_bOrderAttributesAndNamespaces) { // first separate in NS and non-NS attributes // Sort namespace attributes by assigned prefix final ICommonsSortedMap <QName, String> aNamespaceAttrs = new CommonsTreeMap <> (CXML.getComparatorQNameForNamespacePrefix ()); final ICommonsSortedMap <QName, String> aNonNamespaceAttrs = new CommonsTreeMap <> (CXML.getComparatorQNameNamespaceURIBeforeLocalPart ()); for (final Map.Entry <QName, String> aEntry : aAttrs.entrySet ()) { final QName aAttrName = aEntry.getKey (); if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals (aAttrName.getNamespaceURI ())) aNamespaceAttrs.put (aAttrName, aEntry.getValue ()); else aNonNamespaceAttrs.put (aAttrName, aEntry.getValue ()); } // emit namespace attributes first for (final Map.Entry <QName, String> aEntry : aNamespaceAttrs.entrySet ()) { final QName aAttrName = aEntry.getKey (); elementAttr (aAttrName.getPrefix (), aAttrName.getLocalPart (), aEntry.getValue ()); } // emit non-namespace attributes afterwards for (final Map.Entry <QName, String> aEntry : aNonNamespaceAttrs.entrySet ()) { final QName aAttrName = aEntry.getKey (); elementAttr (aAttrName.getPrefix (), aAttrName.getLocalPart (), aEntry.getValue ()); } } else { // assuming that the order of the passed attributes is consistent! // Emit all attributes for (final Map.Entry <QName, String> aEntry : aAttrs.entrySet ()) { final QName aAttrName = aEntry.getKey (); elementAttr (aAttrName.getPrefix (), aAttrName.getLocalPart (), aEntry.getValue ()); } } } elementStartClose (eBracketMode); }
[ "public", "void", "onElementStart", "(", "@", "Nullable", "final", "String", "sNamespacePrefix", ",", "@", "Nonnull", "final", "String", "sTagName", ",", "@", "Nullable", "final", "Map", "<", "QName", ",", "String", ">", "aAttrs", ",", "@", "Nonnull", "final...
Start of an element. @param sNamespacePrefix Optional namespace prefix. May be <code>null</code>. @param sTagName Tag name @param aAttrs Optional set of attributes. @param eBracketMode Bracket mode to use. Never <code>null</code>.
[ "Start", "of", "an", "element", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLEmitter.java#L596-L645
136,679
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/serialize/write/XMLEmitter.java
XMLEmitter.onElementEnd
public void onElementEnd (@Nullable final String sNamespacePrefix, @Nonnull final String sTagName, @Nonnull final EXMLSerializeBracketMode eBracketMode) { if (eBracketMode.isOpenClose ()) { _append ("</"); if (StringHelper.hasText (sNamespacePrefix)) _appendMasked (EXMLCharMode.ELEMENT_NAME, sNamespacePrefix)._append (CXML.XML_PREFIX_NAMESPACE_SEP); _appendMasked (EXMLCharMode.ELEMENT_NAME, sTagName)._append ('>'); } }
java
public void onElementEnd (@Nullable final String sNamespacePrefix, @Nonnull final String sTagName, @Nonnull final EXMLSerializeBracketMode eBracketMode) { if (eBracketMode.isOpenClose ()) { _append ("</"); if (StringHelper.hasText (sNamespacePrefix)) _appendMasked (EXMLCharMode.ELEMENT_NAME, sNamespacePrefix)._append (CXML.XML_PREFIX_NAMESPACE_SEP); _appendMasked (EXMLCharMode.ELEMENT_NAME, sTagName)._append ('>'); } }
[ "public", "void", "onElementEnd", "(", "@", "Nullable", "final", "String", "sNamespacePrefix", ",", "@", "Nonnull", "final", "String", "sTagName", ",", "@", "Nonnull", "final", "EXMLSerializeBracketMode", "eBracketMode", ")", "{", "if", "(", "eBracketMode", ".", ...
End of an element. @param sNamespacePrefix Optional namespace prefix. May be <code>null</code>. @param sTagName Tag name @param eBracketMode Bracket mode to use. Never <code>null</code>.
[ "End", "of", "an", "element", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLEmitter.java#L657-L668
136,680
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverterRegistry.java
TypeConverterRegistry._registerTypeConverter
private void _registerTypeConverter (@Nonnull final Class <?> aSrcClass, @Nonnull final Class <?> aDstClass, @Nonnull final ITypeConverter <?, ?> aConverter) { ValueEnforcer.notNull (aSrcClass, "SrcClass"); ValueEnforcer.isTrue (ClassHelper.isPublic (aSrcClass), () -> "Source " + aSrcClass + " is no public class!"); ValueEnforcer.notNull (aDstClass, "DstClass"); ValueEnforcer.isTrue (ClassHelper.isPublic (aDstClass), () -> "Destination " + aDstClass + " is no public class!"); ValueEnforcer.isFalse (aSrcClass.equals (aDstClass), "Source and destination class are equal and therefore no converter is required."); ValueEnforcer.notNull (aConverter, "Converter"); ValueEnforcer.isFalse (aConverter instanceof ITypeConverterRule, "Type converter rules must be registered via registerTypeConverterRule"); if (ClassHelper.areConvertibleClasses (aSrcClass, aDstClass)) if (LOGGER.isWarnEnabled ()) LOGGER.warn ("No type converter needed between " + aSrcClass + " and " + aDstClass + " because types are convertible!"); // The main class should not already be registered final Map <Class <?>, ITypeConverter <?, ?>> aSrcMap = _getOrCreateConverterMap (aSrcClass); if (aSrcMap.containsKey (aDstClass)) throw new IllegalArgumentException ("A mapping from " + aSrcClass + " to " + aDstClass + " is already defined!"); m_aRWLock.writeLocked ( () -> { // Automatically register the destination class, and all parent // classes/interfaces for (final WeakReference <Class <?>> aCurWRDstClass : ClassHierarchyCache.getClassHierarchyIterator (aDstClass)) { final Class <?> aCurDstClass = aCurWRDstClass.get (); if (aCurDstClass != null) if (!aSrcMap.containsKey (aCurDstClass)) { if (aSrcMap.put (aCurDstClass, aConverter) != null) { if (LOGGER.isWarnEnabled ()) LOGGER.warn ("Overwriting converter from " + aSrcClass + " to " + aCurDstClass); } else { if (LOGGER.isTraceEnabled ()) LOGGER.trace ("Registered type converter from '" + aSrcClass.toString () + "' to '" + aCurDstClass.toString () + "'"); } } } }); }
java
private void _registerTypeConverter (@Nonnull final Class <?> aSrcClass, @Nonnull final Class <?> aDstClass, @Nonnull final ITypeConverter <?, ?> aConverter) { ValueEnforcer.notNull (aSrcClass, "SrcClass"); ValueEnforcer.isTrue (ClassHelper.isPublic (aSrcClass), () -> "Source " + aSrcClass + " is no public class!"); ValueEnforcer.notNull (aDstClass, "DstClass"); ValueEnforcer.isTrue (ClassHelper.isPublic (aDstClass), () -> "Destination " + aDstClass + " is no public class!"); ValueEnforcer.isFalse (aSrcClass.equals (aDstClass), "Source and destination class are equal and therefore no converter is required."); ValueEnforcer.notNull (aConverter, "Converter"); ValueEnforcer.isFalse (aConverter instanceof ITypeConverterRule, "Type converter rules must be registered via registerTypeConverterRule"); if (ClassHelper.areConvertibleClasses (aSrcClass, aDstClass)) if (LOGGER.isWarnEnabled ()) LOGGER.warn ("No type converter needed between " + aSrcClass + " and " + aDstClass + " because types are convertible!"); // The main class should not already be registered final Map <Class <?>, ITypeConverter <?, ?>> aSrcMap = _getOrCreateConverterMap (aSrcClass); if (aSrcMap.containsKey (aDstClass)) throw new IllegalArgumentException ("A mapping from " + aSrcClass + " to " + aDstClass + " is already defined!"); m_aRWLock.writeLocked ( () -> { // Automatically register the destination class, and all parent // classes/interfaces for (final WeakReference <Class <?>> aCurWRDstClass : ClassHierarchyCache.getClassHierarchyIterator (aDstClass)) { final Class <?> aCurDstClass = aCurWRDstClass.get (); if (aCurDstClass != null) if (!aSrcMap.containsKey (aCurDstClass)) { if (aSrcMap.put (aCurDstClass, aConverter) != null) { if (LOGGER.isWarnEnabled ()) LOGGER.warn ("Overwriting converter from " + aSrcClass + " to " + aCurDstClass); } else { if (LOGGER.isTraceEnabled ()) LOGGER.trace ("Registered type converter from '" + aSrcClass.toString () + "' to '" + aCurDstClass.toString () + "'"); } } } }); }
[ "private", "void", "_registerTypeConverter", "(", "@", "Nonnull", "final", "Class", "<", "?", ">", "aSrcClass", ",", "@", "Nonnull", "final", "Class", "<", "?", ">", "aDstClass", ",", "@", "Nonnull", "final", "ITypeConverter", "<", "?", ",", "?", ">", "a...
Register a default type converter. @param aSrcClass A non-<code>null</code> source class to convert from. Must be an instancable class. @param aDstClass A non-<code>null</code> destination class to convert to. Must be an instancable class. May not equal the source class. @param aConverter The convert to use. May not be <code>null</code>.
[ "Register", "a", "default", "type", "converter", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverterRegistry.java#L122-L174
136,681
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverterRegistry.java
TypeConverterRegistry._iterateFuzzyConverters
private void _iterateFuzzyConverters (@Nonnull final Class <?> aSrcClass, @Nonnull final Class <?> aDstClass, @Nonnull final ITypeConverterCallback aCallback) { // For all possible source classes for (final WeakReference <Class <?>> aCurWRSrcClass : ClassHierarchyCache.getClassHierarchyIterator (aSrcClass)) { final Class <?> aCurSrcClass = aCurWRSrcClass.get (); if (aCurSrcClass != null) { // Do we have a source converter? final Map <Class <?>, ITypeConverter <?, ?>> aConverterMap = m_aConverter.get (aCurSrcClass); if (aConverterMap != null) { // Check explicit destination classes final ITypeConverter <?, ?> aConverter = aConverterMap.get (aDstClass); if (aConverter != null) { // We found a match -> invoke the callback! if (aCallback.call (aCurSrcClass, aDstClass, aConverter).isBreak ()) break; } } } } }
java
private void _iterateFuzzyConverters (@Nonnull final Class <?> aSrcClass, @Nonnull final Class <?> aDstClass, @Nonnull final ITypeConverterCallback aCallback) { // For all possible source classes for (final WeakReference <Class <?>> aCurWRSrcClass : ClassHierarchyCache.getClassHierarchyIterator (aSrcClass)) { final Class <?> aCurSrcClass = aCurWRSrcClass.get (); if (aCurSrcClass != null) { // Do we have a source converter? final Map <Class <?>, ITypeConverter <?, ?>> aConverterMap = m_aConverter.get (aCurSrcClass); if (aConverterMap != null) { // Check explicit destination classes final ITypeConverter <?, ?> aConverter = aConverterMap.get (aDstClass); if (aConverter != null) { // We found a match -> invoke the callback! if (aCallback.call (aCurSrcClass, aDstClass, aConverter).isBreak ()) break; } } } } }
[ "private", "void", "_iterateFuzzyConverters", "(", "@", "Nonnull", "final", "Class", "<", "?", ">", "aSrcClass", ",", "@", "Nonnull", "final", "Class", "<", "?", ">", "aDstClass", ",", "@", "Nonnull", "final", "ITypeConverterCallback", "aCallback", ")", "{", ...
Iterate all possible fuzzy converters from source class to destination class. @param aSrcClass Source class. @param aDstClass Destination class. @param aCallback The callback to be invoked once a converter was found. Must return either {@link EContinue#CONTINUE} to continue iteration or {@link EContinue#BREAK} to break iteration at the current position.
[ "Iterate", "all", "possible", "fuzzy", "converters", "from", "source", "class", "to", "destination", "class", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverterRegistry.java#L252-L277
136,682
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverterRegistry.java
TypeConverterRegistry.iterateAllRegisteredTypeConverters
public void iterateAllRegisteredTypeConverters (@Nonnull final ITypeConverterCallback aCallback) { // Create a copy of the map final Map <Class <?>, Map <Class <?>, ITypeConverter <?, ?>>> aCopy = m_aRWLock.readLocked ( () -> new CommonsHashMap <> (m_aConverter)); // And iterate the copy outer: for (final Map.Entry <Class <?>, Map <Class <?>, ITypeConverter <?, ?>>> aSrcEntry : aCopy.entrySet ()) { final Class <?> aSrcClass = aSrcEntry.getKey (); for (final Map.Entry <Class <?>, ITypeConverter <?, ?>> aDstEntry : aSrcEntry.getValue ().entrySet ()) if (aCallback.call (aSrcClass, aDstEntry.getKey (), aDstEntry.getValue ()).isBreak ()) break outer; } }
java
public void iterateAllRegisteredTypeConverters (@Nonnull final ITypeConverterCallback aCallback) { // Create a copy of the map final Map <Class <?>, Map <Class <?>, ITypeConverter <?, ?>>> aCopy = m_aRWLock.readLocked ( () -> new CommonsHashMap <> (m_aConverter)); // And iterate the copy outer: for (final Map.Entry <Class <?>, Map <Class <?>, ITypeConverter <?, ?>>> aSrcEntry : aCopy.entrySet ()) { final Class <?> aSrcClass = aSrcEntry.getKey (); for (final Map.Entry <Class <?>, ITypeConverter <?, ?>> aDstEntry : aSrcEntry.getValue ().entrySet ()) if (aCallback.call (aSrcClass, aDstEntry.getKey (), aDstEntry.getValue ()).isBreak ()) break outer; } }
[ "public", "void", "iterateAllRegisteredTypeConverters", "(", "@", "Nonnull", "final", "ITypeConverterCallback", "aCallback", ")", "{", "// Create a copy of the map", "final", "Map", "<", "Class", "<", "?", ">", ",", "Map", "<", "Class", "<", "?", ">", ",", "ITyp...
Iterate all registered type converters. For informational purposes only. @param aCallback The callback invoked for all iterations.
[ "Iterate", "all", "registered", "type", "converters", ".", "For", "informational", "purposes", "only", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverterRegistry.java#L334-L347
136,683
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/lang/GenericReflection.java
GenericReflection.getClassArray
@Nonnull public static Class <?> [] getClassArray (@Nullable 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; }
java
@Nonnull public static Class <?> [] getClassArray (@Nullable 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; }
[ "@", "Nonnull", "public", "static", "Class", "<", "?", ">", "[", "]", "getClassArray", "(", "@", "Nullable", "final", "Object", "...", "aObjs", ")", "{", "if", "(", "ArrayHelper", ".", "isEmpty", "(", "aObjs", ")", ")", "return", "EMPTY_CLASS_ARRAY", ";"...
Get an array with all the classes of the passed object array. @param aObjs The object array. May be <code>null</code>. No contained element may be <code>null</code>. @return A non-<code>null</code> array of classes.
[ "Get", "an", "array", "with", "all", "the", "classes", "of", "the", "passed", "object", "array", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/GenericReflection.java#L129-L139
136,684
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/lang/GenericReflection.java
GenericReflection.invokeMethod
@Nullable public static <RETURNTYPE> RETURNTYPE invokeMethod (@Nonnull final Object aSrcObj, @Nonnull final String sMethodName, @Nullable final Object... aArgs) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { return GenericReflection.<RETURNTYPE> invokeMethod (aSrcObj, sMethodName, getClassArray (aArgs), aArgs); }
java
@Nullable public static <RETURNTYPE> RETURNTYPE invokeMethod (@Nonnull final Object aSrcObj, @Nonnull final String sMethodName, @Nullable final Object... aArgs) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { return GenericReflection.<RETURNTYPE> invokeMethod (aSrcObj, sMethodName, getClassArray (aArgs), aArgs); }
[ "@", "Nullable", "public", "static", "<", "RETURNTYPE", ">", "RETURNTYPE", "invokeMethod", "(", "@", "Nonnull", "final", "Object", "aSrcObj", ",", "@", "Nonnull", "final", "String", "sMethodName", ",", "@", "Nullable", "final", "Object", "...", "aArgs", ")", ...
This method dynamically invokes the method with the given name on the given object. @param <RETURNTYPE> The method return type @param aSrcObj The source object on which the method is to be invoked. May not be <code>null</code>. @param sMethodName The method to be invoked. @param aArgs The arguments to be passed into the method. May be <code>null</code> . If not <code>null</code>, the members of the array may not be <code>null</code> because otherwise the classes of the arguments cannot be determined and will throw an Exception! @return The return value of the invoked method or <code>null</code> for void methods. @throws NoSuchMethodException Thrown by reflection @throws IllegalAccessException Thrown by reflection @throws InvocationTargetException Thrown by reflection
[ "This", "method", "dynamically", "invokes", "the", "method", "with", "the", "given", "name", "on", "the", "given", "object", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/GenericReflection.java#L166-L174
136,685
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/lang/GenericReflection.java
GenericReflection.newInstance
@Nonnull public static <DATATYPE> DATATYPE newInstance (@Nonnull final DATATYPE aObj) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException, InstantiationException { return findConstructor (aObj).newInstance (); }
java
@Nonnull public static <DATATYPE> DATATYPE newInstance (@Nonnull final DATATYPE aObj) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException, InstantiationException { return findConstructor (aObj).newInstance (); }
[ "@", "Nonnull", "public", "static", "<", "DATATYPE", ">", "DATATYPE", "newInstance", "(", "@", "Nonnull", "final", "DATATYPE", "aObj", ")", "throws", "IllegalAccessException", ",", "NoSuchMethodException", ",", "InvocationTargetException", ",", "InstantiationException",...
Create a new instance of the class identified by the passed object. The default constructor will be invoked. @param <DATATYPE> The type of object to be created. @param aObj The object from which the class should be used. @return A new instance of the object or an exception is thrown. @throws IllegalAccessException Reflection exception @throws NoSuchMethodException Reflection exception @throws InvocationTargetException Reflection exception @throws InstantiationException Reflection exception
[ "Create", "a", "new", "instance", "of", "the", "class", "identified", "by", "the", "passed", "object", ".", "The", "default", "constructor", "will", "be", "invoked", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/GenericReflection.java#L263-L270
136,686
phax/ph-commons
ph-scopes/src/main/java/com/helger/scope/singleton/AbstractRequestSingleton.java
AbstractRequestSingleton.getRequestSingleton
@Nonnull public static final <T extends AbstractRequestSingleton> T getRequestSingleton (@Nonnull final Class <T> aClass) { return getSingleton (_getStaticScope (true), aClass); }
java
@Nonnull public static final <T extends AbstractRequestSingleton> T getRequestSingleton (@Nonnull final Class <T> aClass) { return getSingleton (_getStaticScope (true), aClass); }
[ "@", "Nonnull", "public", "static", "final", "<", "T", "extends", "AbstractRequestSingleton", ">", "T", "getRequestSingleton", "(", "@", "Nonnull", "final", "Class", "<", "T", ">", "aClass", ")", "{", "return", "getSingleton", "(", "_getStaticScope", "(", "tru...
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. @param <T> The type to be returned @param aClass The class to be used. May not be <code>null</code>. The class must be public as needs to have a public no-argument constructor. @return The singleton object and never <code>null</code>.
[ "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", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-scopes/src/main/java/com/helger/scope/singleton/AbstractRequestSingleton.java#L63-L67
136,687
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/lang/ClassPathHelper.java
ClassPathHelper.forAllClassPathEntries
public static void forAllClassPathEntries (@Nonnull final Consumer <? super String> aConsumer) { StringHelper.explode (SystemProperties.getPathSeparator (), SystemProperties.getJavaClassPath (), aConsumer); }
java
public static void forAllClassPathEntries (@Nonnull final Consumer <? super String> aConsumer) { StringHelper.explode (SystemProperties.getPathSeparator (), SystemProperties.getJavaClassPath (), aConsumer); }
[ "public", "static", "void", "forAllClassPathEntries", "(", "@", "Nonnull", "final", "Consumer", "<", "?", "super", "String", ">", "aConsumer", ")", "{", "StringHelper", ".", "explode", "(", "SystemProperties", ".", "getPathSeparator", "(", ")", ",", "SystemPrope...
Add all class path entries into the provided target list. @param aConsumer The target consumer invoked for all entries. May not be <code>null</code>.
[ "Add", "all", "class", "path", "entries", "into", "the", "provided", "target", "list", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/ClassPathHelper.java#L67-L70
136,688
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/lang/ClassPathHelper.java
ClassPathHelper.printClassPathEntries
public static void printClassPathEntries (@Nonnull final PrintStream aPS, @Nonnull final String sItemSeparator) { forAllClassPathEntries (x -> { aPS.print (x); aPS.print (sItemSeparator); }); }
java
public static void printClassPathEntries (@Nonnull final PrintStream aPS, @Nonnull final String sItemSeparator) { forAllClassPathEntries (x -> { aPS.print (x); aPS.print (sItemSeparator); }); }
[ "public", "static", "void", "printClassPathEntries", "(", "@", "Nonnull", "final", "PrintStream", "aPS", ",", "@", "Nonnull", "final", "String", "sItemSeparator", ")", "{", "forAllClassPathEntries", "(", "x", "->", "{", "aPS", ".", "print", "(", "x", ")", ";...
Print all class path entries on the passed print stream, using the passed separator @param aPS The print stream to print to. May not be <code>null</code>. @param sItemSeparator The separator to be printed between each item.
[ "Print", "all", "class", "path", "entries", "on", "the", "passed", "print", "stream", "using", "the", "passed", "separator" ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/ClassPathHelper.java#L93-L99
136,689
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/microdom/serialize/MicroWriter.java
MicroWriter.writeToStream
@Nonnull public static ESuccess writeToStream (@Nonnull final IMicroNode aNode, @Nonnull @WillClose final OutputStream aOS) { return writeToStream (aNode, aOS, XMLWriterSettings.DEFAULT_XML_SETTINGS); }
java
@Nonnull public static ESuccess writeToStream (@Nonnull final IMicroNode aNode, @Nonnull @WillClose final OutputStream aOS) { return writeToStream (aNode, aOS, XMLWriterSettings.DEFAULT_XML_SETTINGS); }
[ "@", "Nonnull", "public", "static", "ESuccess", "writeToStream", "(", "@", "Nonnull", "final", "IMicroNode", "aNode", ",", "@", "Nonnull", "@", "WillClose", "final", "OutputStream", "aOS", ")", "{", "return", "writeToStream", "(", "aNode", ",", "aOS", ",", "...
Write a Micro Node to an output stream using the default settings. @param aNode The node to be serialized. May be any kind of node (incl. documents). May not be <code>null</code>. @param aOS The output stream to write to. May not be <code>null</code>. The output stream is closed anyway directly after the operation finishes (on success and on error). @return {@link ESuccess}
[ "Write", "a", "Micro", "Node", "to", "an", "output", "stream", "using", "the", "default", "settings", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/microdom/serialize/MicroWriter.java#L155-L159
136,690
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/microdom/serialize/MicroWriter.java
MicroWriter.getNodeAsString
@Nullable public static String getNodeAsString (@Nonnull final IMicroNode aNode, @Nonnull final IXMLWriterSettings aSettings) { ValueEnforcer.notNull (aNode, "Node"); ValueEnforcer.notNull (aSettings, "Settings"); try (final NonBlockingStringWriter aWriter = new NonBlockingStringWriter (50 * CGlobal.BYTES_PER_KILOBYTE)) { // start serializing if (writeToWriter (aNode, aWriter, aSettings).isSuccess ()) return aWriter.getAsString (); } catch (final Exception ex) { if (LOGGER.isErrorEnabled ()) LOGGER.error ("Error serializing MicroDOM with settings " + aSettings.toString (), ex); } return null; }
java
@Nullable public static String getNodeAsString (@Nonnull final IMicroNode aNode, @Nonnull final IXMLWriterSettings aSettings) { ValueEnforcer.notNull (aNode, "Node"); ValueEnforcer.notNull (aSettings, "Settings"); try (final NonBlockingStringWriter aWriter = new NonBlockingStringWriter (50 * CGlobal.BYTES_PER_KILOBYTE)) { // start serializing if (writeToWriter (aNode, aWriter, aSettings).isSuccess ()) return aWriter.getAsString (); } catch (final Exception ex) { if (LOGGER.isErrorEnabled ()) LOGGER.error ("Error serializing MicroDOM with settings " + aSettings.toString (), ex); } return null; }
[ "@", "Nullable", "public", "static", "String", "getNodeAsString", "(", "@", "Nonnull", "final", "IMicroNode", "aNode", ",", "@", "Nonnull", "final", "IXMLWriterSettings", "aSettings", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aNode", ",", "\"Node\"", ")",...
Convert the passed micro node to an XML string using the provided settings. @param aNode The node to be converted to a string. May not be <code>null</code> . @param aSettings The XML writer settings to use. May not be <code>null</code>. @return The string representation of the passed node.
[ "Convert", "the", "passed", "micro", "node", "to", "an", "XML", "string", "using", "the", "provided", "settings", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/microdom/serialize/MicroWriter.java#L262-L280
136,691
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/microdom/serialize/MicroWriter.java
MicroWriter.getNodeAsBytes
@Nullable public static byte [] getNodeAsBytes (@Nonnull final IMicroNode aNode, @Nonnull final IXMLWriterSettings aSettings) { ValueEnforcer.notNull (aNode, "Node"); ValueEnforcer.notNull (aSettings, "Settings"); try ( final NonBlockingByteArrayOutputStream aBAOS = new NonBlockingByteArrayOutputStream (50 * CGlobal.BYTES_PER_KILOBYTE)) { // start serializing if (writeToStream (aNode, aBAOS, aSettings).isSuccess ()) return aBAOS.toByteArray (); } catch (final Exception ex) { if (LOGGER.isErrorEnabled ()) LOGGER.error ("Error serializing MicroDOM with settings " + aSettings.toString (), ex); } return null; }
java
@Nullable public static byte [] getNodeAsBytes (@Nonnull final IMicroNode aNode, @Nonnull final IXMLWriterSettings aSettings) { ValueEnforcer.notNull (aNode, "Node"); ValueEnforcer.notNull (aSettings, "Settings"); try ( final NonBlockingByteArrayOutputStream aBAOS = new NonBlockingByteArrayOutputStream (50 * CGlobal.BYTES_PER_KILOBYTE)) { // start serializing if (writeToStream (aNode, aBAOS, aSettings).isSuccess ()) return aBAOS.toByteArray (); } catch (final Exception ex) { if (LOGGER.isErrorEnabled ()) LOGGER.error ("Error serializing MicroDOM with settings " + aSettings.toString (), ex); } return null; }
[ "@", "Nullable", "public", "static", "byte", "[", "]", "getNodeAsBytes", "(", "@", "Nonnull", "final", "IMicroNode", "aNode", ",", "@", "Nonnull", "final", "IXMLWriterSettings", "aSettings", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aNode", ",", "\"Node...
Convert the passed micro node to an XML byte array using the provided settings. @param aNode The node to be converted to a byte array. May not be <code>null</code> . @param aSettings The XML writer settings to use. May not be <code>null</code>. @return The byte array representation of the passed node. @since 8.6.3
[ "Convert", "the", "passed", "micro", "node", "to", "an", "XML", "byte", "array", "using", "the", "provided", "settings", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/microdom/serialize/MicroWriter.java#L310-L330
136,692
phax/ph-commons
ph-tree/src/main/java/com/helger/tree/sort/TreeWithIDSorter.java
TreeWithIDSorter.sortByID
public static <KEYTYPE, DATATYPE, ITEMTYPE extends ITreeItemWithID <KEYTYPE, DATATYPE, ITEMTYPE>> void sortByID (@Nonnull final IBasicTree <DATATYPE, ITEMTYPE> aTree, @Nonnull final Comparator <? super KEYTYPE> aKeyComparator) { _sort (aTree, Comparator.comparing (IHasID::getID, aKeyComparator)); }
java
public static <KEYTYPE, DATATYPE, ITEMTYPE extends ITreeItemWithID <KEYTYPE, DATATYPE, ITEMTYPE>> void sortByID (@Nonnull final IBasicTree <DATATYPE, ITEMTYPE> aTree, @Nonnull final Comparator <? super KEYTYPE> aKeyComparator) { _sort (aTree, Comparator.comparing (IHasID::getID, aKeyComparator)); }
[ "public", "static", "<", "KEYTYPE", ",", "DATATYPE", ",", "ITEMTYPE", "extends", "ITreeItemWithID", "<", "KEYTYPE", ",", "DATATYPE", ",", "ITEMTYPE", ">", ">", "void", "sortByID", "(", "@", "Nonnull", "final", "IBasicTree", "<", "DATATYPE", ",", "ITEMTYPE", ...
Sort each level of the passed tree on the ID with the specified comparator. @param <KEYTYPE> Tree item key type @param <DATATYPE> Tree item data type @param <ITEMTYPE> Tree item type @param aTree The tree to be sorted. @param aKeyComparator The comparator to be used for sorting the tree item keys on each level.
[ "Sort", "each", "level", "of", "the", "passed", "tree", "on", "the", "ID", "with", "the", "specified", "comparator", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-tree/src/main/java/com/helger/tree/sort/TreeWithIDSorter.java#L87-L91
136,693
phax/ph-commons
ph-tree/src/main/java/com/helger/tree/sort/TreeWithIDSorter.java
TreeWithIDSorter.sortByValue
public static <KEYTYPE, DATATYPE, ITEMTYPE extends ITreeItemWithID <KEYTYPE, DATATYPE, ITEMTYPE>> void sortByValue (@Nonnull final IBasicTree <DATATYPE, ITEMTYPE> aTree, @Nonnull final Comparator <? super DATATYPE> aValueComparator) { _sort (aTree, Comparator.comparing (IBasicTreeItem::getData, aValueComparator)); }
java
public static <KEYTYPE, DATATYPE, ITEMTYPE extends ITreeItemWithID <KEYTYPE, DATATYPE, ITEMTYPE>> void sortByValue (@Nonnull final IBasicTree <DATATYPE, ITEMTYPE> aTree, @Nonnull final Comparator <? super DATATYPE> aValueComparator) { _sort (aTree, Comparator.comparing (IBasicTreeItem::getData, aValueComparator)); }
[ "public", "static", "<", "KEYTYPE", ",", "DATATYPE", ",", "ITEMTYPE", "extends", "ITreeItemWithID", "<", "KEYTYPE", ",", "DATATYPE", ",", "ITEMTYPE", ">", ">", "void", "sortByValue", "(", "@", "Nonnull", "final", "IBasicTree", "<", "DATATYPE", ",", "ITEMTYPE",...
Sort each level of the passed tree on the value with the specified comparator. @param <KEYTYPE> Tree item key type @param <DATATYPE> Tree item data type @param <ITEMTYPE> Tree item type @param aTree The tree to be sorted. @param aValueComparator The comparator to be used for sorting the tree item keys on each level.
[ "Sort", "each", "level", "of", "the", "passed", "tree", "on", "the", "value", "with", "the", "specified", "comparator", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-tree/src/main/java/com/helger/tree/sort/TreeWithIDSorter.java#L128-L132
136,694
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/timing/StopWatch.java
StopWatch.start
@Nonnull public final EChange start () { // Already started? if (m_nStartDT > 0) return EChange.UNCHANGED; m_nStartDT = getCurrentNanoTime (); return EChange.CHANGED; }
java
@Nonnull public final EChange start () { // Already started? if (m_nStartDT > 0) return EChange.UNCHANGED; m_nStartDT = getCurrentNanoTime (); return EChange.CHANGED; }
[ "@", "Nonnull", "public", "final", "EChange", "start", "(", ")", "{", "// Already started?", "if", "(", "m_nStartDT", ">", "0", ")", "return", "EChange", ".", "UNCHANGED", ";", "m_nStartDT", "=", "getCurrentNanoTime", "(", ")", ";", "return", "EChange", ".",...
Start the stop watch. @return {@link EChange}.
[ "Start", "the", "stop", "watch", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/timing/StopWatch.java#L86-L94
136,695
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/timing/StopWatch.java
StopWatch.stop
@Nonnull public EChange stop () { // Already stopped? if (m_nStartDT == 0) return EChange.UNCHANGED; final long nCurrentNanoTime = getCurrentNanoTime (); m_nDurationNanos += (nCurrentNanoTime - m_nStartDT); m_nStartDT = 0; return EChange.CHANGED; }
java
@Nonnull public EChange stop () { // Already stopped? if (m_nStartDT == 0) return EChange.UNCHANGED; final long nCurrentNanoTime = getCurrentNanoTime (); m_nDurationNanos += (nCurrentNanoTime - m_nStartDT); m_nStartDT = 0; return EChange.CHANGED; }
[ "@", "Nonnull", "public", "EChange", "stop", "(", ")", "{", "// Already stopped?", "if", "(", "m_nStartDT", "==", "0", ")", "return", "EChange", ".", "UNCHANGED", ";", "final", "long", "nCurrentNanoTime", "=", "getCurrentNanoTime", "(", ")", ";", "m_nDurationN...
Stop the stop watch. @return {@link EChange#CHANGED} if the stop watch was previously running and is now stopped, and {@link EChange#UNCHANGED} if the stop watch was already stopped.
[ "Stop", "the", "stop", "watch", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/timing/StopWatch.java#L103-L114
136,696
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/timing/StopWatch.java
StopWatch.runMeasured
@Nonnull public static TimeValue runMeasured (@Nonnull final Runnable aRunnable) { final StopWatch aSW = createdStarted (); aRunnable.run (); final long nNanos = aSW.stopAndGetNanos (); return new TimeValue (TimeUnit.NANOSECONDS, nNanos); }
java
@Nonnull public static TimeValue runMeasured (@Nonnull final Runnable aRunnable) { final StopWatch aSW = createdStarted (); aRunnable.run (); final long nNanos = aSW.stopAndGetNanos (); return new TimeValue (TimeUnit.NANOSECONDS, nNanos); }
[ "@", "Nonnull", "public", "static", "TimeValue", "runMeasured", "(", "@", "Nonnull", "final", "Runnable", "aRunnable", ")", "{", "final", "StopWatch", "aSW", "=", "createdStarted", "(", ")", ";", "aRunnable", ".", "run", "(", ")", ";", "final", "long", "nN...
Run the passed runnable and measure the time. @param aRunnable The runnable to be executed. May not be <code>null</code>. @return The elapsed time. Never <code>null</code>.
[ "Run", "the", "passed", "runnable", "and", "measure", "the", "time", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/timing/StopWatch.java#L274-L281
136,697
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/error/ErrorTextProvider.java
ErrorTextProvider.addItem
@Nonnull public ErrorTextProvider addItem (@Nonnull final EField eField, @Nonnull @Nonempty final String sText) { return addItem (new FormattableItem (eField, sText)); }
java
@Nonnull public ErrorTextProvider addItem (@Nonnull final EField eField, @Nonnull @Nonempty final String sText) { return addItem (new FormattableItem (eField, sText)); }
[ "@", "Nonnull", "public", "ErrorTextProvider", "addItem", "(", "@", "Nonnull", "final", "EField", "eField", ",", "@", "Nonnull", "@", "Nonempty", "final", "String", "sText", ")", "{", "return", "addItem", "(", "new", "FormattableItem", "(", "eField", ",", "s...
Add an error item to be disabled. @param eField The field to be used. May not be <code>null</code>. @param sText The text that should contain the placeholder ({@value #PLACEHOLDER}) that will be replaced @return this for chaining
[ "Add", "an", "error", "item", "to", "be", "disabled", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/error/ErrorTextProvider.java#L205-L209
136,698
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/version/Version.java
Version.compareTo
public int compareTo (@Nonnull final Version rhs) { ValueEnforcer.notNull (rhs, "Rhs"); // compare major version int ret = m_nMajor - rhs.m_nMajor; if (ret == 0) { // compare minor version ret = m_nMinor - rhs.m_nMinor; if (ret == 0) { // compare micro version ret = m_nMicro - rhs.m_nMicro; if (ret == 0) { // check qualifier if (m_sQualifier != null) { if (rhs.m_sQualifier != null) { ret = m_sQualifier.compareTo (rhs.m_sQualifier); // convert to -1/0/+1 if (ret < 0) ret = -1; else if (ret > 0) ret = +1; } else ret = 1; } else if (rhs.m_sQualifier != null) { // only this qualifier == null ret = -1; } else { // both qualifier are null ret = 0; } } } } return ret; }
java
public int compareTo (@Nonnull final Version rhs) { ValueEnforcer.notNull (rhs, "Rhs"); // compare major version int ret = m_nMajor - rhs.m_nMajor; if (ret == 0) { // compare minor version ret = m_nMinor - rhs.m_nMinor; if (ret == 0) { // compare micro version ret = m_nMicro - rhs.m_nMicro; if (ret == 0) { // check qualifier if (m_sQualifier != null) { if (rhs.m_sQualifier != null) { ret = m_sQualifier.compareTo (rhs.m_sQualifier); // convert to -1/0/+1 if (ret < 0) ret = -1; else if (ret > 0) ret = +1; } else ret = 1; } else if (rhs.m_sQualifier != null) { // only this qualifier == null ret = -1; } else { // both qualifier are null ret = 0; } } } } return ret; }
[ "public", "int", "compareTo", "(", "@", "Nonnull", "final", "Version", "rhs", ")", "{", "ValueEnforcer", ".", "notNull", "(", "rhs", ",", "\"Rhs\"", ")", ";", "// compare major version", "int", "ret", "=", "m_nMajor", "-", "rhs", ".", "m_nMajor", ";", "if"...
Compares two Version objects. @param rhs the version to compare to @return &lt; 0 if this is less than rhs; &gt; 0 if this is greater than rhs, and 0 if they are equal. @throws IllegalArgumentException if the parameter is null
[ "Compares", "two", "Version", "objects", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/version/Version.java#L176-L224
136,699
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/version/Version.java
Version.getAsString
@Nonnull public String getAsString (final boolean bPrintZeroElements, final boolean bPrintAtLeastMajorAndMinor) { // Build from back to front final StringBuilder aSB = new StringBuilder (m_sQualifier != null ? m_sQualifier : ""); if (m_nMicro > 0 || aSB.length () > 0 || bPrintZeroElements) { // Micro version if (aSB.length () > 0) aSB.insert (0, '.'); aSB.insert (0, m_nMicro); } if (bPrintAtLeastMajorAndMinor || m_nMinor > 0 || aSB.length () > 0 || bPrintZeroElements) { // Minor version if (aSB.length () > 0) aSB.insert (0, '.'); aSB.insert (0, m_nMinor); } if (bPrintAtLeastMajorAndMinor || m_nMajor > 0 || aSB.length () > 0 || bPrintZeroElements) { // Major version if (aSB.length () > 0) aSB.insert (0, '.'); aSB.insert (0, m_nMajor); } return aSB.length () > 0 ? aSB.toString () : DEFAULT_VERSION_STRING; }
java
@Nonnull public String getAsString (final boolean bPrintZeroElements, final boolean bPrintAtLeastMajorAndMinor) { // Build from back to front final StringBuilder aSB = new StringBuilder (m_sQualifier != null ? m_sQualifier : ""); if (m_nMicro > 0 || aSB.length () > 0 || bPrintZeroElements) { // Micro version if (aSB.length () > 0) aSB.insert (0, '.'); aSB.insert (0, m_nMicro); } if (bPrintAtLeastMajorAndMinor || m_nMinor > 0 || aSB.length () > 0 || bPrintZeroElements) { // Minor version if (aSB.length () > 0) aSB.insert (0, '.'); aSB.insert (0, m_nMinor); } if (bPrintAtLeastMajorAndMinor || m_nMajor > 0 || aSB.length () > 0 || bPrintZeroElements) { // Major version if (aSB.length () > 0) aSB.insert (0, '.'); aSB.insert (0, m_nMajor); } return aSB.length () > 0 ? aSB.toString () : DEFAULT_VERSION_STRING; }
[ "@", "Nonnull", "public", "String", "getAsString", "(", "final", "boolean", "bPrintZeroElements", ",", "final", "boolean", "bPrintAtLeastMajorAndMinor", ")", "{", "// Build from back to front", "final", "StringBuilder", "aSB", "=", "new", "StringBuilder", "(", "m_sQuali...
Get the string representation of the version number. @param bPrintZeroElements If <code>true</code> than trailing zeroes are printed, otherwise printed zeroes are not printed. @param bPrintAtLeastMajorAndMinor <code>true</code> if major and minor part should always be printed, independent of their value @return Never <code>null</code>.
[ "Get", "the", "string", "representation", "of", "the", "version", "number", "." ]
d28c03565f44a0b804d96028d0969f9bb38c4313
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/version/Version.java#L257-L284