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

javax.faces.event.PhaseId Maven / Gradle / Ivy

There is a newer version: 4.1.0
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 javax.faces.event;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * see Javadoc of JSF Specification
 * 
 * @author Thomas Spiegl (latest modification by $Author: bommel $)
 * @version $Revision: 1187700 $ $Date: 2011-10-22 07:19:37 -0500 (Sat, 22 Oct 2011) $
 */
public class PhaseId implements Comparable
{
    // FIELDS
    public static final PhaseId ANY_PHASE;
    public static final PhaseId APPLY_REQUEST_VALUES;
    public static final PhaseId INVOKE_APPLICATION;
    public static final PhaseId PROCESS_VALIDATIONS;
    public static final PhaseId RENDER_RESPONSE;
    public static final PhaseId RESTORE_VIEW;
    public static final PhaseId UPDATE_MODEL_VALUES;
    public static final List VALUES;

    static
    {
        int i = 0;
        ArrayList list = new ArrayList(6);

        ANY_PHASE = new PhaseId("ANY_PHASE", i++);
        list.add(ANY_PHASE);
        RESTORE_VIEW = new PhaseId("RESTORE_VIEW", i++);
        list.add(RESTORE_VIEW);
        APPLY_REQUEST_VALUES = new PhaseId("APPLY_REQUEST_VALUES", i++);
        list.add(APPLY_REQUEST_VALUES);
        PROCESS_VALIDATIONS = new PhaseId("PROCESS_VALIDATIONS", i++);
        list.add(PROCESS_VALIDATIONS);
        UPDATE_MODEL_VALUES = new PhaseId("UPDATE_MODEL_VALUES", i++);
        list.add(UPDATE_MODEL_VALUES);
        INVOKE_APPLICATION = new PhaseId("INVOKE_APPLICATION", i++);
        list.add(INVOKE_APPLICATION);
        RENDER_RESPONSE = new PhaseId("RENDER_RESPONSE", i++);
        list.add(RENDER_RESPONSE);
        VALUES = Collections.unmodifiableList(list);
    }

    private final String _name;
    private final int _ordinal;

    // CONSTRUCTORS
    private PhaseId(String name, int ordinal)
    {
        this._name = name;
        this._ordinal = ordinal;
    }

    // METHODS
    public int compareTo(Object other)
    {
        return _ordinal - ((PhaseId) other)._ordinal;
    }

    public int getOrdinal()
    {
        return _ordinal;
    }

    @Override
    public String toString()
    {
        return _name + "(" + _ordinal + ")";
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy