FixedPhoneNumberTranslator.java

package fr.sii.ogham.sms.message.addressing.translator;

import fr.sii.ogham.sms.message.PhoneNumber;
import fr.sii.ogham.sms.message.addressing.AddressedPhoneNumber;
import fr.sii.ogham.sms.message.addressing.NumberingPlanIndicator;
import fr.sii.ogham.sms.message.addressing.TypeOfNumber;

/**
 * Addressing default strategy : TON and NPI will be fixed by the translator
 * 
 * @author cdejonghe
 * 
 */
public class FixedPhoneNumberTranslator implements PhoneNumberTranslator {
	private final TypeOfNumber ton;
	private final NumberingPlanIndicator npi;

	/**
	 * Initializes the translator with the given number, TON and NPI.
	 * 
	 * @param ton
	 *            Type of number
	 * @param npi
	 *            Numbering plan identification
	 */
	public FixedPhoneNumberTranslator(TypeOfNumber ton, NumberingPlanIndicator npi) {
		super();
		this.ton = ton;
		this.npi = npi;
	}

	@Override
	public AddressedPhoneNumber translate(PhoneNumber phoneNumber) {
		return new AddressedPhoneNumber(phoneNumber.getNumber(), ton, npi);
	}

}