/// <summary> /// Attempts to set the value of the given property object on the given base object. If this /// resolver handles the given (base, property) pair, the propertyResolved property of the /// ELContext object must be set to true by the resolver, before returning. If this property is /// not true after this method is called, the caller can safely assume no value has been set. /// </summary> /// <param name="context"> /// The context of this evaluation. </param> /// <param name="base"> /// The base object whose property value is to be set, or null to set a top-level /// variable. </param> /// <param name="property"> /// The property or variable to be set. </param> /// <param name="value"> /// The value to set the property or variable to. </param> /// <exception cref="NullPointerException"> /// if context is null </exception> /// <exception cref="PropertyNotFoundException"> /// if the given (base, property) pair is handled by this ELResolver but the /// specified variable or property does not exist. </exception> /// <exception cref="PropertyNotWritableException"> /// if the given (base, property) pair is handled by this ELResolver but the /// specified variable or property is not writable. </exception> /// <exception cref="ELException"> /// if an exception was thrown while attempting to set the property or variable. The /// thrown exception must be included as the cause property of this exception, if /// available. </exception> public abstract void setValue(ELContext context, object @base, object property, object value);
/// <summary> /// Attempts to resolve and invoke the given <code>method</code> on the given <code>base</code> /// object. /// /// <para> /// If this resolver handles the given (base, method) pair, the <code>propertyResolved</code> /// property of the <code>ELContext</code> object must be set to <code>true</code> by the /// resolver, before returning. If this property is not <code>true</code> after this method is /// called, the caller should ignore the return value. /// </para> /// /// <para> /// A default implementation is provided that returns null so that existing classes that extend /// ELResolver can continue to function. /// </para> /// </summary> /// <param name="context"> /// The context of this evaluation. </param> /// <param name="base"> /// The bean on which to invoke the method </param> /// <param name="method"> /// The simple name of the method to invoke. Will be coerced to a <code>String</code>. </param> /// <param name="paramTypes"> /// An array of Class objects identifying the method's formal parameter types, in /// declared order. Use an empty array if the method has no parameters. Can be /// <code>null</code>, in which case the method's formal parameter types are assumed /// to be unknown. </param> /// <param name="params"> /// The parameters to pass to the method, or <code>null</code> if no parameters. </param> /// <returns> The result of the method invocation (<code>null</code> if the method has a /// <code>void</code> return type). </returns> /// <exception cref="MethodNotFoundException"> /// if no suitable method can be found. </exception> /// <exception cref="ELException"> /// if an exception was thrown while performing (base, method) resolution. The thrown /// exception must be included as the cause property of this exception, if available. /// If the exception thrown is an <code>InvocationTargetException</code>, extract its /// <code>cause</code> and pass it to the <code>ELException</code> constructor. /// @since 2.2 </exception> public virtual object invoke(ELContext context, object @base, object method, Type[] paramTypes, object[] @params) { return(null); }
/// <summary> /// Attempts to resolve the given property object on the given base object. If this resolver /// handles the given (base, property) pair, the propertyResolved property of the ELContext /// object must be set to true by the resolver, before returning. If this property is not true /// after this method is called, the caller should ignore the return value. /// </summary> /// <param name="context"> /// The context of this evaluation. </param> /// <param name="base"> /// The base object whose property value is to be returned, or null to resolve a /// top-level variable. </param> /// <param name="property"> /// The property or variable to be resolved. </param> /// <returns> If the propertyResolved property of ELContext was set to true, then the result of the /// variable or property resolution; otherwise undefined. </returns> /// <exception cref="NullPointerException"> /// if context is null </exception> /// <exception cref="PropertyNotFoundException"> /// if the given (base, property) pair is handled by this ELResolver but the /// specified variable or property does not exist or is not readable. </exception> /// <exception cref="ELException"> /// if an exception was thrown while performing the property or variable resolution. /// The thrown exception must be included as the cause property of this exception, if /// available. </exception> public abstract object getValue(ELContext context, object @base, object property);
/// <summary> /// For a given base and property, attempts to determine whether a call to /// <seealso cref="setValue(ELContext, object, object, object)"/> will always fail. If this resolver /// handles the given (base, property) pair, the propertyResolved property of the ELContext /// object must be set to true by the resolver, before returning. If this property is not true /// after this method is called, the caller should ignore the return value. /// </summary> /// <param name="context"> /// The context of this evaluation. </param> /// <param name="base"> /// The base object whose property value is to be analyzed, or null to analyze a /// top-level variable. </param> /// <param name="property"> /// The property or variable to return the read-only status for. </param> /// <returns> If the propertyResolved property of ELContext was set to true, then true if the /// property is read-only or false if not; otherwise undefined. </returns> /// <exception cref="NullPointerException"> /// if context is null </exception> /// <exception cref="PropertyNotFoundException"> /// if the given (base, property) pair is handled by this ELResolver but the /// specified variable or property does not exist. </exception> /// <exception cref="ELException"> /// if an exception was thrown while performing the property or variable resolution. /// The thrown exception must be included as the cause property of this exception, if /// available. </exception> public abstract bool isReadOnly(ELContext context, object @base, object property);
/// <summary> /// Parses an expression into a <seealso cref="MethodExpression"/> for later evaluation. Use this method /// for expressions that refer to methods. If the expression is a String literal, a /// MethodExpression is created, which when invoked, returns the String literal, coerced to /// expectedReturnType. An ELException is thrown if expectedReturnType is void or if the coercion /// of the String literal to the expectedReturnType yields an error (see Section "1.16 Type /// Conversion"). This method should perform syntactic validation of the expression. If in doing /// so it detects errors, it should raise an ELException. /// </summary> /// <param name="context"> /// The EL context used to parse the expression. The FunctionMapper and VariableMapper /// stored in the ELContext are used to resolve functions and variables found in the /// expression. They can be null, in which case functions or variables are not /// supported for this expression. The object returned must invoke the same functions /// and access the same variable mappings regardless of whether the mappings in the /// provided FunctionMapper and VariableMapper instances change between calling /// ExpressionFactory.createMethodExpression() and any method on MethodExpression. /// Note that within the EL, the ${} and #{} syntaxes are treated identically. This /// includes the use of VariableMapper and FunctionMapper at expression creation time. /// Each is invoked if not null, independent of whether the #{} or ${} syntax is used /// for the expression. </param> /// <param name="expression"> /// The expression to parse </param> /// <param name="expectedReturnType"> /// The expected return type for the method to be found. After evaluating the /// expression, the MethodExpression must check that the return type of the actual /// method matches this type. Passing in a value of null indicates the caller does not /// care what the return type is, and the check is disabled. </param> /// <param name="expectedParamTypes"> /// The expected parameter types for the method to be found. Must be an array with no /// elements if there are no parameters expected. It is illegal to pass null. </param> /// <returns> The parsed expression </returns> /// <exception cref="ELException"> /// Thrown if there are syntactical errors in the provided expression. </exception> /// <exception cref="NullPointerException"> /// if paramTypes is null. </exception> public abstract MethodExpression createMethodExpression(ELContext context, string expression, Type expectedReturnType, Type[] expectedParamTypes);
/// <summary> /// Evaluates the expression relative to the provided context, and returns true if a call to /// <seealso cref="setValue(ELContext, object)"/> will always fail. /// </summary> /// <param name="context"> /// The context of this evaluation. </param> /// <returns> true if the expression is read-only or false if not. </returns> /// <exception cref="NullPointerException"> /// if context is null. </exception> /// <exception cref="PropertyNotFoundException"> /// if one of the property resolutions failed because a specified variable or /// property does not exist or is not readable. </exception> /// <exception cref="ELException"> /// if an exception was thrown while performing property or variable resolution. The /// thrown exception must be included as the cause property of this exception, if /// available. </exception> public abstract bool isReadOnly(ELContext context);
public override bool isReadOnly(ELContext context, object @base, object property) { return(this.readOnly); }
/// <summary> /// If a String literal is specified as the expression, returns the String literal coerced to the /// expected return type of the method signature. An ELException is thrown if expectedReturnType /// is void or if the coercion of the String literal to the expectedReturnType yields an error /// (see Section "1.16 Type Conversion" of the EL specification). If not a String literal, /// evaluates the expression relative to the provided context, invokes the method that was found /// using the supplied parameters, and returns the result of the method invocation. Any /// parameters passed to this method is ignored if isLiteralText() is true. /// </summary> /// <param name="context"> /// The context of this evaluation. </param> /// <param name="params"> /// The parameters to pass to the method, or null if no parameters. </param> /// <returns> the result of the method invocation (null if the method has a void return type). </returns> /// <exception cref="NullPointerException"> /// if context is null </exception> /// <exception cref="PropertyNotFoundException"> /// if one of the property resolutions failed because a specified variable or /// property does not exist or is not readable. </exception> /// <exception cref="MethodNotFoundException"> /// if no suitable method can be found. </exception> /// <exception cref="ELException"> /// if a String literal is specified and expectedReturnType of the MethodExpression /// is void or if the coercion of the String literal to the expectedReturnType yields /// an error (see Section "1.16 Type Conversion"). </exception> /// <exception cref="ELException"> /// if an exception was thrown while performing property or variable resolution. The /// thrown exception must be included as the cause property of this exception, if /// available. If the exception thrown is an InvocationTargetException, extract its /// cause and pass it to the ELException constructor. </exception> public abstract object invoke(ELContext context, object[] @params);
public override IEnumerator <FeatureDescriptor> getFeatureDescriptors(ELContext context, object @base) { return(null); }
public override Type getType(ELContext context, object @base, object property) { return(typeof(object)); }
/// <summary> /// Evaluates the expression relative to the provided context, and returns the most general type /// that is acceptable for an object to be passed as the value parameter in a future call to the /// <seealso cref="setValue(ELContext, object)"/> method. This is not always the same as /// getValue().getClass(). For example, in the case of an expression that references an array /// element, the getType method will return the element type of the array, which might be a /// superclass of the type of the actual element that is currently in the specified array /// element. /// </summary> /// <param name="context"> /// The context of this evaluation. </param> /// <returns> the most general acceptable type; otherwise undefined. </returns> /// <exception cref="NullPointerException"> /// if context is null. </exception> /// <exception cref="PropertyNotFoundException"> /// if one of the property resolutions failed because a specified variable or /// property does not exist or is not readable. </exception> /// <exception cref="ELException"> /// if an exception was thrown while performing property or variable resolution. The /// thrown exception must be included as the cause property of this exception, if /// available. </exception> public abstract Type getType(ELContext context);
/// <summary> /// Returns a <seealso cref="ValueReference"/> for this expression instance. /// </summary> /// <param name="context"> /// the context of this evaluation </param> /// <returns> the <code>ValueReference</code> for this <code>ValueExpression</code>, or /// <code>null</code> if this <code>ValueExpression</code> is not a reference to a base /// (null or non-null) and a property. If the base is null, and the property is a EL /// variable, return the <code>ValueReference</code> for the <code>ValueExpression</code> /// associated with this EL variable. /// /// @since 2.2 </returns> public virtual ValueReference getValueReference(ELContext context) { return(null); }
/// <summary> /// Evaluates the expression relative to the provided context, and sets the result to the /// provided value. /// </summary> /// <param name="context"> /// The context of this evaluation. </param> /// <param name="value"> /// The new value to be set. </param> /// <exception cref="NullPointerException"> /// if context is null. </exception> /// <exception cref="PropertyNotFoundException"> /// if one of the property resolutions failed because a specified variable or /// property does not exist or is not readable. </exception> /// <exception cref="PropertyNotWritableException"> /// if the final variable or property resolution failed because the specified /// variable or property is not writable. </exception> /// <exception cref="ELException"> /// if an exception was thrown while attempting to set the property or variable. The /// thrown exception must be included as the cause property of this exception, if /// available. </exception> public abstract void setValue(ELContext context, object value);
/// <summary> /// Returns the most general type that this resolver accepts for the property argument, given a /// base object. One use for this method is to assist tools in auto-completion. This assists /// tools in auto-completion and also provides a way to express that the resolver accepts a /// primitive value, such as an integer index into an array. For example, the /// <seealso cref="ArrayELResolver"/> will accept any int as a property, so the return value would be /// Integer.class. /// </summary> /// <param name="context"> /// The context of this evaluation. </param> /// <param name="base"> /// The base object to return the most general property type for, or null to enumerate /// the set of top-level variables that this resolver can evaluate. </param> /// <returns> null if this ELResolver does not know how to handle the given base object; otherwise /// Object.class if any type of property is accepted; otherwise the most general property /// type accepted for the given base. </returns> public abstract Type getCommonPropertyType(ELContext context, object @base);
/// <summary> /// If the base object is a ResourceBundle, returns the most general type that this resolver /// accepts for the property argument. Otherwise, returns null. Assuming the base is a /// ResourceBundle, this method will always return String.class. /// </summary> /// <param name="context"> /// The context of this evaluation. </param> /// <param name="base"> /// The bundle to analyze. Only bases of type ResourceBundle are handled by this /// resolver. </param> /// <returns> null if base is not a ResourceBundle; otherwise String.class. </returns> public override Type getCommonPropertyType(ELContext context, object @base) { return(isResolvable(@base) ? typeof(string) : null); }
/// <summary> /// Evaluates the expression relative to the provided context, and returns information about the /// actual referenced method. /// </summary> /// <param name="context"> /// The context of this evaluation. </param> /// <returns> The context of this evaluation </returns> /// <exception cref="NullPointerException"> /// if context is null </exception> /// <exception cref="PropertyNotFoundException"> /// if one of the property resolutions failed because a specified variable or /// property does not exist or is not readable. </exception> /// <exception cref="MethodNotFoundException"> /// if no suitable method can be found. </exception> /// <exception cref="ELException"> /// if an exception was thrown while performing property or variable resolution. The /// thrown exception must be included as the cause property of this exception, if /// available. </exception> public abstract MethodInfo getMethodInfo(ELContext context);
/// <summary> /// Returns information about the set of variables or properties that can be resolved for the /// given base object. One use for this method is to assist tools in auto-completion. If the base /// parameter is null, the resolver must enumerate the list of top-level variables it can /// resolve. The Iterator returned must contain zero or more instances of /// java.beans.FeatureDescriptor, in no guaranteed order. In the case of primitive types such as /// int, the value null must be returned. This is to prevent the useless iteration through all /// possible primitive values. A return value of null indicates that this resolver does not /// handle the given base object or that the results are too complex to represent with this /// method and the <seealso cref="getCommonPropertyType(ELContext, object)"/> method should be used /// instead. Each FeatureDescriptor will contain information about a single variable or property. /// In addition to the standard properties, the FeatureDescriptor must have two named attributes /// (as set by the setValue method): /// <ul> /// <li><seealso cref="TYPE"/> - The value of this named attribute must be an instance of java.lang.Class /// and specify the runtime type of the variable or property.</li> /// <li><seealso cref="RESOLVABLE_AT_DESIGN_TIME"/> - The value of this named attribute must be an /// instance of java.lang.Boolean and indicates whether it is safe to attempt to resolve this /// property at designtime. For instance, it may be unsafe to attempt a resolution at design time /// if the ELResolver needs access to a resource that is only available at runtime and no /// acceptable simulated value can be provided.</li> /// </ul> /// The caller should be aware that the Iterator returned might iterate through a very large or /// even infinitely large set of properties. Care should be taken by the caller to not get stuck /// in an infinite loop. This is a "best-effort" list. Not all ELResolvers will return completely /// accurate results, but all must be callable at both design-time and runtime (i.e. whether or /// not Beans.isDesignTime() returns true), without causing errors. The propertyResolved property /// of the ELContext is not relevant to this method. The results of all ELResolvers are /// concatenated in the case of composite resolvers. /// </summary> /// <param name="context"> /// The context of this evaluation. </param> /// <param name="base"> /// The base object whose set of valid properties is to be enumerated, or null to /// enumerate the set of top-level variables that this resolver can evaluate. </param> /// <returns> An Iterator containing zero or more (possibly infinitely more) FeatureDescriptor /// objects, or null if this resolver does not handle the given base object or that the /// results are too complex to represent with this method </returns> public abstract IEnumerator <FeatureDescriptor> getFeatureDescriptors(ELContext context, object @base);
/// <summary> /// Returns information about the set of variables or properties that can be resolved for the /// given base object. One use for this method is to assist tools in auto-completion. The results /// are collected from all component resolvers. The propertyResolved property of the ELContext is /// not relevant to this method. The results of all ELResolvers are concatenated. The Iterator /// returned is an iterator over the collection of FeatureDescriptor objects returned by the /// iterators returned by each component resolver's getFeatureDescriptors method. If null is /// returned by a resolver, it is skipped. /// </summary> /// <param name="context"> /// The context of this evaluation. </param> /// <param name="base"> /// The base object to return the most general property type for, or null to enumerate /// the set of top-level variables that this resolver can evaluate. </param> /// <returns> An Iterator containing zero or more (possibly infinitely more) FeatureDescriptor /// objects, or null if this resolver does not handle the given base object or that the /// results are too complex to represent with this method </returns> //JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: @Override public java.util.Iterator<java.beans.FeatureDescriptor> getFeatureDescriptors(final ELContext context, final Object super) public override IEnumerator <FeatureDescriptor> getFeatureDescriptors(ELContext context, object @base) { return(new IteratorAnonymousInnerClass(this, context, @base)); }
/// <summary> /// For a given base and property, attempts to identify the most general type that is acceptable /// for an object to be passed as the value parameter in a future call to the /// <seealso cref="setValue(ELContext, object, object, object)"/> method. If this resolver handles the /// given (base, property) pair, the propertyResolved property of the ELContext object must be /// set to true by the resolver, before returning. If this property is not true after this method /// is called, the caller should ignore the return value. This is not always the same as /// getValue().getClass(). For example, in the case of an <seealso cref="ArrayELResolver"/>, the getType /// method will return the element type of the array, which might be a superclass of the type of /// the actual element that is currently in the specified array element. /// </summary> /// <param name="context"> /// The context of this evaluation. </param> /// <param name="base"> /// The base object whose property value is to be analyzed, or null to analyze a /// top-level variable. </param> /// <param name="property"> /// The property or variable to return the acceptable type for. </param> /// <returns> If the propertyResolved property of ELContext was set to true, then the most general /// acceptable type; otherwise undefined. </returns> /// <exception cref="java.lang.NullPointerException"> /// if context is null </exception> /// <exception cref="PropertyNotFoundException"> /// if the given (base, property) pair is handled by this ELResolver but the /// specified variable or property does not exist or is not readable. </exception> /// <exception cref="ELException"> /// if an exception was thrown while performing the property or variable resolution. /// The thrown exception must be included as the cause property of this exception, if /// available. </exception> public abstract Type getType(ELContext context, object @base, object property);
/// <summary> /// Parses an expression into a <seealso cref="ValueExpression"/> for later evaluation. Use this method for /// expressions that refer to values. This method should perform syntactic validation of the /// expression. If in doing so it detects errors, it should raise an ELException. /// </summary> /// <param name="context"> /// The EL context used to parse the expression. The FunctionMapper and VariableMapper /// stored in the ELContext are used to resolve functions and variables found in the /// expression. They can be null, in which case functions or variables are not /// supported for this expression. The object returned must invoke the same functions /// and access the same variable mappings regardless of whether the mappings in the /// provided FunctionMapper and VariableMapper instances change between calling /// ExpressionFactory.createValueExpression() and any method on ValueExpression. Note /// that within the EL, the ${} and #{} syntaxes are treated identically. This /// includes the use of VariableMapper and FunctionMapper at expression creation time. /// Each is invoked if not null, independent of whether the #{} or ${} syntax is used /// for the expression. </param> /// <param name="expression"> /// The expression to parse </param> /// <param name="expectedType"> /// The type the result of the expression will be coerced to after evaluation. </param> /// <returns> The parsed expression </returns> /// <exception cref="ELException"> /// Thrown if there are syntactical errors in the provided expression. </exception> /// <exception cref="NullPointerException"> /// if paramTypes is null. </exception> public abstract ValueExpression createValueExpression(ELContext context, string expression, Type expectedType);
/// <summary> /// Evaluates the expression relative to the provided context, and returns the resulting value. /// The resulting value is automatically coerced to the type returned by getExpectedType(), which /// was provided to the ExpressionFactory when this expression was created. /// </summary> /// <param name="context"> /// The context of this evaluation. </param> /// <returns> The result of the expression evaluation. </returns> /// <exception cref="NullPointerException"> /// if context is null. </exception> /// <exception cref="PropertyNotFoundException"> /// if one of the property resolutions failed because a specified variable or /// property does not exist or is not readable. </exception> /// <exception cref="ELException"> /// if an exception was thrown while performing property or variable resolution. The /// thrown exception must be included as the cause property of this exception, if /// available. </exception> public abstract object getValue(ELContext context);