// Path: src/main/java/de/fesere/hypermedia/cj/exceptions/CollectionHasErrorsException.java
// public class CollectionHasErrorsException extends RuntimeException {
// 
//     public CollectionHasErrorsException(Error error) {
//         super(error.getTitle() + " (Code " + error.getCode() + ") : " + error.getMessage() + ".");
//     }
// 
// 
// }
// 
// Path: src/main/java/de/fesere/hypermedia/cj/exceptions/ElementNotFoundException.java
// public class ElementNotFoundException extends RuntimeException {
//     public ElementNotFoundException(String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/de/fesere/hypermedia/cj/serialization/Wrapped.java
// public interface Wrapped {
// }
// 
// Path: src/main/java/de/fesere/hypermedia/cj/transformer/ReadTransformation.java
// public interface ReadTransformation<T> {
// 
//     T transform(Item item);
// }


import com.fasterxml.jackson.annotation.*;
import de.fesere.hypermedia.cj.exceptions.CollectionHasErrorsException;
import de.fesere.hypermedia.cj.exceptions.ElementNotFoundException;
import de.fesere.hypermedia.cj.serialization.Wrapped;
import de.fesere.hypermedia.cj.transformer.ReadTransformation;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
                result.add(convertedItem);
            }
        }

        return result;
    }

    public boolean hasError() {
        return error != null;
    }

    public Error getError() {
        return error;
    }

    public Link getLink(String rel) {
        throwExceptionOnError();

        return findByRel(links,rel);


    }

    private <T extends Link> T findByRel(List<T> elements, String rel) {
        for(T linkable : elements ) {
            if(linkable.getRel().equalsIgnoreCase(rel)) {
                return linkable;
            }
        }

// Path: src/main/java/de/fesere/hypermedia/cj/exceptions/CollectionHasErrorsException.java
// public class CollectionHasErrorsException extends RuntimeException {
// 
//     public CollectionHasErrorsException(Error error) {
//         super(error.getTitle() + " (Code " + error.getCode() + ") : " + error.getMessage() + ".");
//     }
// 
// 
// }
// 
// Path: src/main/java/de/fesere/hypermedia/cj/exceptions/ElementNotFoundException.java
// public class ElementNotFoundException extends RuntimeException {
//     public ElementNotFoundException(String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/de/fesere/hypermedia/cj/serialization/Wrapped.java
// public interface Wrapped {
// }
// 
// Path: src/main/java/de/fesere/hypermedia/cj/transformer/ReadTransformation.java
// public interface ReadTransformation<T> {
// 
//     T transform(Item item);
// }


// Path: src/main/java/de/fesere/hypermedia/cj/model/Collection.java
import com.fasterxml.jackson.annotation.*;
import de.fesere.hypermedia.cj.exceptions.CollectionHasErrorsException;
import de.fesere.hypermedia.cj.exceptions.ElementNotFoundException;
import de.fesere.hypermedia.cj.serialization.Wrapped;
import de.fesere.hypermedia.cj.transformer.ReadTransformation;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;

                result.add(convertedItem);
            }
        }

        return result;
    }

    public boolean hasError() {
        return error != null;
    }

    public Error getError() {
        return error;
    }

    public Link getLink(String rel) {
        throwExceptionOnError();

        return findByRel(links,rel);


    }

    private <T extends Link> T findByRel(List<T> elements, String rel) {
        for(T linkable : elements ) {
            if(linkable.getRel().equalsIgnoreCase(rel)) {
                return linkable;
            }
        }

        throw new ElementNotFoundException("Did not find element '"+rel+"' in collection " + href );