Skip to content

Commit

Permalink
Remove deprecated getFeatureDescriptors() method
Browse files Browse the repository at this point in the history
  • Loading branch information
markt-asf committed Oct 13, 2022
1 parent de32480 commit a0df903
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 449 deletions.
21 changes: 0 additions & 21 deletions api/src/main/java/jakarta/el/ArrayELResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@

package jakarta.el;

import java.beans.FeatureDescriptor;
import java.lang.reflect.Array;
import java.util.Iterator;

/**
* Defines property resolution behavior on arrays.
Expand Down Expand Up @@ -252,25 +250,6 @@ public boolean isReadOnly(ELContext context, Object base, Object property) {
return isReadOnly;
}

/**
* Always returns <code>null</code>, since there is no reason to iterate through set set of all integers.
*
* <p>
* The {@link #getCommonPropertyType} method returns sufficient information about what properties this resolver accepts.
* </p>
*
* @param context The context of this evaluation.
* @param base The array to analyze. Only bases that are a Java language array are handled by this resolver.
* @return <code>null</code>.
*
* @deprecated This method will be removed without replacement in EL 6.0
*/
@Deprecated(forRemoval = true, since = "5.0")
@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
return null;
}

/**
* If the base object is a Java language array, returns the most general type that this resolver accepts for the
* <code>property</code> argument. Otherwise, returns <code>null</code>.
Expand Down
55 changes: 0 additions & 55 deletions api/src/main/java/jakarta/el/BeanELResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,17 @@

package jakarta.el;

import static java.lang.Boolean.TRUE;
import static jakarta.el.ELUtil.getExceptionMessageString;

import java.beans.BeanInfo;
import java.beans.FeatureDescriptor;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.SoftReference;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

Expand Down Expand Up @@ -538,57 +534,6 @@ public boolean isReadOnly(ELContext context, Object base, Object property) {
return getBeanProperty(context, base, property).isReadOnly(base);
}

/**
* If the base object is not <code>null</code>, returns an <code>Iterator</code> containing the set of JavaBeans
* properties available on the given object. Otherwise, returns <code>null</code>.
*
* <p>
* The <code>Iterator</code> returned must contain zero or more instances of {@link java.beans.FeatureDescriptor}. Each
* info object contains information about a property in the bean, as obtained by calling the
* <code>BeanInfo.getPropertyDescriptors</code> method. The <code>FeatureDescriptor</code> is initialized using the same
* fields as are present in the <code>PropertyDescriptor</code>, with the additional required named attributes
* "<code>type</code>" and "<code>resolvableAtDesignTime</code>" set as follows:
* <ul>
* <li>{@link ELResolver#TYPE} - The runtime type of the property, from
* <code>PropertyDescriptor.getPropertyType()</code>.</li>
* <li>{@link ELResolver#RESOLVABLE_AT_DESIGN_TIME} - <code>true</code>.</li>
* </ul>
*
*
* @param context The context of this evaluation.
* @param base The bean to analyze.
* @return An <code>Iterator</code> containing zero or more <code>FeatureDescriptor</code> objects, each representing a
* property on this bean, or <code>null</code> if the <code>base</code> object is <code>null</code>.
*
* @deprecated This method will be removed without replacement in EL 6.0
*/
@Deprecated(forRemoval = true, since = "5.0")
@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
if (base == null) {
return null;
}

BeanInfo info = null;
try {
info = Introspector.getBeanInfo(base.getClass());
} catch (Exception ex) {
}

if (info == null) {
return null;
}

ArrayList<FeatureDescriptor> featureDescriptors = new ArrayList<>(info.getPropertyDescriptors().length);
for (PropertyDescriptor propertyDescriptor : info.getPropertyDescriptors()) {
propertyDescriptor.setValue("type", propertyDescriptor.getPropertyType());
propertyDescriptor.setValue("resolvableAtDesignTime", TRUE);
featureDescriptors.add(propertyDescriptor);
}

return featureDescriptors.iterator();
}

/**
* If the base object is not <code>null</code>, returns the most general type that this resolver accepts for the
* <code>property</code> argument. Otherwise, returns <code>null</code>.
Expand Down
18 changes: 0 additions & 18 deletions api/src/main/java/jakarta/el/BeanNameELResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@

package jakarta.el;

import java.beans.FeatureDescriptor;
import java.util.Iterator;

/**
* <p>
* An <code>ELResolver</code> for resolving user or container managed beans.
Expand Down Expand Up @@ -204,21 +201,6 @@ public boolean isReadOnly(ELContext context, Object base, Object property) {
return false;
}

/**
* Always returns <code>null</code>, since there is no reason to iterate through a list of one element: bean name.
*
* @param context The context of this evaluation.
* @param base <code>null</code>.
* @return <code>null</code>.
*
* @deprecated This method will be removed without replacement in EL 6.0
*/
@Deprecated(forRemoval = true, since = "5.0")
@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
return null;
}

