Package com.helger.html.js
Class CollectingJSCodeProvider
- java.lang.Object
-
- com.helger.html.js.CollectingJSCodeProvider
-
- All Implemented Interfaces:
com.helger.commons.lang.ICloneable<CollectingJSCodeProvider>,com.helger.commons.lang.IHasSize,IHasJSCode,IHasJSCodeWithSettings,Serializable
@NotThreadSafe public class CollectingJSCodeProvider extends Object implements IHasJSCodeWithSettings, com.helger.commons.lang.IHasSize, com.helger.commons.lang.ICloneable<CollectingJSCodeProvider>
A JSCode provider that encapsulates a list ofIHasJSCodeelements and itself implementsIHasJSCode.- Author:
- Philip Helger
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CollectingJSCodeProvider()CollectingJSCodeProvider(IHasJSCode... aProviders)CollectingJSCodeProvider(Iterable<? extends IHasJSCode> aProviders)
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.helger.html.js.IHasJSCodeWithSettings
getJSCode
-
-
-
-
Constructor Detail
-
CollectingJSCodeProvider
public CollectingJSCodeProvider()
-
CollectingJSCodeProvider
public CollectingJSCodeProvider(@Nullable IHasJSCode... aProviders)
-
CollectingJSCodeProvider
public CollectingJSCodeProvider(@Nullable Iterable<? extends IHasJSCode> aProviders)
-
-
Method Detail
-
directAll
@Nonnull @ReturnsMutableObject public com.helger.commons.collection.impl.ICommonsList<IHasJSCode> directAll()
- Returns:
- The underlying modifiable list. Never
nullbut maybe empty.
-
getAll
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<IHasJSCode> getAll()
- Returns:
- A copy of the list with all members. Never
nullbut maybe empty.
-
addAt
@Nonnull public CollectingJSCodeProvider addAt(@Nonnegative int nIndex, @Nullable IHasJSCode aProvider)
Add JS code at the specified index.- Parameters:
nIndex- The index where the element should be added. Should be ≥ 0.aProvider- The JS code provider to be added. May benull.- Returns:
- this for chaining
-
addFlattenedAt
@Nonnull public CollectingJSCodeProvider addFlattenedAt(@Nonnegative int nIndex, @Nullable IHasJSCode aProvider)
Add JS code at the specified index but unwrapping anyCollectingJSCodeProviderinstances.- Parameters:
nIndex- The index where the element should be added. Should be ≥ 0.aProvider- The JS code provider to be added. May benull.- Returns:
- this for chaining
-
append
@Nonnull public CollectingJSCodeProvider append(@Nullable IHasJSCode aProvider)
-
appendFlattened
@Nonnull public CollectingJSCodeProvider appendFlattened(@Nullable IHasJSCode aProvider)
-
prepend
@Nonnull public CollectingJSCodeProvider prepend(@Nullable IHasJSCode aProvider)
-
prependFlattened
@Nonnull public CollectingJSCodeProvider prependFlattened(@Nullable IHasJSCode aProvider)
-
removeAt
@Nonnull public CollectingJSCodeProvider removeAt(@Nonnegative int nIndex)
Remove the entry at the specified index.- Parameters:
nIndex- the index to be removed. Should be ≥ 0.- Returns:
- this for chaining
-
reset
public void reset()
-
size
@Nonnegative public int size()
- Specified by:
sizein interfacecom.helger.commons.lang.IHasSize
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfacecom.helger.commons.lang.IHasSize
-
getJSCode
@Nonnull public String getJSCode(@Nullable IJSWriterSettings aSettings)
- Specified by:
getJSCodein interfaceIHasJSCodeWithSettings- Parameters:
aSettings- The formatter settings to be used. May benullfor the default settings.- Returns:
- The JavaScript code representation. May be
nullto indicate no JS code.
-
getClone
@Nonnull public CollectingJSCodeProvider getClone()
- Specified by:
getClonein interfacecom.helger.commons.lang.ICloneable<CollectingJSCodeProvider>
-
-