package com.cron.utils.model;

import com.cron.utils.CronFieldName;
import com.cron.utils.parser.field.FieldConstraints;
import org.apache.commons.lang3.Validate;

import java.util.Comparator;

/*
 * 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 FieldDefinition {
    private CronFieldName fieldName;
    private FieldConstraints constraints;

    public FieldDefinition(CronFieldName fieldName, FieldConstraints constraints){
        this.fieldName = Validate.notNull(fieldName, "CronFieldName must not be null");
        this.constraints = Validate.notNull(constraints, "FieldConstraints must not be null");
    }

    public CronFieldName getFieldName() {
        return fieldName;
    }

    public FieldConstraints getConstraints() {
        return constraints;
    }

    public static Comparator<FieldDefinition> createFieldDefinitionComparator() {
        return new Comparator<FieldDefinition>() {
            @Override
            public int compare(FieldDefinition o1, FieldDefinition o2) {
                return o1.getFieldName().getOrder() - o2.getFieldName().getOrder();
            }
        };
    }
}

@@ -766,16 +766,88 @@
 nse.%0A */
+%0A%0A/**%0A * Represents a definition of allowed values for a cron field.%0A */
 %0Apublic 
@@ -958,433 +958,1095 @@
     
-public FieldDefinition(CronFieldName fieldName, FieldConstraints constraints)%7B%0A        this.fieldName = Validate.notNull(fieldName, %22CronFieldName must not be null%22);%0A        this.constraints = Validate.notNull(constraints, %22FieldConstraints must not be null%22);%0A    %7D%0A%0A    public CronFieldName getFieldName() %7B%0A        return fieldName;%0A    %7D%0A%0A    public FieldConstraints getConstraints() %7B%0A        return constraints;%0A    %7D%0A
+/**%0A     * Constructor%0A     * @param fieldName - CronFieldName; name of the field%0A     *                  if null, a NullPointerException will be raised.%0A     * @param constraints - FieldConstraints, constraints;%0A     *                    if null, a NullPointerException will be raised.%0A     */%0A    public FieldDefinition(CronFieldName fieldName, FieldConstraints constraints)%7B%0A        this.fieldName = Validate.notNull(fieldName, %22CronFieldName must not be null%22);%0A        this.constraints = Validate.notNull(constraints, %22FieldConstraints must not be null%22);%0A    %7D%0A%0A    /**%0A     * Retrieve field name%0A     * @return CronFieldName instance, never null;%0A     */%0A    public CronFieldName getFieldName() %7B%0A        return fieldName;%0A    %7D%0A%0A    /**%0A     * Get field constraints%0A     * @return FieldConstraints instance, never null;%0A     */%0A    public FieldConstraints getConstraints() %7B%0A        return constraints;%0A    %7D%0A%0A    /**%0A     * Creates a field definition comparator. Will compare by CronFieldName order value;%0A     * @return Comparator%3CFieldDefinition%3E instance, never null;%0A     */
 %0A   

Add Javadoc for FieldDefinition