/**
* Always returns <code>String.class</code>, since a bean name is a String.
*
Expand Down
90 changes: 0 additions & 90 deletions api/src/main/java/jakarta/el/CompositeELResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@

package jakarta.el;

import java.beans.FeatureDescriptor;
import java.util.Iterator;

/**
* Maintains an ordered composite list of child <code>ELResolver</code>s.
*
Expand Down Expand Up @@ -383,37 +380,6 @@ public boolean isReadOnly(ELContext context, Object base, Object property) {
return false; // Does not matter
}

/**
* Returns information about the set of variables or properties that can be resolved for the given <code>base</code>
* object. One use for this method is to assist tools in auto-completion. The results are collected from all component
* resolvers.
*
* <p>
* The <code>propertyResolved</code> property of the <code>ELContext</code> is not relevant to this method. The results
* of all <code>ELResolver</code>s are concatenated.
* </p>
*
* <p>
* The <code>Iterator</code> returned is an iterator over the collection of <code>FeatureDescriptor</code> objects
* returned by the iterators returned by each component resolver's <code>getFeatureDescriptors</code> method. If
* <code>null</code> is returned by a resolver, it is skipped.
* </p>
*
* @param context The context of this evaluation.
* @param base The base object whose set of valid properties is to be enumerated, or <code>null</code> to enumerate the
* set of top-level variables that this resolver can evaluate.
* @return An <code>Iterator</code> containing zero or more (possibly infinitely more) <code>FeatureDescriptor</code>
* objects, or <code>null</code> if this resolver does not handle the given <code>base</code> object or that the results
* are too complex to represent with this method
*
* @deprecated This method will be removed with replacement in EL 6.0
*/
@Deprecated(forRemoval = true, since = "5.0")
@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
return new CompositeIterator(elResolvers, size, context, base);
}

/**
* Returns the most general type that this resolver accepts for the <code>property</code> argument, given a
* <code>base</code> object. One use for this method is to assist tools in auto-completion. The result is obtained by
Expand Down Expand Up @@ -488,60 +454,4 @@ public <T> T convertToType(ELContext context, Object obj, Class<T> targetType) {

private ELResolver[] elResolvers;
private int size;

/**
* @deprecated This method will be removed without replacement in EL 6.0
*/
@Deprecated(forRemoval = true, since = "5.0")
private static class CompositeIterator implements Iterator<FeatureDescriptor> {

ELResolver[] resolvers;
int size;
int index = 0;
Iterator<FeatureDescriptor> propertyIter = null;
ELContext context;
Object base;

CompositeIterator(ELResolver[] resolvers, int size, ELContext context, Object base) {
this.resolvers = resolvers;
this.size = size;
this.context = context;
this.base = base;
}

@Override
public boolean hasNext() {
if (propertyIter == null || !propertyIter.hasNext()) {
while (index < size) {
ELResolver elResolver = resolvers[index++];
propertyIter = elResolver.getFeatureDescriptors(context, base);
if (propertyIter != null) {
return propertyIter.hasNext();
}
}
return false;
}
return propertyIter.hasNext();
}

@Override
public FeatureDescriptor next() {
if (propertyIter == null || !propertyIter.hasNext()) {
while (index < size) {
ELResolver elResolver = resolvers[index++];
propertyIter = elResolver.getFeatureDescriptors(context, base);
if (propertyIter != null) {
return propertyIter.next();
}
}
return null;
}
return propertyIter.next();
}

@Override
public void remove() {
throw new UnsupportedOperationException();
}
}
}
79 changes: 0 additions & 79 deletions api/src/main/java/jakarta/el/ELResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@

package jakarta.el;

import java.beans.FeatureDescriptor;
import java.util.Iterator;

/**
* Enables customization of variable, property, method call, and type conversion resolution behavior for Jakarta
* Expression Language expression evaluation.
Expand Down Expand Up @@ -91,20 +88,6 @@
*/
public abstract class ELResolver {

// --------------------------------------------------------- Constants

/**
* The attribute name of the named attribute in the <code>FeatureDescriptor</code> that specifies the runtime type of
* the variable or property.
*/
public static final String TYPE = "type";

/**
* The attribute name of the named attribute in the <code>FeatureDescriptor</code> that specifies whether the variable
* or property can be resolved at runtime.
*/
public static final String RESOLVABLE_AT_DESIGN_TIME = "resolvableAtDesignTime";

/**
* Attempts to resolve the given <code>property</code> object on the given <code>base</code> object.
*
Expand Down Expand Up @@ -246,68 +229,6 @@ public Object invoke(ELContext context, Object base, Object method, Class<?>[] p
*/
public abstract boolean isReadOnly(ELContext context, Object base, Object property);

/**
* Returns information about the set of variables or properties that can be resolved for the given <code>base</code>
* object. One use for this method is to assist tools in auto-completion.
*
* <p>
* If the <code>base</code> parameter is <code>null</code>, the resolver must enumerate the list of top-level variables
* it can resolve.
* </p>
*
* <p>
* The <code>Iterator</code> returned must contain zero or more instances of {@link java.beans.FeatureDescriptor}, in no
* guaranteed order. In the case of primitive types such as <code>int</code>, the value <code>null</code> must be
* returned. This is to prevent the useless iteration through all possible primitive values. A return value of
* <code>null</code> indicates that this resolver does not handle the given <code>base</code> object or that the results
* are too complex to represent with this method and the {@link #getCommonPropertyType} method should be used instead.
* </p>
*
* <p>
* Each <code>FeatureDescriptor</code> will contain information about a single variable or property. In addition to the
* standard properties, the <code>FeatureDescriptor</code> must have two named attributes (as set by the
* <code>setValue</code> method):
* <ul>
* <li>{@link #TYPE} - The value of this named attribute must be an instance of <code>java.lang.Class</code> and specify
* the runtime type of the variable or property.</li>
* <li>{@link #RESOLVABLE_AT_DESIGN_TIME} - The value of this named attribute must be an instance of
* <code>java.lang.Boolean</code> and indicates whether it is safe to attempt to resolve this property at design-time.
* For instance, it may be unsafe to attempt a resolution at design time if the <code>ELResolver</code> needs access to
* a resource that is only available at runtime and no acceptable simulated value can be provided.</li>
* </ul>
*
* <p>
* The caller should be aware that the <code>Iterator</code> 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.
*
* <p>
* This is a "best-effort" list. Not all <code>ELResolver</code>s will return completely accurate results, but all must
* be callable at both design-time and runtime (i.e. whether or not <code>Beans.isDesignTime()</code> returns
* <code>true</code>), without causing errors.
*
* <p>
* The <code>propertyResolved</code> property of the <code>ELContext</code> is not relevant to this method. The results
* of all <code>ELResolver</code>s are concatenated in the case of composite resolvers.
*
* <p>
* The default implementation in {@link ELResolver} returns {@code null}. Sub-classes may wish to over-ride this
* method.
*
* @param context The context of this evaluation.
* @param base The base object whose set of valid properties is to be enumerated, or <code>null</code> to enumerate the
* set of top-level variables that this resolver can evaluate.
* @return An <code>Iterator</code> containing zero or more (possibly infinitely more) <code>FeatureDescriptor</code>
* objects, or <code>null</code> if this resolver does not handle the given <code>base</code> object or that the results
* are too complex to represent with this method
* @see java.beans.FeatureDescriptor
*
* @deprecated This method will be removed without replacement in EL 6.0
*/
@Deprecated(forRemoval = true, since = "5.0")
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
return null;
}

/**
* Returns the most general type that this resolver accepts for the <code>property</code> argument, given a
* <code>base</code> object. One use for this method is to assist tools in auto-completion.
Expand Down
21 changes: 0 additions & 21 deletions api/src/main/java/jakarta/el/ListELResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@

package jakarta.el;

import java.beans.FeatureDescriptor;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

/**
Expand Down Expand Up @@ -287,25 +285,6 @@ public boolean isReadOnly(ELContext context, Object base, Object property) {
return false;
}

/**
* Always returns <code>null</code>, since there is no reason to iterate through set set of all integers.
*
* <p>
* The {@link #getCommonPropertyType} method returns sufficient information about what properties this resolver accepts.
* </p>
*
* @param context The context of this evaluation.
* @param base The list. Only bases of type <code>List</code> are handled by this resolver.
* @return <code>null</code>.
*
* @deprecated This method will be removed without replacement in EL 6.0
*/
@Deprecated(forRemoval = true, since = "5.0")
@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
return null;
}

/**
* If the base object is a list, returns the most general type that this resolver accepts for the <code>property</code>
* argument. Otherwise, returns <code>null</code>.
Expand Down
Loading

0 comments on commit a0df903

Please sign in to comment.