All Downloads are FREE. Search and download functionalities are using the official Maven repository.

freemarker.template.TemplateDateModel Maven / Gradle / Ivy

Go to download

Google App Engine compliant variation of FreeMarker. FreeMarker is a "template engine"; a generic tool to generate text output based on templates.

There is a newer version: 2.3.33
Show newest version
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package freemarker.template;

import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;

/**
 * "date", "time" and "date-time" template language data types: corresponds to {@link java.util.Date}. Contrary to Java,
 * FreeMarker distinguishes date (no time part), time and date-time values.
 * 
 * 

* Objects of this type should be immutable, that is, calling {@link #getAsDate()} and {@link #getDateType()} should * always return the same value as for the first time. */ public interface TemplateDateModel extends TemplateModel { /** * It is not known whether the date represents a date, a time, or a date-time value. * This often leads to exceptions in templates due to ambiguities it causes, so avoid it if possible. */ public static final int UNKNOWN = 0; /** * The date model represents a time value (no date part). */ public static final int TIME = 1; /** * The date model represents a date value (no time part). */ public static final int DATE = 2; /** * The date model represents a date-time value (also known as timestamp). */ public static final int DATETIME = 3; public static final List TYPE_NAMES = Collections.unmodifiableList( Arrays.asList( new String[] { "UNKNOWN", "TIME", "DATE", "DATETIME" })); /** * Returns the date value. The return value must not be {@code null}. */ public Date getAsDate() throws TemplateModelException; /** * Returns the type of the date. It can be any of {@link #TIME}, * {@link #DATE}, or {@link #DATETIME}. */ public int getDateType(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy