package com.cron.utils.model;

import com.cron.utils.CronFieldName;
import com.cron.utils.parser.field.CronField;
import com.google.common.collect.Maps;
import org.apache.commons.lang3.Validate;

import java.util.Collections;
import java.util.List;
import java.util.Map;

/*
 * Copyright 2014 jmrozanec
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
public class Cron {
    private Map<CronFieldName, CronField> fields;

    public Cron(List<CronField> fields){
        this.fields = Maps.newHashMap();
        Validate.notNull(fields, "CronFields cannot be null");
        for(CronField field : fields){
            this.fields.put(field.getField(), field);
        }
    }

    public CronField retrieve(CronFieldName name){
        return fields.get(name);
    }

    public Map<CronFieldName, CronField> retrieveFieldsAsMap(){
        return Collections.unmodifiableMap(fields);
    }
}

@@ -844,16 +844,57 @@
 nse.%0A */
+%0A%0A/**%0A * Represents a cron expression%0A */
 %0Apublic 
@@ -1220,94 +1220,521 @@
     
-public CronField retrieve(CronFieldName name)%7B%0A        return fields.get(name);%0A    %7D%0A
+/**%0A     * Retrieve value for cron field%0A     * @param name - cron field name.%0A     *             If null, a NullPointerException will be raised.%0A     * @return CronField that corresponds to given CronFieldName%0A     */%0A    public CronField retrieve(CronFieldName name)%7B%0A        Validate.notNull(name, %22CronFieldName must not be null%22);%0A        return fields.get(name);%0A    %7D%0A%0A    /**%0A     * Retrieve all cron field values as map%0A     * @return unmodifiable Map%3CCronFieldName, CronField%3E values, never null%0A     */
 %0A   

Add Javadoc for Cron