001/*
002 * Copyright 2023 the original author or authors.
003 * <p>
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 * <p>
008 * https://www.apache.org/licenses/LICENSE-2.0
009 * <p>
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package de.cuioss.tools.formatting.template.token;
017
018import de.cuioss.tools.formatting.template.FormatterSupport;
019import lombok.EqualsAndHashCode;
020import lombok.NonNull;
021import lombok.RequiredArgsConstructor;
022import lombok.ToString;
023
024/**
025 * Simple String token, this token returns always his value on
026 * {@linkplain #substituteAttribute(FormatterSupport)}
027 *
028 * @author Eugen Fischer
029 */
030@ToString
031@EqualsAndHashCode
032@RequiredArgsConstructor
033public class StringToken implements Token {
034
035    private static final long serialVersionUID = 6377388001925442782L;
036
037    @NonNull
038    private final String value;
039
040    /**
041     * returns always stored string value
042     */
043    @Override
044    public String substituteAttribute(final FormatterSupport content) {
045        return value;
046    }
047
048    @Override
049    public boolean isStringToken() {
050        return true;
051    }
052
053}