001/** 002 * Logback: the reliable, generic, fast and flexible logging framework. 003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved. 004 * 005 * This program and the accompanying materials are dual-licensed under 006 * either the terms of the Eclipse Public License v1.0 as published by 007 * the Eclipse Foundation 008 * 009 * or (per the licensee's choosing) 010 * 011 * under the terms of the GNU Lesser General Public License version 2.1 012 * as published by the Free Software Foundation. 013 */ 014package ch.qos.logback.core.pattern.parser; 015 016import java.util.List; 017 018public class SimpleKeywordNode extends FormattingNode { 019 020 List<String> optionList; 021 022 SimpleKeywordNode(Object value) { 023 super(Node.SIMPLE_KEYWORD, value); 024 } 025 026 protected SimpleKeywordNode(int type, Object value) { 027 super(type, value); 028 } 029 030 public List<String> getOptions() { 031 return optionList; 032 } 033 034 public void setOptions(List<String> optionList) { 035 this.optionList = optionList; 036 } 037 038 public boolean equals(Object o) { 039 if (!super.equals(o)) { 040 return false; 041 } 042 043 if (!(o instanceof SimpleKeywordNode)) { 044 return false; 045 } 046 SimpleKeywordNode r = (SimpleKeywordNode) o; 047 048 return (optionList != null ? optionList.equals(r.optionList) : r.optionList == null); 049 } 050 051 @Override 052 public int hashCode() { 053 return super.hashCode(); 054 } 055 056 public String toString() { 057 StringBuilder buf = new StringBuilder(); 058 if (optionList == null) { 059 buf.append("KeyWord(" + value + "," + formatInfo + ")"); 060 } else { 061 buf.append("KeyWord(" + value + ", " + formatInfo + "," + optionList + ")"); 062 } 063 buf.append(printNext()); 064 return buf.toString(); 065 } 066}