You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2008/11/24 00:31:44 UTC
svn commit: r720068 - /tomcat/trunk/java/javax/el/CompositeELResolver.java
Author: markt
Date: Sun Nov 23 15:31:43 2008
New Revision: 720068
URL: http://svn.apache.org/viewvc?rev=720068&view=rev
Log:
Tab police
Modified:
tomcat/trunk/java/javax/el/CompositeELResolver.java
Modified: tomcat/trunk/java/javax/el/CompositeELResolver.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/el/CompositeELResolver.java?rev=720068&r1=720067&r2=720068&view=diff
==============================================================================
--- tomcat/trunk/java/javax/el/CompositeELResolver.java (original)
+++ tomcat/trunk/java/javax/el/CompositeELResolver.java Sun Nov 23 15:31:43 2008
@@ -22,155 +22,155 @@
public class CompositeELResolver extends ELResolver {
- private int size;
+ private int size;
- private ELResolver[] resolvers;
+ private ELResolver[] resolvers;
- public CompositeELResolver() {
- this.size = 0;
- this.resolvers = new ELResolver[2];
- }
-
- public void add(ELResolver elResolver) {
- if (elResolver == null) {
- throw new NullPointerException();
- }
-
- if (this.size >= this.resolvers.length) {
- ELResolver[] nr = new ELResolver[this.size * 2];
- System.arraycopy(this.resolvers, 0, nr, 0, this.size);
- this.resolvers = nr;
- }
- this.resolvers[this.size++] = elResolver;
- }
-
- public Object getValue(ELContext context, Object base, Object property)
- throws NullPointerException, PropertyNotFoundException, ELException {
- context.setPropertyResolved(false);
- int sz = this.size;
- Object result = null;
- for (int i = 0; i < sz; i++) {
- result = this.resolvers[i].getValue(context, base, property);
- if (context.isPropertyResolved()) {
- return result;
- }
- }
- return null;
- }
-
- public void setValue(ELContext context, Object base, Object property,
- Object value) throws NullPointerException,
- PropertyNotFoundException, PropertyNotWritableException,
- ELException {
- context.setPropertyResolved(false);
- int sz = this.size;
- for (int i = 0; i < sz; i++) {
- this.resolvers[i].setValue(context, base, property, value);
- if (context.isPropertyResolved()) {
- return;
- }
- }
- }
-
- public boolean isReadOnly(ELContext context, Object base, Object property)
- throws NullPointerException, PropertyNotFoundException, ELException {
- context.setPropertyResolved(false);
- int sz = this.size;
- boolean readOnly = false;
- for (int i = 0; i < sz; i++) {
- readOnly = this.resolvers[i].isReadOnly(context, base, property);
- if (context.isPropertyResolved()) {
- return readOnly;
- }
- }
- return false;
- }
-
- public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
- return new FeatureIterator(context, base, this.resolvers, this.size);
- }
-
- public Class<?> getCommonPropertyType(ELContext context, Object base) {
- int sz = this.size;
- Class<?> commonType = null, type = null;
- for (int i = 0; i < sz; i++) {
- type = this.resolvers[i].getCommonPropertyType(context, base);
- if (type != null
- && (commonType == null || commonType.isAssignableFrom(type))) {
- commonType = type;
- }
- }
- return commonType;
- }
-
- public Class<?> getType(ELContext context, Object base, Object property)
- throws NullPointerException, PropertyNotFoundException, ELException {
- context.setPropertyResolved(false);
- int sz = this.size;
- Class<?> type;
- for (int i = 0; i < sz; i++) {
- type = this.resolvers[i].getType(context, base, property);
- if (context.isPropertyResolved()) {
- return type;
- }
- }
- return null;
- }
-
- private final static class FeatureIterator implements Iterator<FeatureDescriptor> {
-
- private final ELContext context;
-
- private final Object base;
-
- private final ELResolver[] resolvers;
-
- private final int size;
-
- private Iterator itr;
-
- private int idx;
-
- public FeatureIterator(ELContext context, Object base,
- ELResolver[] resolvers, int size) {
- this.context = context;
- this.base = base;
- this.resolvers = resolvers;
- this.size = size;
-
- this.idx = 0;
- this.guaranteeIterator();
- }
-
- private void guaranteeIterator() {
- while (this.itr == null && this.idx < this.size) {
- this.itr = this.resolvers[this.idx].getFeatureDescriptors(
- this.context, this.base);
- this.idx++;
- }
- }
-
- public boolean hasNext() {
- return this.itr != null;
- }
-
- public FeatureDescriptor next() {
- Object result = null;
- if (this.itr != null) {
- if (this.itr.hasNext()) {
- result = this.itr.next();
- if (!this.itr.hasNext()) {
- this.itr = null;
- this.guaranteeIterator();
- }
- }
- }
- return (FeatureDescriptor) result;
- }
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
- }
+ public CompositeELResolver() {
+ this.size = 0;
+ this.resolvers = new ELResolver[2];
+ }
+
+ public void add(ELResolver elResolver) {
+ if (elResolver == null) {
+ throw new NullPointerException();
+ }
+
+ if (this.size >= this.resolvers.length) {
+ ELResolver[] nr = new ELResolver[this.size * 2];
+ System.arraycopy(this.resolvers, 0, nr, 0, this.size);
+ this.resolvers = nr;
+ }
+ this.resolvers[this.size++] = elResolver;
+ }
+
+ public Object getValue(ELContext context, Object base, Object property)
+ throws NullPointerException, PropertyNotFoundException, ELException {
+ context.setPropertyResolved(false);
+ int sz = this.size;
+ Object result = null;
+ for (int i = 0; i < sz; i++) {
+ result = this.resolvers[i].getValue(context, base, property);
+ if (context.isPropertyResolved()) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ public void setValue(ELContext context, Object base, Object property,
+ Object value) throws NullPointerException,
+ PropertyNotFoundException, PropertyNotWritableException,
+ ELException {
+ context.setPropertyResolved(false);
+ int sz = this.size;
+ for (int i = 0; i < sz; i++) {
+ this.resolvers[i].setValue(context, base, property, value);
+ if (context.isPropertyResolved()) {
+ return;
+ }
+ }
+ }
+
+ public boolean isReadOnly(ELContext context, Object base, Object property)
+ throws NullPointerException, PropertyNotFoundException, ELException {
+ context.setPropertyResolved(false);
+ int sz = this.size;
+ boolean readOnly = false;
+ for (int i = 0; i < sz; i++) {
+ readOnly = this.resolvers[i].isReadOnly(context, base, property);
+ if (context.isPropertyResolved()) {
+ return readOnly;
+ }
+ }
+ return false;
+ }
+
+ public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
+ return new FeatureIterator(context, base, this.resolvers, this.size);
+ }
+
+ public Class<?> getCommonPropertyType(ELContext context, Object base) {
+ int sz = this.size;
+ Class<?> commonType = null, type = null;
+ for (int i = 0; i < sz; i++) {
+ type = this.resolvers[i].getCommonPropertyType(context, base);
+ if (type != null
+ && (commonType == null || commonType.isAssignableFrom(type))) {
+ commonType = type;
+ }
+ }
+ return commonType;
+ }
+
+ public Class<?> getType(ELContext context, Object base, Object property)
+ throws NullPointerException, PropertyNotFoundException, ELException {
+ context.setPropertyResolved(false);
+ int sz = this.size;
+ Class<?> type;
+ for (int i = 0; i < sz; i++) {
+ type = this.resolvers[i].getType(context, base, property);
+ if (context.isPropertyResolved()) {
+ return type;
+ }
+ }
+ return null;
+ }
+
+ private final static class FeatureIterator implements Iterator<FeatureDescriptor> {
+
+ private final ELContext context;
+
+ private final Object base;
+
+ private final ELResolver[] resolvers;
+
+ private final int size;
+
+ private Iterator itr;
+
+ private int idx;
+
+ public FeatureIterator(ELContext context, Object base,
+ ELResolver[] resolvers, int size) {
+ this.context = context;
+ this.base = base;
+ this.resolvers = resolvers;
+ this.size = size;
+
+ this.idx = 0;
+ this.guaranteeIterator();
+ }
+
+ private void guaranteeIterator() {
+ while (this.itr == null && this.idx < this.size) {
+ this.itr = this.resolvers[this.idx].getFeatureDescriptors(
+ this.context, this.base);
+ this.idx++;
+ }
+ }
+
+ public boolean hasNext() {
+ return this.itr != null;
+ }
+
+ public FeatureDescriptor next() {
+ Object result = null;
+ if (this.itr != null) {
+ if (this.itr.hasNext()) {
+ result = this.itr.next();
+ if (!this.itr.hasNext()) {
+ this.itr = null;
+ this.guaranteeIterator();
+ }
+ }
+ }
+ return (FeatureDescriptor) result;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org