001/** 002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 003 * 004 * Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved 005 * 006 * The contents of this file are subject to the terms 007 * of the Common Development and Distribution License 008 * (the License). You may not use this file except in 009 * compliance with the License. 010 * 011 * You can obtain a copy of the License at 012 * https://opensso.dev.java.net/public/CDDLv1.0.html or 013 * opensso/legal/CDDLv1.0.txt 014 * See the License for the specific language governing 015 * permission and limitations under the License. 016 * 017 * When distributing Covered Code, include this CDDL 018 * Header Notice in each file and include the License file 019 * at opensso/legal/CDDLv1.0.txt. 020 * If applicable, add the following below the CDDL Header, 021 * with the fields enclosed by brackets [] replaced by 022 * your own identifying information: 023 * "Portions Copyrighted [year] [name of copyright owner]" 024 * 025 * $Id: Syntax.java,v 1.3 2008/06/25 05:43:45 qcheng Exp $ 026 * 027 * Portions Copyrighted 2014 ForgeRock AS. 028 */ 029 030 031package com.sun.identity.policy; 032 033/** 034 * Provides an enum like support for the syntax of values 035 * such as ANY, NONE, LIST, CONSTANT, SINGLE_CHOICE, MULTIPLE_CHOICE 036 * In other words, provides access to a set of finite values and enforces 037 * new values can not be created by users 038 * 039 * @supported.all.api 040 * @deprecated since 12.0.0 041 */ 042@Deprecated 043public final class Syntax { 044 045 /** 046 * value is a free form text, would be typically shown in as editable 047 * text field 048 */ 049 public static final Syntax ANY = new Syntax("ANY"); 050 051 /** 052 * value is a free form multi list text field 053 */ 054 public static final Syntax LIST = new Syntax("LIST"); 055 056 /** 057 * value is a free form text, could also search from a large set of values 058 */ 059 public static final Syntax ANY_SEARCHABLE = new Syntax("ANY_SEARCHABLE"); 060 061 /** 062 * no value is allowed 063 */ 064 public static final Syntax NONE = new Syntax("NONE"); 065 066 /** 067 * value is a constant string, would be typically shown as non 068 * editable text 069 */ 070 public static final Syntax CONSTANT = new Syntax("CONSTANT"); 071 072 /** 073 * value is a single choice from a list 074 */ 075 public static final Syntax SINGLE_CHOICE = new Syntax("SINGLE_CHOICE"); 076 077 /** 078 * value is multiple choice from list 079 */ 080 public static final Syntax MULTIPLE_CHOICE = new Syntax("MULTIPLE_CHOICE"); 081 082 private String _type; 083 084 private Syntax(String type) { 085 _type = type; 086 } 087 088 /** 089 * Returns the string representation of this object. 090 * 091 * @return string representation of this Syntax 092 */ 093 public String toString() { 094 return _type; 095 } 096 097 /** 098 * Checks whether the argument object is equal to this Syntax 099 * 100 * @param arg Syntax object for comparison. 101 * @return <code>true</code> if the argument object is equal 102 * to this Syntax, else <code>false</code> 103 */ 104 public boolean equals(Object arg) { 105 boolean equalObjects = false; 106 if ( arg == null ) { 107 equalObjects = false; 108 } else if ( arg == this ) { 109 equalObjects = true; 110 } else if ( !(arg instanceof Syntax) ) { 111 equalObjects = false; 112 } else if ( _type.equals(((Syntax)arg)._type)) { 113 equalObjects = true; 114 } 115 return equalObjects; 116 } 117}