001: /*
002: * Copyright 2007 Google Inc.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005: * use this file except in compliance with the License. You may obtain a copy of
006: * the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
012: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013: * License for the specific language governing permissions and limitations under
014: * the License.
015: */
016: package com.google.gwt.i18n.client;
017:
018: import java.util.Map;
019:
020: /**
021: * Like {@link com.google.gwt.i18n.client.Constants}, a tag interface that
022: * facilitates locale-sensitive, compile-time binding of constant values
023: * supplied from properties files with the added ability to look up constants at
024: * runtime with a string key.
025: *
026: * <p>
027: * <code>ConstantsWithLookup</code> extends
028: * {@link com.google.gwt.i18n.client.Constants} and is identical in behavior,
029: * adding only a family of special-purpose lookup methods such as
030: * {@link ConstantsWithLookup#getString(String)}.
031: * </p>
032: *
033: * <p>
034: * It is generally preferable to extend <code>Constants</code> rather than
035: * <code>ConstantsWithLookup</code> because <code>ConstantsWithLookup</code>
036: * forces all constants to be retained in the compiled script, preventing the
037: * GWT compiler from pruning unused constant accessors.
038: * </p>
039: *
040: * <h3>Required Module</h3>
041: * Modules that use this interface should inherit
042: * <code>com.google.gwt.i18n.I18N</code>.
043: *
044: * {@gwt.include com/google/gwt/examples/i18n/InheritsExample.gwt.xml}
045: *
046: * <h3>Note</h3>
047: * You should not directly implement this interface or interfaces derived from
048: * it since an implementation is generated automatically when message interfaces
049: * are created using {@link com.google.gwt.core.client.GWT#create(Class)}.
050: *
051: * @see com.google.gwt.i18n.client.Constants
052: */
053: public interface ConstantsWithLookup extends Constants {
054: /**
055: * Look up <code>boolean</code> by method name.
056: *
057: * @param methodName method name
058: * @return boolean returned by method
059: */
060: public boolean getBoolean(String methodName);
061:
062: /**
063: * Look up <code>double</code> by method name.
064: *
065: * @param methodName method name
066: * @return double returned by method
067: */
068: public double getDouble(String methodName);
069:
070: /**
071: * Look up <code>float</code> by method name.
072: *
073: * @param methodName method name
074: * @return float returned by method
075: */
076: public float getFloat(String methodName);
077:
078: /**
079: * Look up <code>int</code> by method name.
080: *
081: * @param methodName method name
082: * @return int returned by method
083: */
084: public int getInt(String methodName);
085:
086: /**
087: * Look up <code>Map</code> by method name.
088: *
089: * @param methodName method name
090: * @return Map returned by method
091: */
092: public Map<String, String> getMap(String methodName);
093:
094: /**
095: * Look up <code>String</code> by method name.
096: *
097: * @param methodName method name
098: * @return String returned by method
099: */
100: public String getString(String methodName);
101:
102: /**
103: * Look up <code>String[]</code> by method name.
104: *
105: * @param methodName method name
106: * @return String[] returned by method
107: */
108: public String[] getStringArray(String methodName);
109: }
|