Example usage for java.util Collections unmodifiableList

List of usage examples for java.util Collections unmodifiableList

Introduction

In this page you can find the example usage for java.util Collections unmodifiableList.

Prototype

public static <T> List<T> unmodifiableList(List<? extends T> list) 

Source Link

Document

Returns an unmodifiable view of the specified list.

Usage

From source file:com.haulmont.cuba.core.sys.AppComponents.java

/**
 * @return the list of app components
 */
public List<AppComponent> getComponents() {
    return Collections.unmodifiableList(components);
}

From source file:net.sf.jabref.model.entry.CustomEntryType.java

@Override
public List<String> getPrimaryOptionalFields() {
    return Collections.unmodifiableList(primaryOptional);
}

From source file:org.openinfinity.core.security.principal.Identity.java

/**
 * Returns all roles associated with the user.
 * //from   w  ww . jav a2  s. c  om
 * @return
 */
public List<String> getRoles() {
    List<String> roles = new ArrayList<String>();
    for (RolePrincipal rolePrincipal : rolePrincipals) {
        roles.add(rolePrincipal.getName());
    }
    return Collections.unmodifiableList(roles);
}

From source file:com.silverwrist.dynamo.security.AuditReadOps_mysql.java

private final List runListStatement(PreparedStatement stmt) throws SQLException {
    ResultSet rs = null;//from w  w  w. j  a  v a2s.  com
    try { // get the list of record IDs (long integers)
        rs = stmt.executeQuery();
        if (!(rs.next()))
            return Collections.EMPTY_LIST; // no results
        ArrayList rc = new ArrayList();
        do { // add each entry to the list
            rc.add(new Long(rs.getLong(1)));

        } while (rs.next()); // end do

        rc.trimToSize();
        return Collections.unmodifiableList(rc);

    } // end try
    finally { // shut down the result set before we go
        SQLUtils.shutdown(rs);

    } // end finally

}

From source file:epgtools.dumpepgfromts.subtool.filelistmaker.FileSeeker.java

/**
 * ???????// w ww . j  av a  2s.co m
 *
 * @return ??????
 */
public synchronized List<File> seek() {

    List<File> list = Collections.synchronizedList(new ArrayList<File>());
    Collection<File> files = FileUtils.listFiles(this.SourceDir, this.fileType, this.dirf);
    list.addAll(files);
    return Collections.unmodifiableList(list);

}

From source file:jcoderwall.Badges.java

/**
 * Returns a read-only {@link List} with the badges of this {@link List}.
 * //from ww w .  j a  v  a2 s .  c  o m
 * @return a read-only {@link List} with the badges of this {@link List}.
 */
public List<Badge> badges() {
    return Collections.unmodifiableList(this.badges);
}

From source file:libepg.epg.section.descriptor.DescriptorsLoop.java

/**
 * ????// ww w  .j  a v  a2 s.co  m
 * ???????????????????????
 *
 * @return ?
 */
public synchronized List<Descriptor> getDescriptors_loopList() {
    List<byte[]> t = ByteArraySplitter.splitByLengthField(this.getData(), 2, 1);
    List<Descriptor> dest = new ArrayList<>();
    for (byte[] temp : t) {
        Descriptor desc = new Descriptor(temp);

        Descriptor target = null;
        try {
            Object[] args = { desc };
            Class<?>[] params = { Descriptor.class };
            Constructor<? extends Descriptor> constructor = desc.getDescriptor_tag_const().getDataType()
                    .getDeclaredConstructor(params);
            target = constructor.newInstance(args);
        } catch (InstantiationException | IllegalAccessException | IllegalArgumentException
                | NoSuchMethodException | SecurityException | InvocationTargetException ex) {
            LOG.fatal("???????????? = "
                    + desc.toString(), ex);
            target = desc;
        } finally {
            dest.add(target);
        }

    }
    return Collections.unmodifiableList(dest);
}

From source file:org.jboss.fuse.wsdl2rest.util.SpringCamelContextFactory.java

private static List<SpringCamelContext> createCamelContextList(Resource resource, ClassLoader classLoader)
        throws Exception {

    if (classLoader == null)
        classLoader = SpringCamelContextFactory.class.getClassLoader();

    GenericApplicationContext appContext = new GenericApplicationContext();
    appContext.setClassLoader(classLoader);

    XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(appContext) {
        @Override//w w w .ja va  2  s . c om
        protected NamespaceHandlerResolver createDefaultNamespaceHandlerResolver() {
            NamespaceHandlerResolver defaultResolver = super.createDefaultNamespaceHandlerResolver();
            return new CamelNamespaceHandlerResolver(defaultResolver);
        }
    };
    xmlReader.loadBeanDefinitions(resource);

    SpringCamelContext.setNoStart(true);
    appContext.refresh();

    List<SpringCamelContext> result = new ArrayList<>();
    for (String name : appContext.getBeanNamesForType(SpringCamelContext.class)) {
        result.add(appContext.getBean(name, SpringCamelContext.class));
    }

    return Collections.unmodifiableList(result);
}

From source file:ch.admin.suis.msghandler.common.ReceiptsFolder.java

/**
 * Returns the configured message type or <code>null</code> if none.
 *
 * @return List of MessageTypes/*from  ww  w .  j a  va  2 s.  c  o m*/
 */
public List<MessageType> getMessageTypes() {
    return Collections.unmodifiableList(messageTypes);
}

From source file:com.threewks.thundr.http.service.gae.HttpResponseImpl.java

@Override
public List<String> getHeaders(String name) {
    response();//from w w  w  .j  ava  2 s  .co  m
    List<String> headers = headersLower.get(StringUtils.lowerCase(name));
    return headers == null ? null : Collections.unmodifiableList(headers);
}