Skip to content

Commit

Permalink
Fix formatting and copy/paste error
Browse files Browse the repository at this point in the history
  • Loading branch information
markt-asf committed Jun 28, 2023
1 parent 6c8b2d1 commit 91d3d59
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions java/jakarta/el/OptionalELResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,27 @@

/**
* Defines property resolution behaviour on {@link Optional}s.
*
* <p>
* This resolver handles base objects that are instances of {@link Optional}.
*
* <p>
* If the {@link Optional#isEmpty()} is {@code true} for the base object and the property is {@code null} then the
* resulting value is {@code null}.
*
* <p>
* If the {@link Optional#isEmpty()} is {@code true} for the base object and the property is not {@code null} then the
* resulting value is the base object (an empty {@link Optional}).
*
* <p>
* If the {@link Optional#isPresent()} is {@code true} for the base object and the property is {@code null} then the
* resulting value is the result of calling {@link Optional#get()} on the base object.
*
* <p>
* If the {@link Optional#isPresent()} is {@code true} for the base object and the property is not {@code null} then the
* resulting value is the result of calling {@link ELResolver#getValue(ELContext, Object, Object)} using the
* {@link ELResolver} obtained from {@link ELContext#getELResolver()} with the following parameters:
* <ul>
* <li>The {@link ELContext} is the current context</li>
* <li>The base object is the result of calling {@link Optional#get()} on the current base object<li>
* <li>The base object is the result of calling {@link Optional#get()} on the current base object
* <li>
* <li>The property object is the current property object</li>
* </ul>
*
* <p>
* This resolver is always a read-only resolver.
*/
Expand Down Expand Up @@ -77,9 +72,9 @@ public Object getValue(ELContext context, Object base, Object property) {
return null;
}


/**
* {@inheritDoc}
*
* <p>
* If the base object is an {@link Optional} this method always returns {@code null} since instances of this
* resolver are always read-only.
Expand All @@ -95,9 +90,9 @@ public Class<?> getType(ELContext context, Object base, Object property) {
return null;
}


/**
* {@inheritDoc}
*
* <p>
* If the base object is an {@link Optional} this method always throws a {@link PropertyNotWritableException} since
* instances of this resolver are always read-only.
Expand All @@ -112,9 +107,9 @@ public void setValue(ELContext context, Object base, Object property, Object val
}
}


/**
* {@inheritDoc}
*
* <p>
* If the base object is an {@link Optional} this method always returns {@code true} since instances of this
* resolver are always read-only.
Expand All @@ -131,9 +126,9 @@ public boolean isReadOnly(ELContext context, Object base, Object property) {
return false;
}


/**
* {@inheritDoc}
*
* <p>
* If the base object is an {@link Optional} this method always returns {@code Object.class}.
*/
Expand All @@ -146,6 +141,7 @@ public Class<?> getCommonPropertyType(ELContext context, Object base) {
return null;
}


@Override
public <T> T convertToType(ELContext context, Object obj, Class<T> type) {
Objects.requireNonNull(context);
Expand All @@ -168,8 +164,8 @@ public <T> T convertToType(ELContext context, Object obj, Class<T> type) {
return result;
} catch (ELException e) {
/*
* TODO: This isn't pretty but it works. Significant refactoring would be required to avoid the
* exception. See also OptionalELResolver.convertToType().
* TODO: This isn't pretty but it works. Significant refactoring would be required to avoid the
* exception. See also Util.isCoercibleFrom().
*/
}
} else {
Expand Down

0 comments on commit 91d3d59

Please sign in to comment.