david_williams | dce4ddd | 2005-03-18 05:35:37 +0000 | [diff] [blame] | 1 | /******************************************************************************* |
amywu | ecebb04 | 2007-04-10 20:07:35 +0000 | [diff] [blame] | 2 | * Copyright (c) 2001, 2005 IBM Corporation and others. |
david_williams | dce4ddd | 2005-03-18 05:35:37 +0000 | [diff] [blame] | 3 | * All rights reserved. This program and the accompanying materials |
| 4 | * are made available under the terms of the Eclipse Public License v1.0 |
| 5 | * which accompanies this distribution, and is available at |
| 6 | * http://www.eclipse.org/legal/epl-v10.html |
amywu | ecebb04 | 2007-04-10 20:07:35 +0000 | [diff] [blame] | 7 | * |
david_williams | dce4ddd | 2005-03-18 05:35:37 +0000 | [diff] [blame] | 8 | * Contributors: |
| 9 | * IBM Corporation - initial API and implementation |
| 10 | * Jens Lukowski/Innoopract - initial renaming/restructuring |
| 11 | * |
| 12 | *******************************************************************************/ |
| 13 | package org.eclipse.wst.sse.core.internal.encoding; |
| 14 | |
| 15 | |
| 16 | /** |
| 17 | * Class to provided "enumerated types" for encoding rule parameter. This is |
| 18 | * to be used by client to have some control over how encoding is determined. |
| 19 | */ |
| 20 | public class EncodingRule { |
| 21 | /** |
| 22 | * CONTENT_BASED means the class which uses the parameter (such as |
| 23 | * contentType Loaders) should use what ever rules it normally would. |
| 24 | * (Note, some content type loaders may not always literally use the file |
| 25 | * content to determine encoding, but the point is they should use what |
| 26 | * ever rules they normally would.) |
| 27 | */ |
| 28 | public static final EncodingRule CONTENT_BASED = new EncodingRule("CONTENT_BASED"); //$NON-NLS-1$ |
| 29 | /** |
| 30 | * FORCE_DEFAULT means the class which uses the parameter (such as |
| 31 | * contentType Loaders) should use what ever it defines as the default |
| 32 | * encoding. |
| 33 | */ |
| 34 | public static final EncodingRule FORCE_DEFAULT = new EncodingRule("FORCE_DEFAULT"); //$NON-NLS-1$ |
| 35 | |
| 36 | /** |
| 37 | * IGNORE_CONVERSION_ERROR means that the save operation should save even |
| 38 | * if it encounters conversion errors. This will result in some data loss, |
| 39 | * so should only be used after the user confirms that is indeed what they |
| 40 | * want to do. |
| 41 | */ |
| 42 | public static final EncodingRule IGNORE_CONVERSION_ERROR = new EncodingRule("IGNORE_CONVERSION_ERROR"); //$NON-NLS-1$ |
| 43 | |
| 44 | |
| 45 | private final String encodingRule; |
| 46 | |
| 47 | /** |
| 48 | * Constructor for EncodingRule is private, so no one can instantiate |
| 49 | * except this class itself. |
| 50 | */ |
| 51 | private EncodingRule(String ruleName) { |
| 52 | super(); |
| 53 | encodingRule = ruleName; |
| 54 | } |
| 55 | |
| 56 | public String toString() { |
| 57 | return encodingRule; |
| 58 | } |
| 59 | } |