View Javadoc

    1   /**
    2    * Copyright (c) 2008-2011, http://www.snakeyaml.org
    3    *
    4    * Licensed under the Apache License, Version 2.0 (the "License");
    5    * you may not use this file except in compliance with the License.
    6    * You may obtain a copy of the License at
    7    *
    8    *     http://www.apache.org/licenses/LICENSE-2.0
    9    *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16
    17  package org.yaml.snakeyaml.tokens;
    18
    19  import org.yaml.snakeyaml.error.Mark;
    20
    21  public final class ScalarToken extends Token {
    22      private final String value;
    23      private final boolean plain;
    24      private final char style;
    25
    26      public ScalarToken(String value, Mark startMark, Mark endMark, boolean plain) {
    27          this(value, plain, startMark, endMark, (char) 0);
    28      }
    29
    30      public ScalarToken(String value, boolean plain, Mark startMark, Mark endMark, char style) {
    31          super(startMark, endMark);
    32          this.value = value;
    33          this.plain = plain;
    34          this.style = style;
    35      }
    36
    37      public boolean getPlain() {
    38          return this.plain;
    39      }
    40
    41      public String getValue() {
    42          return this.value;
    43      }
    44
    45      public char getStyle() {
    46          return this.style;
    47      }
    48
    49      @Override
    50      protected String getArguments() {
    51          return "value=" + value + ", plain=" + plain + ", style=" + style;
    52      }
    53
    54      @Override
    55      public Token.ID getTokenId() {
    56          return ID.Scalar;
    57      }
    58  }