Java Code Examples for org.apache.brooklyn.util.collections.MutableList#asUnmodifiable()

The following examples show how to use org.apache.brooklyn.util.collections.MutableList#asUnmodifiable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KnifeTaskFactory.java    From brooklyn-library with Apache License 2.0 6 votes vote down vote up
@Override
public List<String> getCommands() {
    MutableList<String> result = new MutableList<String>();
    String setupCommands = knifeSetupCommands();
    if (setupCommands != null && Strings.isNonBlank(setupCommands))
        result.add(setupCommands);
    int numKnifes = 0;
    for (String c: super.getCommands()) {
        if (c==KNIFE_PLACEHOLDER)
            result.add(buildKnifeCommand(numKnifes++));
        else
            result.add(c);
    }
    if (numKnifes==0)
        result.add(buildKnifeCommand(numKnifes++));
    return result.asUnmodifiable();
}
 
Example 2
Source File: KnifeTaskFactory.java    From brooklyn-library with Apache License 2.0 5 votes vote down vote up
@Override
public List<Function<ProcessTaskWrapper<?>, Void>> getCompletionListeners() {
    MutableList<Function<ProcessTaskWrapper<?>, Void>> result = MutableList.copyOf(super.getCompletionListeners());
    if (throwOnCommonKnifeErrors != Boolean.FALSE)
        insertKnifeCompletionListenerIntoCompletionListenersList(result);
    return result.asUnmodifiable();
}
 
Example 3
Source File: ListConfigKey.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
@Override
protected List<Object> merge(boolean unmodifiable, Iterable<?>... sets) {
    MutableList<Object> result = MutableList.of();
    for (Iterable<?> set: sets) result.addAll(set);
    if (unmodifiable) return result.asUnmodifiable();
    return result;
}