001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements.  See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership.  The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License.  You may obtain a copy of the License at
009     *
010     *   http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing,
013     * software distributed under the License is distributed on an
014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     * KIND, either express or implied.  See the License for the
016     * specific language governing permissions and limitations
017     * under the License.
018     */
019    
020    package org.apache.myfaces.tobago.context;
021    
022    import java.io.Serializable;
023    import java.util.Locale;
024    
025    /*
026     * Date: Sep 25, 2006
027     * Time: 10:54:19 AM
028     */
029    public class RendererConfig implements Serializable {
030    
031      private static final long serialVersionUID = 1L;
032    
033      private String name;
034      private MarkupConfig markupConfig;
035    
036      public String getName() {
037        return name;
038      }
039    
040      public void setName(String name) {
041        this.name = name.substring(0, 1).toLowerCase(Locale.ENGLISH) + name.substring(1);
042      }
043    
044      public boolean equals(Object o) {
045        if (this == o) {
046          return true;
047        }
048        if (o == null || getClass() != o.getClass()) {
049          return false;
050        }
051    
052        final RendererConfig that = (RendererConfig) o;
053    
054        return name.equals(that.name);
055    
056      }
057    
058      public boolean contains(String markup) {
059        return markupConfig.contains(markup);
060      }
061    
062      public int hashCode() {
063        return name.hashCode();
064      }
065    
066      public MarkupConfig getMarkupConfig() {
067        return markupConfig;
068      }
069    
070      public void setMarkupConfig(MarkupConfig markupConfig) {
071        this.markupConfig = markupConfig;
072      }
073    
074      public String toString() {
075        return "RendererConfig: " + getName() + " " + markupConfig;
076      }
077    
078    }