You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tamaya.apache.org by Anatole Tresch <at...@gmail.com> on 2017/02/26 11:13:46 UTC

Removing getOrdinal() from PropertySource

Hi all

as discussed in out latest hangout we can remove the* int geOrdinal()*
method from *PropertySource* and replace it with a more sophisticated logic
in the Comparator, which orders the Property sources detected
automatically. The folloiwng Javadoc
summarizes what the adapted comparator implementation actually does:

/**
 * Evaluates an ordinal value from a {@link PropertySource}, Herey the
ordinal of type {@code int}
 * is evaluated as follows:
 * <ol>
 *     <li>It evaluates the {@code String} value for {@link
PropertySource#TAMAYA_ORDINAL} and tries
 *     to convert it to an {@code int} value, using {@link
Integer#parseInt(String)}.</li>
 *     <li>It tries to find and evaluate a method {@code int getOrdinal()}</li>.
 *     <li>It tries to find and evaluate a static field {@code int
ORDINAL}.</li>
 *     <li>It tries to find an d evaluate a class level {@link
Priority} annotation.</li>
 *     <li>It uses the default priority ({@code 0}.</li>
 * </ol>
 * @param propertySource the property source, not null.
 * @return the ordinal value to compare the property source.
 */


   - ​For clients* using Tamaya there is no effect or change*.
   - For *clients implementing there own PropertySource i*mplementations,
   there is only an effect, if *@Override* is on the implemented*
   getOrdinal() *method, it must be *removed*, when recompiling.


Please drop your thinkings on the strategy outlined above. Should we omit
some of the steps mentioned in the Javadoc, or are your fine with it.
Should something improved?

J Anatole

​



-- 
*Anatole Tresch*
PPMC Member Apache Tamaya
JCP Star Spec Lead
*Switzerland, Europe Zurich, GMT+1*
*maketechsimple.wordpress.com <http://maketechsimple.wordpress.com/> *
*Twitter:  @atsticks, @tamayaconf*