001/*
002 * ============================================================================
003 * Copyright © 2002-2023 by Thomas Thrien.
004 * All Rights Reserved.
005 * ============================================================================
006 *
007 * Licensed to the public under the agreements of the GNU Lesser General Public
008 * License, version 3.0 (the "License"). You may obtain a copy of the License at
009 *
010 *      http://www.gnu.org/licenses/lgpl.html
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
014 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
015 * License for the specific language governing permissions and limitations
016 * under the License.
017 */
018
019package org.tquadrat.foundation.value;
020
021import static org.apiguardian.api.API.Status.STABLE;
022
023import java.math.BigDecimal;
024
025import org.apiguardian.api.API;
026import org.tquadrat.foundation.annotation.ClassVersion;
027import org.tquadrat.foundation.value.api.DimensionedValueStringConverter;
028
029/**
030 *  The implementation of
031 *  {@link org.tquadrat.foundation.lang.StringConverter}
032 *  for
033 *  {@link PressureValue}
034 *  instances.
035 *
036 *  @extauthor Thomas Thrien - thomas.thrien@tquadrat.org
037 *  @version $Id: PressureValueStringConverter.java 1072 2023-09-30 20:44:38Z tquadrat $
038 *  @since 0.1.0
039 *
040 *  @UMLGraph.link
041 */
042@ClassVersion( sourceVersion = "$Id: PressureValueStringConverter.java 1072 2023-09-30 20:44:38Z tquadrat $" )
043@API( status = STABLE, since = "0.1.0" )
044public class PressureValueStringConverter extends DimensionedValueStringConverter<Pressure,PressureValue>
045{
046        /*------------------------*\
047    ====** Static Initialisations **===========================================
048        \*------------------------*/
049    /**
050     *  An instance of this class.
051     */
052    public static final PressureValueStringConverter INSTANCE = new PressureValueStringConverter();
053
054        /*--------------*\
055    ====** Constructors **=====================================================
056        \*--------------*/
057    /**
058     *  Creates a new instance of {@code PressureValueStringConverter}.
059     */
060    public PressureValueStringConverter() { super( PressureValue.class ); }
061
062        /*---------*\
063    ====** Methods **==========================================================
064        \*---------*/
065    /**
066     *  {@inheritDoc}
067     */
068    @Override
069    protected final PressureValue createValue( final BigDecimal number, final Pressure dimension )
070    {
071        return new PressureValue( dimension, number );
072    }   //  createValue()
073
074    /**
075     *  This method is used by the
076     *  {@link java.util.ServiceLoader}
077     *  to obtain the instance for this
078     *  {@link org.tquadrat.foundation.lang.StringConverter}
079     *  implementation.
080     *
081     *  @return The instance for this {@code StringConverter} implementation.
082     */
083    public static final PressureValueStringConverter provider() { return INSTANCE; }
084
085    /**
086     *  {@inheritDoc}
087     */
088    @Override
089    protected Pressure unitFromSymbol( final String symbol )
090    {
091        return Pressure.forUnit( symbol );
092    }   //  unitFromSymbol()
093}
094//  class PressureValueStringConverter
095
096/*
097 *  End of File
098 */