001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.camel.builder;
018
019/**
020 * Represents a proxy to an error handler builder which is resolved by named
021 * reference
022 */
023public class ErrorHandlerBuilderRef extends ErrorHandlerBuilderSupport {
024
025    public static final String DEFAULT_ERROR_HANDLER_BUILDER = "CamelDefaultErrorHandlerBuilder";
026
027    private final String ref;
028    private boolean supportTransacted;
029
030    public ErrorHandlerBuilderRef(String ref) {
031        this.ref = ref;
032    }
033
034    @Override
035    public boolean supportTransacted() {
036        return supportTransacted;
037    }
038
039    @Override
040    public ErrorHandlerBuilder cloneBuilder() {
041        ErrorHandlerBuilderRef answer = new ErrorHandlerBuilderRef(ref);
042        cloneBuilder(answer);
043        return answer;
044    }
045
046    protected void cloneBuilder(ErrorHandlerBuilderRef other) {
047        super.cloneBuilder(other);
048
049        // no need to copy the handlers
050
051        other.supportTransacted = supportTransacted;
052    }
053
054    public String getRef() {
055        return ref;
056    }
057
058    @Override
059    public String toString() {
060        return "ErrorHandlerBuilderRef[" + ref + "]";
061    }
062}