/* $$ Clover has instrumented this file $$ */// Copyright 2004 The Apache Software Foundation
//
// Licensed 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 org.apache.tapestry;
import java.io.IOException;
import java.io.InputStream;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import java.util.ResourceBundle;
import java.util.Set;
import javax.servlet.ServletContext;
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.Location;
import org.apache.hivemind.Resource;
import org.apache.tapestry.event.ChangeObserver;
import org.apache.tapestry.event.ObservedChangeEvent;
import org.apache.tapestry.request.RequestContext;
import org.apache.tapestry.resource.ContextResource;
import org.apache.tapestry.spec.IComponentSpecification;
import org.apache.tapestry.util.AdaptorRegistry;
import org.apache.tapestry.util.StringSplitter;
/**
* A placeholder for a number of (static) methods that don't belong elsewhere, as well
* as a global location for static constants.
*
* @since 1.0.1
* @author Howard Lewis Ship
*
**/
public final class Tapestry
{public static com.cortexeb.tools.clover.d __CLOVER_33_0 = com.cortexeb.tools.clover.aq.getRecorder(new char[] {67,58,92,119,111,114,107,115,112,97,99,101,92,106,97,107,97,114,116,97,45,116,97,112,101,115,116,114,121,92,102,114,97,109,101,119,111,114,107,92,116,97,114,103,101,116,92,99,108,111,118,101,114,45,100,98},1096998272901L);
/**
* Name of a request attribute used with the
* {@link #TAGSUPPORT_SERVICE} service. The attribute
* defines the underlying service to for which a URL will be generated.
*
* @since 3.0
*
**/
public final static String TAG_SUPPORT_SERVICE_ATTRIBUTE =
"org.apache.tapestry.tagsupport.service";
/**
* Name of a request attribute used with the
* {@link #TAGSUPPORT_SERVICE} service. The attribute
* defines the correct servlet path for the
* Tapestry application (which, for the odd-man-out TAGSUPPORT_SERVICE
* may not match HttpServletRequest.getServletPath() because of
* the use of an include.
*
* @since 3.0
*/
public final static String TAG_SUPPORT_SERVLET_PATH_ATTRIBUTE =
"org.apache.tapestry.tagsupport.servlet-path";
/**
* Name of a request attribute used with the
* {@link #TAGSUPPORT_SERVICE} service. The attribute
* defines an array of objects to be converted into
* service parameters (i.e., for use with the
* {@link #EXTERNAL_SERVICE}).
*
* @since 3.0
*
**/
public final static String TAG_SUPPORT_PARAMETERS_ATTRIBUTE =
"org.apache.tapestry.tagsupport.parameters";
/**
* Service used to support rendering of JSP tags. tagsupport is provided
* with a service and service parameters via request attributes
* and creates a URI from the result, which is output to the response.
*
* @since 3.0
*
**/
public static final String TAGSUPPORT_SERVICE = "tagsupport";
/**
* The name ("action") of a service that allows behavior to be associated with
* an {@link IAction} component, such as {@link org.apache.tapestry.link.ActionLink} or
* {@link org.apache.tapestry.form.Form}.
*
* <p>This service is used with actions that are tied to the
* dynamic state of the page, and which require a rewind of the page.
*
**/
public final static String ACTION_SERVICE = "action";
/**
* The name ("direct") of a service that allows stateless behavior for an {@link
* org.apache.tapestry.link.DirectLink} component.
*
* <p>This service rolls back the state of the page but doesn't
* rewind the the dynamic state of the page the was the action
* service does, which is more efficient but less powerful.
*
* <p>An array of String parameters may be included with the
* service URL; these will be made available to the {@link org.apache.tapestry.link.DirectLink}
* component's listener.
*
**/
public final static String DIRECT_SERVICE = "direct";
/**
* The name ("external") of a service that a allows {@link IExternalPage} to be selected.
* Associated with a {@link org.apache.tapestry.link.ExternalLink} component.
*
* <p>This service enables {@link IExternalPage}s to be accessed via a URL.
* External pages may be booked marked using their URL for future reference.
*
* <p>An array of Object parameters may be included with the
* service URL; these will be passed to the
* {@link IExternalPage#activateExternalPage(Object[], IRequestCycle)} method.
*
**/
public final static String EXTERNAL_SERVICE = "external";
/**
* The name ("page") of a service that allows a new page to be selected.
* Associated with a {@link org.apache.tapestry.link.PageLink} component.
*
* <p>The service requires a single parameter: the name of the target page.
**/
public final static String PAGE_SERVICE = "page";
/**
* The name ("home") of a service that jumps to the home page. A stand-in for
* when no service is provided, which is typically the entrypoint
* to the application.
*
**/
public final static String HOME_SERVICE = "home";
/**
* The name ("restart") of a service that invalidates the session and restarts
* the application. Typically used just
* to recover from an exception.
*
**/
public static final String RESTART_SERVICE = "restart";
/**
* The name ("asset") of a service used to access internal assets.
*
**/
public static final String ASSET_SERVICE = "asset";
/**
* The name ("reset") of a service used to clear cached template
* and specification data and remove all pooled pages.
* This is only used when debugging as
* a quick way to clear the out cached data, to allow updated
* versions of specifications and templates to be loaded (without
* stopping and restarting the servlet container).
*
* <p>This service is only available if the Java system property
* <code>org.apache.tapestry.enable-reset-service</code>
* is set to <code>true</code>.
*
**/
public static final String RESET_SERVICE = "reset";
/**
* Query parameter that identfies the service for the
* request.
*
* @since 1.0.3
*
**/
public static final String SERVICE_QUERY_PARAMETER_NAME = "service";
/**
* The query parameter for application specific parameters to the
* service (this is used with the direct service). Each of these
* values is encoded with {@link java.net.URLEncoder#encode(String)} before
* being added to the URL. Multiple values are handle by repeatedly
* establishing key/value pairs (this is a change from behavior in
* 2.1 and earlier).
*
* @since 1.0.3
*
**/
public static final String PARAMETERS_QUERY_PARAMETER_NAME = "sp";
/**
* Property name used to get the extension used for templates. This
* may be set in the page or component specification, or in the page (or
* component's) immediate container (library or application specification).
* Unlike most properties, value isn't inherited all the way up the chain.
* The default template extension is "html".
*
* @since 3.0
*
**/
public static final String TEMPLATE_EXTENSION_PROPERTY =
"org.apache.tapestry.template-extension";
/**
* The default extension for templates, "html".
*
* @since 3.0
*
**/
public static final String DEFAULT_TEMPLATE_EXTENSION = "html";
/**
* The name of an {@link org.apache.tapestry.IRequestCycle} attribute in which the
* currently rendering {@link org.apache.tapestry.components.ILinkComponent}
* is stored. Link components do not nest.
*
**/
public static final String LINK_COMPONENT_ATTRIBUTE_NAME =
"org.apache.tapestry.active-link-component";
/**
* Suffix appended to a parameter name to form the name of a property that stores the
* binding for the parameter.
*
* @since 3.0
*
**/
public static final String PARAMETER_PROPERTY_NAME_SUFFIX = "Binding";
/**
* Key used to obtain an extension from the application specification. The extension,
* if it exists, implements {@link org.apache.tapestry.request.IRequestDecoder}.
*
* @since 2.2
*
**/
public static final String REQUEST_DECODER_EXTENSION_NAME =
"org.apache.tapestry.request-decoder";
/**
* Name of optional application extension for the multipart decoder
* used by the application. The extension must implement
* {@link org.apache.tapestry.multipart.IMultipartDecoder}
* (and is generally a configured instance of
* {@link org.apache.tapestry.multipart.DefaultMultipartDecoder}).
*
* @since 3.0
*
**/
public static final String MULTIPART_DECODER_EXTENSION_NAME =
"org.apache.tapestry.multipart-decoder";
/**
* Method id used to check that {@link IPage#validate(IRequestCycle)}
* is invoked.
* @see #checkMethodInvocation(Object, String, Object)
* @since 3.0
*/
public static final String ABSTRACTPAGE_VALIDATE_METHOD_ID = "AbstractPage.validate()";
/**
* Method id used to check that {@link IPage#detach()} is invoked.
* @see #checkMethodInvocation(Object, String, Object)
* @since 3.0
*/
public static final String ABSTRACTPAGE_DETACH_METHOD_ID = "AbstractPage.detach()";
/**
* Regular expression defining a simple property name. Used by several different
* parsers. Simple property names match Java variable names; a leading letter
* (or underscore), followed by letters, numbers and underscores.
*
* @since 3.0
*
**/
public static final String SIMPLE_PROPERTY_NAME_PATTERN = "^_?[a-zA-Z]\\w*$";
/**
* Name of an application extension used as a factory for
* {@link org.apache.tapestry.engine.IMonitor} instances. The extension
* must implement {@link org.apache.tapestry.engine.IMonitorFactory}.
*
* @since 3.0
*/
public static final String MONITOR_FACTORY_EXTENSION_NAME =
"org.apache.tapestry.monitor-factory";
/**
* Class name of an {@link ognl.TypeConverter} implementing class
* to use as a type converter for {@link org.apache.tapestry.binding.ExpressionBinding}
*/
public static final String OGNL_TYPE_CONVERTER = "org.apache.tapestry.ognl-type-converter";
/**
* Prevent instantiation.
*
**/
private Tapestry()
{try { __CLOVER_33_0.M[174]++;
} finally { }}
/**
* The version of the framework; this is updated for major releases.
*
**/
public static final String VERSION = readVersion();
/**
* Contains strings loaded from TapestryStrings.properties.
*
* @since 1.0.8
*
**/
private static ResourceBundle _strings;
/**
* A {@link Map} that links Locale names (as in {@link Locale#toString()} to
* {@link Locale} instances. This prevents needless duplication
* of Locales.
*
**/
private static final Map _localeMap = new HashMap();
static {
__CLOVER_33_0.S[582]++;Locale[] locales = Locale.getAvailableLocales();
__CLOVER_33_0.S[583]++;for (int i = 0; (((i < locales.length) && (++__CLOVER_33_0.CT[118] != 0)) || (++__CLOVER_33_0.CF[118] == 0)); i++){
{
__CLOVER_33_0.S[584]++;_localeMap.put(locales[i].toString(), locales[i]);
}}
}
/**
* Used for tracking if a particular super-class method has been invoked.
*/
private static final ThreadLocal _invokedMethodIds = new ThreadLocal();
/**
* A {@link org.apache.tapestry.util.AdaptorRegistry} used to coerce arbitrary objects
* to boolean values.
*
* @see #evaluateBoolean(Object)
**/
private static final AdaptorRegistry _booleanAdaptors = new AdaptorRegistry();
private static abstract class BoolAdaptor
{
/**
* Implemented by subclasses to coerce an object to a boolean.
*
**/
public abstract boolean coerce(Object value);
}
private static class BooleanAdaptor extends BoolAdaptor
{
public boolean coerce(Object value)
{try { __CLOVER_33_0.M[175]++;
__CLOVER_33_0.S[585]++;Boolean b = (Boolean) value;
__CLOVER_33_0.S[586]++;return b.booleanValue();
} finally { }}
}
private static class NumberAdaptor extends BoolAdaptor
{
public boolean coerce(Object value)
{try { __CLOVER_33_0.M[176]++;
__CLOVER_33_0.S[587]++;Number n = (Number) value;
__CLOVER_33_0.S[588]++;return n.intValue() > 0;
} finally { }}
}
private static class CollectionAdaptor extends BoolAdaptor
{
public boolean coerce(Object value)
{try { __CLOVER_33_0.M[177]++;
__CLOVER_33_0.S[589]++;Collection c = (Collection) value;
__CLOVER_33_0.S[590]++;return c.size() > 0;
} finally { }}
}
private static class StringAdaptor extends BoolAdaptor
{
public boolean coerce(Object value)
{try { __CLOVER_33_0.M[178]++;
__CLOVER_33_0.S[591]++;String s = (String) value;
__CLOVER_33_0.S[592]++;if ((((s.length() == 0) && (++__CLOVER_33_0.CT[119] != 0)) || (++__CLOVER_33_0.CF[119] == 0))){
__CLOVER_33_0.S[593]++;return false;}
__CLOVER_33_0.S[594]++;String ts = s.trim();
__CLOVER_33_0.S[595]++;if ((((ts.length() == 0) && (++__CLOVER_33_0.CT[120] != 0)) || (++__CLOVER_33_0.CF[120] == 0))){
__CLOVER_33_0.S[596]++;return false;}
// Here probably Boolean.getBoolean(s) should be used,
// but we need the opposite check
__CLOVER_33_0.S[597]++;if ((((ts.equalsIgnoreCase("false")) && (++__CLOVER_33_0.CT[121] != 0)) || (++__CLOVER_33_0.CF[121] == 0))){
__CLOVER_33_0.S[598]++;return false;}
__CLOVER_33_0.S[599]++;return true;
} finally { }}
}
static {
__CLOVER_33_0.S[600]++;_booleanAdaptors.register(Boolean.class, new BooleanAdaptor());
__CLOVER_33_0.S[601]++;_booleanAdaptors.register(Number.class, new NumberAdaptor());
__CLOVER_33_0.S[602]++;_booleanAdaptors.register(Collection.class, new CollectionAdaptor());
__CLOVER_33_0.S[603]++;_booleanAdaptors.register(String.class, new StringAdaptor());
// Register a default, catch-all adaptor.
__CLOVER_33_0.S[605]++;_booleanAdaptors.register(Object.class, new BoolAdaptor()
{
public boolean coerce(Object value)
{try { __CLOVER_33_0.M[179]++;
__CLOVER_33_0.S[604]++;return true;
} finally { }}
});
}
/**
* {@link AdaptorRegistry} used to extract an {@link Iterator} from
* an arbitrary object.
*
**/
private static AdaptorRegistry _iteratorAdaptors = new AdaptorRegistry();
private abstract static class IteratorAdaptor
{
/**
* Coeerces the object into an {@link Iterator}.
*
**/
abstract public Iterator coerce(Object value);
}
private static class DefaultIteratorAdaptor extends IteratorAdaptor
{
public Iterator coerce(Object value)
{try { __CLOVER_33_0.M[180]++;
__CLOVER_33_0.S[606]++;return (Iterator) value;
} finally { }}
}
private static class CollectionIteratorAdaptor extends IteratorAdaptor
{
public Iterator coerce(Object value)
{try { __CLOVER_33_0.M[181]++;
__CLOVER_33_0.S[607]++;Collection c = (Collection) value;
__CLOVER_33_0.S[608]++;if ((((c.size() == 0) && (++__CLOVER_33_0.CT[122] != 0)) || (++__CLOVER_33_0.CF[122] == 0))){
__CLOVER_33_0.S[609]++;return null;}
__CLOVER_33_0.S[610]++;return c.iterator();
} finally { }}
}
private static class ObjectIteratorAdaptor extends IteratorAdaptor
{
public Iterator coerce(Object value)
{try { __CLOVER_33_0.M[182]++;
__CLOVER_33_0.S[611]++;return Collections.singleton(value).iterator();
} finally { }}
}
private static class ObjectArrayIteratorAdaptor extends IteratorAdaptor
{
public Iterator coerce(Object value)
{try { __CLOVER_33_0.M[183]++;
__CLOVER_33_0.S[612]++;Object[] array = (Object[]) value;
__CLOVER_33_0.S[613]++;if ((((array.length == 0) && (++__CLOVER_33_0.CT[123] != 0)) || (++__CLOVER_33_0.CF[123] == 0))){
__CLOVER_33_0.S[614]++;return null;}
__CLOVER_33_0.S[615]++;return Arrays.asList(array).iterator();
} finally { }}
}
private static class BooleanArrayIteratorAdaptor extends IteratorAdaptor
{
public Iterator coerce(Object value)
{try { __CLOVER_33_0.M[184]++;
__CLOVER_33_0.S[616]++;boolean[] array = (boolean[]) value;
__CLOVER_33_0.S[617]++;if ((((array.length == 0) && (++__CLOVER_33_0.CT[124] != 0)) || (++__CLOVER_33_0.CF[124] == 0))){
__CLOVER_33_0.S[618]++;return null;}
__CLOVER_33_0.S[619]++;List l = new ArrayList(array.length);
__CLOVER_33_0.S[620]++;for (int i = 0; (((i < array.length) && (++__CLOVER_33_0.CT[125] != 0)) || (++__CLOVER_33_0.CF[125] == 0)); i++){
__CLOVER_33_0.S[621]++;l.add((((array[i] ) && (++__CLOVER_33_0.CT[126] != 0)) || (++__CLOVER_33_0.CF[126] == 0))? Boolean.TRUE : Boolean.FALSE);}
__CLOVER_33_0.S[622]++;return l.iterator();
} finally { }}
}
private static class ByteArrayIteratorAdaptor extends IteratorAdaptor
{
public Iterator coerce(Object value)
{try { __CLOVER_33_0.M[185]++;
__CLOVER_33_0.S[623]++;byte[] array = (byte[]) value;
__CLOVER_33_0.S[624]++;if ((((array.length == 0) && (++__CLOVER_33_0.CT[127] != 0)) || (++__CLOVER_33_0.CF[127] == 0))){
__CLOVER_33_0.S[625]++;return null;}
__CLOVER_33_0.S[626]++;List l = new ArrayList(array.length);
__CLOVER_33_0.S[627]++;for (int i = 0; (((i < array.length) && (++__CLOVER_33_0.CT[128] != 0)) || (++__CLOVER_33_0.CF[128] == 0)); i++){
__CLOVER_33_0.S[628]++;l.add(new Byte(array[i]));}
__CLOVER_33_0.S[629]++;return l.iterator();
} finally { }}
}
private static class CharArrayIteratorAdaptor extends IteratorAdaptor
{
public Iterator coerce(Object value)
{try { __CLOVER_33_0.M[186]++;
__CLOVER_33_0.S[630]++;char[] array = (char[]) value;
__CLOVER_33_0.S[631]++;if ((((array.length == 0) && (++__CLOVER_33_0.CT[129] != 0)) || (++__CLOVER_33_0.CF[129] == 0))){
__CLOVER_33_0.S[632]++;return null;}
__CLOVER_33_0.S[633]++;List l = new ArrayList(array.length);
__CLOVER_33_0.S[634]++;for (int i = 0; (((i < array.length) && (++__CLOVER_33_0.CT[130] != 0)) || (++__CLOVER_33_0.CF[130] == 0)); i++){
__CLOVER_33_0.S[635]++;l.add(new Character(array[i]));}
__CLOVER_33_0.S[636]++;return l.iterator();
} finally { }}
}
private static class ShortArrayIteratorAdaptor extends IteratorAdaptor
{
public Iterator coerce(Object value)
{try { __CLOVER_33_0.M[187]++;
__CLOVER_33_0.S[637]++;short[] array = (short[]) value;
__CLOVER_33_0.S[638]++;if ((((array.length == 0) && (++__CLOVER_33_0.CT[131] != 0)) || (++__CLOVER_33_0.CF[131] == 0))){
__CLOVER_33_0.S[639]++;return null;}
__CLOVER_33_0.S[640]++;List l = new ArrayList(array.length);
__CLOVER_33_0.S[641]++;for (int i = 0; (((i < array.length) && (++__CLOVER_33_0.CT[132] != 0)) || (++__CLOVER_33_0.CF[132] == 0)); i++){
__CLOVER_33_0.S[642]++;l.add(new Short(array[i]));}
__CLOVER_33_0.S[643]++;return l.iterator();
} finally { }}
}
private static class IntArrayIteratorAdaptor extends IteratorAdaptor
{
public Iterator coerce(Object value)
{try { __CLOVER_33_0.M[188]++;
__CLOVER_33_0.S[644]++;int[] array = (int[]) value;
__CLOVER_33_0.S[645]++;if ((((array.length == 0) && (++__CLOVER_33_0.CT[133] != 0)) || (++__CLOVER_33_0.CF[133] == 0))){
__CLOVER_33_0.S[646]++;return null;}
__CLOVER_33_0.S[647]++;List l = new ArrayList(array.length);
__CLOVER_33_0.S[648]++;for (int i = 0; (((i < array.length) && (++__CLOVER_33_0.CT[134] != 0)) || (++__CLOVER_33_0.CF[134] == 0)); i++){
__CLOVER_33_0.S[649]++;l.add(new Integer(array[i]));}
__CLOVER_33_0.S[650]++;return l.iterator();
} finally { }}
}
private static class LongArrayIteratorAdaptor extends IteratorAdaptor
{
public Iterator coerce(Object value)
{try { __CLOVER_33_0.M[189]++;
__CLOVER_33_0.S[651]++;long[] array = (long[]) value;
__CLOVER_33_0.S[652]++;if ((((array.length == 0) && (++__CLOVER_33_0.CT[135] != 0)) || (++__CLOVER_33_0.CF[135] == 0))){
__CLOVER_33_0.S[653]++;return null;}
__CLOVER_33_0.S[654]++;List l = new ArrayList(array.length);
__CLOVER_33_0.S[655]++;for (int i = 0; (((i < array.length) && (++__CLOVER_33_0.CT[136] != 0)) || (++__CLOVER_33_0.CF[136] == 0)); i++){
__CLOVER_33_0.S[656]++;l.add(new Long(array[i]));}
__CLOVER_33_0.S[657]++;return l.iterator();
} finally { }}
}
private static class FloatArrayIteratorAdaptor extends IteratorAdaptor
{
public Iterator coerce(Object value)
{try { __CLOVER_33_0.M[190]++;
__CLOVER_33_0.S[658]++;float[] array = (float[]) value;
__CLOVER_33_0.S[659]++;if ((((array.length == 0) && (++__CLOVER_33_0.CT[137] != 0)) || (++__CLOVER_33_0.CF[137] == 0))){
__CLOVER_33_0.S[660]++;return null;}
__CLOVER_33_0.S[661]++;List l = new ArrayList(array.length);
__CLOVER_33_0.S[662]++;for (int i = 0; (((i < array.length) && (++__CLOVER_33_0.CT[138] != 0)) || (++__CLOVER_33_0.CF[138] == 0)); i++){
__CLOVER_33_0.S[663]++;l.add(new Float(array[i]));}
__CLOVER_33_0.S[664]++;return l.iterator();
} finally { }}
}
private static class DoubleArrayIteratorAdaptor extends IteratorAdaptor
{
public Iterator coerce(Object value)
{try { __CLOVER_33_0.M[191]++;
__CLOVER_33_0.S[665]++;double[] array = (double[]) value;
__CLOVER_33_0.S[666]++;if ((((array.length == 0) && (++__CLOVER_33_0.CT[139] != 0)) || (++__CLOVER_33_0.CF[139] == 0))){
__CLOVER_33_0.S[667]++;return null;}
__CLOVER_33_0.S[668]++;List l = new ArrayList(array.length);
__CLOVER_33_0.S[669]++;for (int i = 0; (((i < array.length) && (++__CLOVER_33_0.CT[140] != 0)) || (++__CLOVER_33_0.CF[140] == 0)); i++){
__CLOVER_33_0.S[670]++;l.add(new Double(array[i]));}
__CLOVER_33_0.S[671]++;return l.iterator();
} finally { }}
}
static {
__CLOVER_33_0.S[672]++;_iteratorAdaptors.register(Iterator.class, new DefaultIteratorAdaptor());
__CLOVER_33_0.S[673]++;_iteratorAdaptors.register(Collection.class, new CollectionIteratorAdaptor());
__CLOVER_33_0.S[674]++;_iteratorAdaptors.register(Object.class, new ObjectIteratorAdaptor());
__CLOVER_33_0.S[675]++;_iteratorAdaptors.register(Object[].class, new ObjectArrayIteratorAdaptor());
__CLOVER_33_0.S[676]++;_iteratorAdaptors.register(boolean[].class, new BooleanArrayIteratorAdaptor());
__CLOVER_33_0.S[677]++;_iteratorAdaptors.register(byte[].class, new ByteArrayIteratorAdaptor());
__CLOVER_33_0.S[678]++;_iteratorAdaptors.register(char[].class, new CharArrayIteratorAdaptor());
__CLOVER_33_0.S[679]++;_iteratorAdaptors.register(short[].class, new ShortArrayIteratorAdaptor());
__CLOVER_33_0.S[680]++;_iteratorAdaptors.register(int[].class, new IntArrayIteratorAdaptor());
__CLOVER_33_0.S[681]++;_iteratorAdaptors.register(long[].class, new LongArrayIteratorAdaptor());
__CLOVER_33_0.S[682]++;_iteratorAdaptors.register(float[].class, new FloatArrayIteratorAdaptor());
__CLOVER_33_0.S[683]++;_iteratorAdaptors.register(double[].class, new DoubleArrayIteratorAdaptor());
}
/**
* Copys all informal {@link IBinding bindings} from a source component
* to the destination component. Informal bindings are bindings for
* informal parameters. This will overwrite parameters (formal or
* informal) in the
* destination component if there is a naming conflict.
*
*
**/
public static void copyInformalBindings(IComponent source, IComponent destination)
{try { __CLOVER_33_0.M[192]++;
__CLOVER_33_0.S[684]++;Collection names = source.getBindingNames();
__CLOVER_33_0.S[685]++;if ((((names == null) && (++__CLOVER_33_0.CT[141] != 0)) || (++__CLOVER_33_0.CF[141] == 0))){
__CLOVER_33_0.S[686]++;return;}
__CLOVER_33_0.S[687]++;IComponentSpecification specification = source.getSpecification();
__CLOVER_33_0.S[688]++;Iterator i = names.iterator();
__CLOVER_33_0.S[689]++;while ((((i.hasNext()) && (++__CLOVER_33_0.CT[142] != 0)) || (++__CLOVER_33_0.CF[142] == 0))){
{
__CLOVER_33_0.S[690]++;String name = (String) i.next();
// If not a formal parameter, then copy it over.
__CLOVER_33_0.S[691]++;if ((((specification.getParameter(name) == null) && (++__CLOVER_33_0.CT[143] != 0)) || (++__CLOVER_33_0.CF[143] == 0))){
{
__CLOVER_33_0.S[692]++;IBinding binding = source.getBinding(name);
__CLOVER_33_0.S[693]++;destination.setBinding(name, binding);
}}
}}
} finally { }}
/**
* Evaluates an object to determine its boolean value.
*
* <table border=1>
* <tr> <th>Class</th> <th>Test</th> </tr>
* <tr>
* <td>{@link Boolean}</td>
* <td>Self explanatory.</td>
* </tr>
* <tr> <td>{@link Number}</td>
* <td>True if non-zero, false otherwise.</td>
* </tr>
* <tr>
* <td>{@link Collection}</td>
* <td>True if contains any elements (non-zero size), false otherwise.</td>
* </tr>
* <tr>
* <td>{@link String}</td>
* <td>True if contains any non-whitespace characters, false otherwise.</td>
* </tr>
* <tr>
* <td>Any Object array type</td>
* <td>True if contains any elements (non-zero length), false otherwise.</td>
* <tr>
*</table>
*
* <p>Any other non-null object evaluates to true.
*
**/
public static boolean evaluateBoolean(Object value)
{try { __CLOVER_33_0.M[193]++;
__CLOVER_33_0.S[694]++;if ((((value == null) && (++__CLOVER_33_0.CT[144] != 0)) || (++__CLOVER_33_0.CF[144] == 0))){
__CLOVER_33_0.S[695]++;return false;}
__CLOVER_33_0.S[696]++;Class valueClass = value.getClass();
__CLOVER_33_0.S[697]++;if ((((valueClass.isArray()) && (++__CLOVER_33_0.CT[145] != 0)) || (++__CLOVER_33_0.CF[145] == 0))){
{
__CLOVER_33_0.S[698]++;Object[] array = (Object[]) value;
__CLOVER_33_0.S[699]++;return array.length > 0;
}}
__CLOVER_33_0.S[700]++;BoolAdaptor adaptor = (BoolAdaptor) _booleanAdaptors.getAdaptor(valueClass);
__CLOVER_33_0.S[701]++;return adaptor.coerce(value);
} finally { }}
/**
* Converts an Object into an {@link Iterator}, following some basic rules.
*
* <table border=1>
* <tr><th>Input Class</th> <th>Result</th> </tr>
* <tr><td>array</td> <td>Converted to a {@link List} and iterator returned.
* null returned if the array is empty. This works with both object arrays and
* arrays of scalars. </td>
* </tr>
* <tr><td>{@link Iterator}</td> <td>Returned as-is.</td>
* <tr><td>{@link Collection}</td> <td>Iterator returned, or null
* if the Collection is empty</td> </tr>
* <tr><td>Any other</td> <td>{@link Iterator} for singleton collection returned</td> </tr>
* <tr><td>null</td> <td>null returned</td> </tr>
* </table>
*
**/
public static Iterator coerceToIterator(Object value)
{try { __CLOVER_33_0.M[194]++;
__CLOVER_33_0.S[702]++;if ((((value == null) && (++__CLOVER_33_0.CT[146] != 0)) || (++__CLOVER_33_0.CF[146] == 0))){
__CLOVER_33_0.S[703]++;return null;}
__CLOVER_33_0.S[704]++;IteratorAdaptor adaptor = (IteratorAdaptor) _iteratorAdaptors.getAdaptor(value.getClass());
__CLOVER_33_0.S[705]++;return adaptor.coerce(value);
} finally { }}
/**
* Gets the {@link Locale} for the given string, which is the result
* of {@link Locale#toString()}. If no such locale is already registered,
* a new instance is created, registered and returned.
*
*
**/
public static Locale getLocale(String s)
{try { __CLOVER_33_0.M[195]++;
__CLOVER_33_0.S[706]++;Locale result = null;
__CLOVER_33_0.S[707]++;synchronized (_localeMap)
{
__CLOVER_33_0.S[708]++;result = (Locale) _localeMap.get(s);
}
__CLOVER_33_0.S[709]++;if ((((result == null) && (++__CLOVER_33_0.CT[147] != 0)) || (++__CLOVER_33_0.CF[147] == 0))){
{
__CLOVER_33_0.S[710]++;StringSplitter splitter = new StringSplitter('_');
__CLOVER_33_0.S[711]++;String[] terms = splitter.splitToArray(s);
__CLOVER_33_0.S[712]++;switch (terms.length)
{
case 1 :
__CLOVER_33_0.S[713]++;result = new Locale(terms[0], "");
__CLOVER_33_0.S[714]++;break;
case 2 :
__CLOVER_33_0.S[715]++;result = new Locale(terms[0], terms[1]);
__CLOVER_33_0.S[716]++;break;
case 3 :
__CLOVER_33_0.S[717]++;result = new Locale(terms[0], terms[1], terms[2]);
__CLOVER_33_0.S[718]++;break;
default :
__CLOVER_33_0.S[719]++;throw new IllegalArgumentException(
"Unable to convert '" + s + "' to a Locale.");
}
__CLOVER_33_0.S[720]++;synchronized (_localeMap)
{
__CLOVER_33_0.S[721]++;_localeMap.put(s, result);
}
}}
__CLOVER_33_0.S[722]++;return result;
} finally { }}
/**
* Closes the stream (if not null), ignoring any {@link IOException} thrown.
*
* @since 1.0.2
*
**/
public static void close(InputStream stream)
{try { __CLOVER_33_0.M[196]++;
__CLOVER_33_0.S[723]++;if ((((stream != null) && (++__CLOVER_33_0.CT[148] != 0)) || (++__CLOVER_33_0.CF[148] == 0))){
{
__CLOVER_33_0.S[724]++;try
{
__CLOVER_33_0.S[725]++;stream.close();
}
catch (IOException ex)
{
// Ignore.
}
}}
} finally { }}
/**
* Gets a string from the TapestryStrings resource bundle.
* The string in the bundle
* is treated as a pattern for {@link MessageFormat#format(java.lang.String, java.lang.Object[])}.
*
* @since 1.0.8
*
**/
public static String format(String key, Object[] args)
{try { __CLOVER_33_0.M[197]++;
__CLOVER_33_0.S[726]++;if ((((_strings == null) && (++__CLOVER_33_0.CT[149] != 0)) || (++__CLOVER_33_0.CF[149] == 0))){
__CLOVER_33_0.S[727]++;_strings = ResourceBundle.getBundle("org.apache.tapestry.TapestryStrings");}
__CLOVER_33_0.S[728]++;String pattern = _strings.getString(key);
__CLOVER_33_0.S[729]++;if ((((args == null) && (++__CLOVER_33_0.CT[150] != 0)) || (++__CLOVER_33_0.CF[150] == 0))){
__CLOVER_33_0.S[730]++;return pattern;}
__CLOVER_33_0.S[731]++;return MessageFormat.format(pattern, args);
} finally { }}
/**
* Convienience method for invoking {@link #format(String, Object[])}.
*
* @since 3.0
**/
public static String getMessage(String key)
{try { __CLOVER_33_0.M[198]++;
__CLOVER_33_0.S[732]++;return format(key, null);
} finally { }}
/**
* Convienience method for invoking {@link #format(String, Object[])}.
*
* @since 3.0
**/
public static String format(String key, Object arg)
{try { __CLOVER_33_0.M[199]++;
__CLOVER_33_0.S[733]++;return format(key, new Object[] { arg });
} finally { }}
/**
* Convienience method for invoking {@link #format(String, Object[])}.
*
* @since 3.0
*
**/
public static String format(String key, Object arg1, Object arg2)
{try { __CLOVER_33_0.M[200]++;
__CLOVER_33_0.S[734]++;return format(key, new Object[] { arg1, arg2 });
} finally { }}
/**
* Convienience method for invoking {@link #format(String, Object[])}.
*
* @since 3.0
*
**/
public static String format(String key, Object arg1, Object arg2, Object arg3)
{try { __CLOVER_33_0.M[201]++;
__CLOVER_33_0.S[735]++;return format(key, new Object[] { arg1, arg2, arg3 });
} finally { }}
private static final String UNKNOWN_VERSION = "Unknown";
/**
* Invoked when the class is initialized to read the current version file.
*
**/
private static final String readVersion()
{try { __CLOVER_33_0.M[202]++;
__CLOVER_33_0.S[736]++;Properties props = new Properties();
__CLOVER_33_0.S[737]++;try
{
__CLOVER_33_0.S[738]++;InputStream in = Tapestry.class.getResourceAsStream("version.properties");
__CLOVER_33_0.S[739]++;if ((((in == null) && (++__CLOVER_33_0.CT[151] != 0)) || (++__CLOVER_33_0.CF[151] == 0))){
__CLOVER_33_0.S[740]++;return UNKNOWN_VERSION;}
__CLOVER_33_0.S[741]++;props.load(in);
__CLOVER_33_0.S[742]++;in.close();
__CLOVER_33_0.S[743]++;return props.getProperty("project.version", UNKNOWN_VERSION);
}
catch (IOException ex)
{
__CLOVER_33_0.S[744]++;return UNKNOWN_VERSION;
}
} finally { }}
/**
* Returns the size of a collection, or zero if the collection is null.
*
* @since 2.2
*
**/
public static int size(Collection c)
{try { __CLOVER_33_0.M[203]++;
__CLOVER_33_0.S[745]++;if ((((c == null) && (++__CLOVER_33_0.CT[152] != 0)) || (++__CLOVER_33_0.CF[152] == 0))){
__CLOVER_33_0.S[746]++;return 0;}
__CLOVER_33_0.S[747]++;return c.size();
} finally { }}
/**
* Returns the length of the array, or 0 if the array is null.
*
* @since 2.2
*
**/
public static int size(Object[] array)
{try { __CLOVER_33_0.M[204]++;
__CLOVER_33_0.S[748]++;if ((((array == null) && (++__CLOVER_33_0.CT[153] != 0)) || (++__CLOVER_33_0.CF[153] == 0))){
__CLOVER_33_0.S[749]++;return 0;}
__CLOVER_33_0.S[750]++;return array.length;
} finally { }}
/**
* Returns true if the Map is null or empty.
*
* @since 3.0
*
**/
public static boolean isEmpty(Map map)
{try { __CLOVER_33_0.M[205]++;
__CLOVER_33_0.S[751]++;return map == null || map.isEmpty();
} finally { }}
/**
* Returns true if the Collection is null or empty.
*
* @since 3.0
*
**/
public static boolean isEmpty(Collection c)
{try { __CLOVER_33_0.M[206]++;
__CLOVER_33_0.S[752]++;return c == null || c.isEmpty();
} finally { }}
/**
* Converts a {@link Map} to an even-sized array of key/value
* pairs. This may be useful when using a Map as service parameters
* (with {@link org.apache.tapestry.link.DirectLink}. Assuming the keys
* and values are simple objects (String, Boolean, Integer, etc.), then
* the representation as an array will encode more efficiently
* (via {@link org.apache.tapestry.util.io.DataSqueezerImpl} than
* serializing the Map and its contents.
*
* @return the array of keys and values, or null if the input
* Map is null or empty
*
* @since 2.2
**/
public static Object[] convertMapToArray(Map map)
{try { __CLOVER_33_0.M[207]++;
__CLOVER_33_0.S[753]++;if ((((isEmpty(map)) && (++__CLOVER_33_0.CT[154] != 0)) || (++__CLOVER_33_0.CF[154] == 0))){
__CLOVER_33_0.S[754]++;return null;}
__CLOVER_33_0.S[755]++;Set entries = map.entrySet();
__CLOVER_33_0.S[756]++;Object[] result = new Object[2 * entries.size()];
__CLOVER_33_0.S[757]++;int x = 0;
__CLOVER_33_0.S[758]++;Iterator i = entries.iterator();
__CLOVER_33_0.S[759]++;while ((((i.hasNext()) && (++__CLOVER_33_0.CT[155] != 0)) || (++__CLOVER_33_0.CF[155] == 0))){
{
__CLOVER_33_0.S[760]++;Map.Entry entry = (Map.Entry) i.next();
__CLOVER_33_0.S[761]++;result[x++] = entry.getKey();
__CLOVER_33_0.S[762]++;result[x++] = entry.getValue();
}}
__CLOVER_33_0.S[763]++;return result;
} finally { }}
/**
* Converts an even-sized array of objects back
* into a {@link Map}.
*
* @see #convertMapToArray(Map)
* @return a Map, or null if the array is null or empty
* @since 2.2
*
**/
public static Map convertArrayToMap(Object[] array)
{try { __CLOVER_33_0.M[208]++;
__CLOVER_33_0.S[764]++;if ((((array == null || array.length == 0) && (++__CLOVER_33_0.CT[156] != 0)) || (++__CLOVER_33_0.CF[156] == 0))){
__CLOVER_33_0.S[765]++;return null;}
__CLOVER_33_0.S[766]++;if ((((array.length % 2 != 0) && (++__CLOVER_33_0.CT[157] != 0)) || (++__CLOVER_33_0.CF[157] == 0))){
__CLOVER_33_0.S[767]++;throw new IllegalArgumentException(getMessage("Tapestry.even-sized-array"));}
__CLOVER_33_0.S[768]++;Map result = new HashMap();
__CLOVER_33_0.S[769]++;int x = 0;
__CLOVER_33_0.S[770]++;while ((((x < array.length) && (++__CLOVER_33_0.CT[158] != 0)) || (++__CLOVER_33_0.CF[158] == 0))){
{
__CLOVER_33_0.S[771]++;Object key = array[x++];
__CLOVER_33_0.S[772]++;Object value = array[x++];
__CLOVER_33_0.S[773]++;result.put(key, value);
}}
__CLOVER_33_0.S[774]++;return result;
} finally { }}
/**
* Returns the application root location, which is in the
* {@link javax.servlet.ServletContext}, based on
* the {@link javax.servlet.http.HttpServletRequest#getServletPath() servlet path}.
*
* @since 3.0
*
**/
public static Resource getApplicationRootLocation(IRequestCycle cycle)
{try { __CLOVER_33_0.M[209]++;
__CLOVER_33_0.S[775]++;RequestContext context = cycle.getRequestContext();
__CLOVER_33_0.S[776]++;ServletContext servletContext = context.getServlet().getServletContext();
__CLOVER_33_0.S[777]++;String servletPath = context.getRequest().getServletPath();
// Could strip off the servlet name (i.e., "app" in "/app") but
// there's no need.
__CLOVER_33_0.S[778]++;return new ContextResource(servletContext, servletPath);
} finally { }}
/**
* Given a Class, creates a presentable name for the class, even if the
* class is a scalar type or Array type.
*
* @since 3.0
*/
public static String getClassName(Class subject)
{try { __CLOVER_33_0.M[210]++;
__CLOVER_33_0.S[779]++;if ((((subject.isArray()) && (++__CLOVER_33_0.CT[159] != 0)) || (++__CLOVER_33_0.CF[159] == 0))){
__CLOVER_33_0.S[780]++;return getClassName(subject.getComponentType()) + "[]";}
__CLOVER_33_0.S[781]++;return subject.getName();
} finally { }}
/**
* Creates an exception indicating the binding value is null.
*
* @since 3.0
*
**/
public static BindingException createNullBindingException(IBinding binding)
{try { __CLOVER_33_0.M[211]++;
__CLOVER_33_0.S[782]++;return new BindingException(getMessage("null-value-for-binding"), binding);
} finally { }}
/** @since 3.0 **/
public static ApplicationRuntimeException createNoSuchComponentException(
IComponent component,
String id,
Location location)
{try { __CLOVER_33_0.M[212]++;
__CLOVER_33_0.S[783]++;return new ApplicationRuntimeException(
format("no-such-component", component.getExtendedId(), id),
component,
location,
null);
} finally { }}
/** @since 3.0 **/
public static BindingException createRequiredParameterException(
IComponent component,
String parameterName)
{try { __CLOVER_33_0.M[213]++;
__CLOVER_33_0.S[784]++;return new BindingException(
format("required-parameter", parameterName, component.getExtendedId()),
component,
null,
component.getBinding(parameterName),
null);
} finally { }}
/** @since 3.0 **/
public static ApplicationRuntimeException createRenderOnlyPropertyException(
IComponent component,
String propertyName)
{try { __CLOVER_33_0.M[214]++;
__CLOVER_33_0.S[785]++;return new ApplicationRuntimeException(
format("render-only-property", propertyName, component.getExtendedId()),
component,
null,
null);
} finally { }}
/**
* Clears the list of method invocations.
* @see #checkMethodInvocation(Object, String, Object)
*
* @since 3.0
*/
public static void clearMethodInvocations()
{try { __CLOVER_33_0.M[215]++;
__CLOVER_33_0.S[786]++;_invokedMethodIds.set(null);
} finally { }}
/**
* Adds a method invocation to the list of invocations. This is done
* in a super-class implementations.
*
* @see #checkMethodInvocation(Object, String, Object)
* @since 3.0
*
*/
public static void addMethodInvocation(Object methodId)
{try { __CLOVER_33_0.M[216]++;
__CLOVER_33_0.S[787]++;List methodIds = (List) _invokedMethodIds.get();
__CLOVER_33_0.S[788]++;if ((((methodIds == null) && (++__CLOVER_33_0.CT[160] != 0)) || (++__CLOVER_33_0.CF[160] == 0))){
{
__CLOVER_33_0.S[789]++;methodIds = new ArrayList();
__CLOVER_33_0.S[790]++;_invokedMethodIds.set(methodIds);
}}
__CLOVER_33_0.S[791]++;methodIds.add(methodId);
} finally { }}
/**
* Checks to see if a particular method has been invoked. The method is identified by a
* methodId (usually a String). The methodName and object are used to create an
* error message.
*
* <p>
* The caller should invoke {@link #clearMethodInvocations()}, then invoke a method on
* the object. The super-class implementation should invoke {@link #addMethodInvocation(Object)}
* to indicate that it was, in fact, invoked. The caller then invokes
* this method to vlaidate that the super-class implementation was invoked.
*
* <p>
* The list of method invocations is stored in a {@link ThreadLocal} variable.
*
* @since 3.0
*/
public static void checkMethodInvocation(Object methodId, String methodName, Object object)
{try { __CLOVER_33_0.M[217]++;
__CLOVER_33_0.S[792]++;List methodIds = (List) _invokedMethodIds.get();
__CLOVER_33_0.S[793]++;if ((((methodIds != null && methodIds.contains(methodId)) && (++__CLOVER_33_0.CT[161] != 0)) || (++__CLOVER_33_0.CF[161] == 0))){
__CLOVER_33_0.S[794]++;return;}
__CLOVER_33_0.S[795]++;throw new ApplicationRuntimeException(
Tapestry.format(
"Tapestry.missing-method-invocation",
object.getClass().getName(),
methodName));
} finally { }}
/**
* Method used by pages and components to send notifications about
* property changes.
*
* @param component the component containing the property
* @param propertyName the name of the property which changed
* @param newValue the new value for the property
*
* @since 3.0
*/
public static void fireObservedChange(
IComponent component,
String propertyName,
Object newValue)
{try { __CLOVER_33_0.M[218]++;
__CLOVER_33_0.S[796]++;ChangeObserver observer = component.getPage().getChangeObserver();
__CLOVER_33_0.S[797]++;if ((((observer == null) && (++__CLOVER_33_0.CT[162] != 0)) || (++__CLOVER_33_0.CF[162] == 0))){
__CLOVER_33_0.S[798]++;return;}
__CLOVER_33_0.S[799]++;ObservedChangeEvent event = new ObservedChangeEvent(component, propertyName, newValue);
__CLOVER_33_0.S[800]++;observer.observeChange(event);
} finally { }}
/**
* Method used by pages and components to send notifications about
* property changes.
*
* @param component the component containing the property
* @param propertyName the name of the property which changed
* @param newValue the new value for the property
*
* @since 3.0
*/
public static void fireObservedChange(
IComponent component,
String propertyName,
boolean newValue)
{try { __CLOVER_33_0.M[219]++;
__CLOVER_33_0.S[801]++;ChangeObserver observer = component.getPage().getChangeObserver();
__CLOVER_33_0.S[802]++;if ((((observer == null) && (++__CLOVER_33_0.CT[163] != 0)) || (++__CLOVER_33_0.CF[163] == 0))){
__CLOVER_33_0.S[803]++;return;}
__CLOVER_33_0.S[804]++;ObservedChangeEvent event =
new ObservedChangeEvent(
component,
propertyName,
(((newValue ) && (++__CLOVER_33_0.CT[164] != 0)) || (++__CLOVER_33_0.CF[164] == 0))? Boolean.TRUE : Boolean.FALSE);
__CLOVER_33_0.S[805]++;observer.observeChange(event);
} finally { }}
/**
* Method used by pages and components to send notifications about
* property changes.
*
* @param component the component containing the property
* @param propertyName the name of the property which changed
* @param newValue the new value for the property
*
* @since 3.0
*/
public static void fireObservedChange(
IComponent component,
String propertyName,
double newValue)
{try { __CLOVER_33_0.M[220]++;
__CLOVER_33_0.S[806]++;ChangeObserver observer = component.getPage().getChangeObserver();
__CLOVER_33_0.S[807]++;if ((((observer == null) && (++__CLOVER_33_0.CT[165] != 0)) || (++__CLOVER_33_0.CF[165] == 0))){
__CLOVER_33_0.S[808]++;return;}
__CLOVER_33_0.S[809]++;ObservedChangeEvent event =
new ObservedChangeEvent(component, propertyName, new Double(newValue));
__CLOVER_33_0.S[810]++;observer.observeChange(event);
} finally { }}
/**
* Method used by pages and components to send notifications about
* property changes.
*
* @param component the component containing the property
* @param propertyName the name of the property which changed
* @param newValue the new value for the property
*
* @since 3.0
*/
public static void fireObservedChange(
IComponent component,
String propertyName,
float newValue)
{try { __CLOVER_33_0.M[221]++;
__CLOVER_33_0.S[811]++;ChangeObserver observer = component.getPage().getChangeObserver();
__CLOVER_33_0.S[812]++;if ((((observer == null) && (++__CLOVER_33_0.CT[166] != 0)) || (++__CLOVER_33_0.CF[166] == 0))){
__CLOVER_33_0.S[813]++;return;}
__CLOVER_33_0.S[814]++;ObservedChangeEvent event =
new ObservedChangeEvent(component, propertyName, new Float(newValue));
__CLOVER_33_0.S[815]++;observer.observeChange(event);
} finally { }}
/**
* Method used by pages and components to send notifications about
* property changes.
*
* @param component the component containing the property
* @param propertyName the name of the property which changed
* @param newValue the new value for the property
*
* @since 3.0
*/
public static void fireObservedChange(IComponent component, String propertyName, int newValue)
{try { __CLOVER_33_0.M[222]++;
__CLOVER_33_0.S[816]++;ChangeObserver observer = component.getPage().getChangeObserver();
__CLOVER_33_0.S[817]++;if ((((observer == null) && (++__CLOVER_33_0.CT[167] != 0)) || (++__CLOVER_33_0.CF[167] == 0))){
__CLOVER_33_0.S[818]++;return;}
__CLOVER_33_0.S[819]++;ObservedChangeEvent event =
new ObservedChangeEvent(component, propertyName, new Integer(newValue));
__CLOVER_33_0.S[820]++;observer.observeChange(event);
} finally { }}
/**
* Method used by pages and components to send notifications about
* property changes.
*
* @param component the component containing the property
* @param propertyName the name of the property which changed
* @param newValue the new value for the property
*
* @since 3.0
*/
public static void fireObservedChange(IComponent component, String propertyName, long newValue)
{try { __CLOVER_33_0.M[223]++;
__CLOVER_33_0.S[821]++;ChangeObserver observer = component.getPage().getChangeObserver();
__CLOVER_33_0.S[822]++;if ((((observer == null) && (++__CLOVER_33_0.CT[168] != 0)) || (++__CLOVER_33_0.CF[168] == 0))){
__CLOVER_33_0.S[823]++;return;}
__CLOVER_33_0.S[824]++;ObservedChangeEvent event =
new ObservedChangeEvent(component, propertyName, new Long(newValue));
__CLOVER_33_0.S[825]++;observer.observeChange(event);
} finally { }}
/**
* Method used by pages and components to send notifications about
* property changes.
*
* @param component the component containing the property
* @param propertyName the name of the property which changed
* @param newValue the new value for the property
*
* @since 3.0
*/
public static void fireObservedChange(IComponent component, String propertyName, char newValue)
{try { __CLOVER_33_0.M[224]++;
__CLOVER_33_0.S[826]++;ChangeObserver observer = component.getPage().getChangeObserver();
__CLOVER_33_0.S[827]++;if ((((observer == null) && (++__CLOVER_33_0.CT[169] != 0)) || (++__CLOVER_33_0.CF[169] == 0))){
__CLOVER_33_0.S[828]++;return;}
__CLOVER_33_0.S[829]++;ObservedChangeEvent event =
new ObservedChangeEvent(component, propertyName, new Character(newValue));
__CLOVER_33_0.S[830]++;observer.observeChange(event);
} finally { }}
/**
* Method used by pages and components to send notifications about
* property changes.
*
* @param component the component containing the property
* @param propertyName the name of the property which changed
* @param newValue the new value for the property
*
* @since 3.0
*/
public static void fireObservedChange(IComponent component, String propertyName, byte newValue)
{try { __CLOVER_33_0.M[225]++;
__CLOVER_33_0.S[831]++;ChangeObserver observer = component.getPage().getChangeObserver();
__CLOVER_33_0.S[832]++;if ((((observer == null) && (++__CLOVER_33_0.CT[170] != 0)) || (++__CLOVER_33_0.CF[170] == 0))){
__CLOVER_33_0.S[833]++;return;}
__CLOVER_33_0.S[834]++;ObservedChangeEvent event =
new ObservedChangeEvent(component, propertyName, new Byte(newValue));
__CLOVER_33_0.S[835]++;observer.observeChange(event);
} finally { }}
/**
* Method used by pages and components to send notifications about
* property changes.
*
* @param component the component containing the property
* @param propertyName the name of the property which changed
* @param newValue the new value for the property
*
* @since 3.0
*/
public static void fireObservedChange(
IComponent component,
String propertyName,
short newValue)
{try { __CLOVER_33_0.M[226]++;
__CLOVER_33_0.S[836]++;ChangeObserver observer = component.getPage().getChangeObserver();
__CLOVER_33_0.S[837]++;if ((((observer == null) && (++__CLOVER_33_0.CT[171] != 0)) || (++__CLOVER_33_0.CF[171] == 0))){
__CLOVER_33_0.S[838]++;return;}
__CLOVER_33_0.S[839]++;ObservedChangeEvent event =
new ObservedChangeEvent(component, propertyName, new Short(newValue));
__CLOVER_33_0.S[840]++;observer.observeChange(event);
} finally { }}
/**
* Returns true if the input is null or contains only whitespace.
*
* <p>
* Note: Yes, you'd think we'd use <code>StringUtils</code>, but with
* the change in names and behavior between releases, it is smarter
* to just implement our own little method!
*
* @since 3.0
*/
public static boolean isBlank(String input)
{try { __CLOVER_33_0.M[227]++;
__CLOVER_33_0.S[841]++;if ((((input == null || input.length() == 0) && (++__CLOVER_33_0.CT[172] != 0)) || (++__CLOVER_33_0.CF[172] == 0))){
__CLOVER_33_0.S[842]++;return true;}
__CLOVER_33_0.S[843]++;return input.trim().length() == 0;
} finally { }}
/**
* Returns true if the input is not null and not empty (or only whitespace).
*
* @since 3.0
*
*/
public static boolean isNonBlank(String input)
{try { __CLOVER_33_0.M[228]++;
__CLOVER_33_0.S[844]++;return !isBlank(input);
} finally { }}
/**
* Defensive programming: check for null parameter where it is not acceptible.
*/
public static void notNull(Object parameter, String parameterName)
{try { __CLOVER_33_0.M[229]++;
__CLOVER_33_0.S[845]++;if ((((parameter == null) && (++__CLOVER_33_0.CT[173] != 0)) || (++__CLOVER_33_0.CF[173] == 0))){
__CLOVER_33_0.S[846]++;throw new NullPointerException(TapestryMessages.paramNotNull(parameterName));}
} finally { }}
}