class ItemFactory implements IItemFactory {

    @Override
    public ItemRef createNewItemRef(final String name,
    								final String alias,
    								final String description,
    								final String required,
    								final String reference) throws APIRestGeneratorException
    {
    	ItemRef itemRef = null ;
    	
    	final Pattern pattern = Pattern.compile(ConstantsInput.PATT_DEFINITION_REF) ;
		final Matcher matcher = pattern.matcher(reference) ;
		if (matcher.matches())
		{
			final String itemRefString = matcher.group(1) ;
			if (!this.mainItemsMap.containsKey(itemRefString))
			{
				final String errorString = "The following reference was not found in the items map: " + itemRefString ;
				
				ItemFactory.LOGGER.error(errorString) ;
		    	throw new APIRestGeneratorException(errorString) ;
			}
			
			itemRef = new ItemRef(name, alias, description, required, itemRefString) ;
		}
		else
		{
			final String errorString = "The following reference was not defined properly to be search in the items map: " + reference ;
			
			ItemFactory.LOGGER.error(errorString) ;
	    	throw new APIRestGeneratorException(errorString) ;
		}
    	
    	return itemRef ;
    }

    public  ItemFactory(final Map<String, Item> mainItemsMap);

}