| career | drupal | java | mac | mysql | perl | scala | uml | unix  

Commons Attributes example source code file (

This example Commons Attributes source code file ( is included in the "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Commons Attributes tags/keywords

circulardependencyerror, circulardependencyerror, class, class, iterator, list, object, repositoryerror, string, string, stringbuffer, stringbuffer, util

The Commons Attributes source code

 * Copyright 2003-2004 The Apache Software Foundation
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.
package org.apache.commons.attributes;

import java.util.Iterator;
import java.util.List;

 * Thrown when an attribute repository class can't be
 * loaded because it resulted in a circular dependency.
 * @since 2.1
public class CircularDependencyError extends RepositoryError {
     * Create a new CircularDependencyError.
     * @param className the name of the class that started it all.
     * @param dependencyList a list of the classes ({@link java.lang.Class}) 
     *                       that the original
     *                       class depended on, the classes they
     *                       depended on, and so on. The list should
     *                       show the chain of dependencies that resulted
     *                       in the exception being thrown. <b>Note:
     *                       Versions prior to 2.2 accepted a list of Objects
     *                       of any type. This is still supported, but the
     *                       formatting may suffer. Please only use lists of
     *                       {@link java.lang.Class}.
     * @since 2.1
    public CircularDependencyError (String className, List dependencyList) {
        super (className + ":" + listDeps (dependencyList), null);
     * Joins together the elements of a list with <code>->
     * delimiters. Used to show the sequence that resulted in the circular
     * dependency.
     * @since 2.1
    private static String listDeps (List dependencyList) {
        StringBuffer sb = new StringBuffer ();
        Iterator iter = dependencyList.iterator ();
        while (iter.hasNext ()) {
            Object o = ();
            // Test that the user really passed in a Class. Versions
            // prior to 2.2 received Strings instead, and any user that
            // used the code would find it broken.
            if (o != null && o instanceof Class) {
                sb.append (((Class) o).getName ());
            } else {
                sb.append (o);
            if (iter.hasNext ()) {
                sb.append (" -> ");
        return sb.toString ();

Other Commons Attributes examples (source code examples)

Here is a short list of links related to this Commons Attributes source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller


new blog posts


Copyright 1998-2021 Alvin Alexander,
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.