// Path: src/com/nvinayshetty/DTOnator/NameConventionCommands/ClassName/ClassNameOptions.java
// public enum ClassNameOptions {
//     Bean("Bean"),Entity("Entity"),None("None");
// 
//     private String bean;
// 
//     ClassNameOptions(String bean) {
//         this.bean = bean;
//     }
// 
//     public String getName() {
//         return bean;
//     }
// }
// 
// Path: src/com/nvinayshetty/DTOnator/NameConventionCommands/FieldNameParser.java
// public class FieldNameParser {
//     HashSet<NameParserCommand> nameParserCommands;
// 
//     public FieldNameParser(HashSet<NameParserCommand> nameParserCommands) {
//         this.nameParserCommands = nameParserCommands;
//     }
// 
//     public String parseField(String field) {
//         if (nameParserCommands == null)
//             return field;
//         String parsedFieldName = field;//= field;
//         Iterator<NameParserCommand> fieldParserIterator = nameParserCommands.iterator();
//         while (fieldParserIterator.hasNext()) {
//             NameParserCommand parser = fieldParserIterator.next();
//             parsedFieldName = parser.parseFieldName(parsedFieldName);
//         }
//         return parsedFieldName;
//     }
// 
//     public String undo(String fieldName) {
//         if (nameParserCommands == null)
//             return fieldName;
//         String unparsed = fieldName;//= field;
//         Iterator<NameParserCommand> fieldParserIterator = nameParserCommands.iterator();
//         while (fieldParserIterator.hasNext()) {
//             NameParserCommand parser = fieldParserIterator.next();
//             unparsed = parser.undoParsing(unparsed);
//         }
//         return unparsed;
//     }
// }
// 
// Path: src/com/nvinayshetty/DTOnator/Utility/DtoHelper.java
// public class DtoHelper {
//     public static String firstetterToUpperCase(String key) {
//         return key.substring(0, 1).toUpperCase() + key.substring(1);
//     }
// 
//     public static String firstetterToLowerCase(String key) {
//         return key.substring(0, 1).toLowerCase() + key.substring(1);
//     }
// }


import com.nvinayshetty.DTOnator.FieldCreator.AccessModifier;
import com.nvinayshetty.DTOnator.NameConventionCommands.ClassName.ClassNameOptions;
import com.nvinayshetty.DTOnator.NameConventionCommands.FieldNameParser;
import com.nvinayshetty.DTOnator.Utility.DtoHelper;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
/*
 * Copyright (C) 2015 Vinaya Prasad N
 *
 *         This program is free software: you can redistribute it and/or modify
 *         it under the terms of the GNU General Public License as published by
 *         the Free Software Foundation, either version 3 of the License, or
 *         (at your option) any later version.
 *
 *         This program is distributed in the hope that it will be useful,
 *         but WITHOUT ANY WARRANTY; without even the implied warranty of
 *         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *         GNU General Public License for more details.
 *
 *         You should have received a copy of the GNU General Public License
 *         along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.nvinayshetty.DTOnator.FieldRepresentors;




/**
 * Created by vinay on 12/7/15.
 */
public class JsonObjectRepresentor extends FieldRepresentor {
    FieldNameParser nameParser;
    private ClassNameOptions classNameOptions;

    @Override
    public String getFieldRepresentationFor(AccessModifier accessModifier, String key) {
        String fieldName = getSimpleNameForObject(accessModifier, key);
        return fieldName;

    }

    @NotNull
    private String getSimpleNameForObject(AccessModifier accessModifier, String key) {
        String Object = key;
        if (nameParser != null)
            Object = nameParser.undo(key);
// Path: src/com/nvinayshetty/DTOnator/NameConventionCommands/ClassName/ClassNameOptions.java
// public enum ClassNameOptions {
//     Bean("Bean"),Entity("Entity"),None("None");
// 
//     private String bean;
// 
//     ClassNameOptions(String bean) {
//         this.bean = bean;
//     }
// 
//     public String getName() {
//         return bean;
//     }
// }
// 
// Path: src/com/nvinayshetty/DTOnator/NameConventionCommands/FieldNameParser.java
// public class FieldNameParser {
//     HashSet<NameParserCommand> nameParserCommands;
// 
//     public FieldNameParser(HashSet<NameParserCommand> nameParserCommands) {
//         this.nameParserCommands = nameParserCommands;
//     }
// 
//     public String parseField(String field) {
//         if (nameParserCommands == null)
//             return field;
//         String parsedFieldName = field;//= field;
//         Iterator<NameParserCommand> fieldParserIterator = nameParserCommands.iterator();
//         while (fieldParserIterator.hasNext()) {
//             NameParserCommand parser = fieldParserIterator.next();
//             parsedFieldName = parser.parseFieldName(parsedFieldName);
//         }
//         return parsedFieldName;
//     }
// 
//     public String undo(String fieldName) {
//         if (nameParserCommands == null)
//             return fieldName;
//         String unparsed = fieldName;//= field;
//         Iterator<NameParserCommand> fieldParserIterator = nameParserCommands.iterator();
//         while (fieldParserIterator.hasNext()) {
//             NameParserCommand parser = fieldParserIterator.next();
//             unparsed = parser.undoParsing(unparsed);
//         }
//         return unparsed;
//     }
// }
// 
// Path: src/com/nvinayshetty/DTOnator/Utility/DtoHelper.java
// public class DtoHelper {
//     public static String firstetterToUpperCase(String key) {
//         return key.substring(0, 1).toUpperCase() + key.substring(1);
//     }
// 
//     public static String firstetterToLowerCase(String key) {
//         return key.substring(0, 1).toLowerCase() + key.substring(1);
//     }
// }


// Path: src/com/nvinayshetty/DTOnator/FieldRepresentors/JsonObjectRepresentor.java
import com.nvinayshetty.DTOnator.FieldCreator.AccessModifier;
import com.nvinayshetty.DTOnator.NameConventionCommands.ClassName.ClassNameOptions;
import com.nvinayshetty.DTOnator.NameConventionCommands.FieldNameParser;
import com.nvinayshetty.DTOnator.Utility.DtoHelper;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;

/*
 * Copyright (C) 2015 Vinaya Prasad N
 *
 *         This program is free software: you can redistribute it and/or modify
 *         it under the terms of the GNU General Public License as published by
 *         the Free Software Foundation, either version 3 of the License, or
 *         (at your option) any later version.
 *
 *         This program is distributed in the hope that it will be useful,
 *         but WITHOUT ANY WARRANTY; without even the implied warranty of
 *         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *         GNU General Public License for more details.
 *
 *         You should have received a copy of the GNU General Public License
 *         along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.nvinayshetty.DTOnator.FieldRepresentors;




/**
 * Created by vinay on 12/7/15.
 */
public class JsonObjectRepresentor extends FieldRepresentor {
    FieldNameParser nameParser;
    private ClassNameOptions classNameOptions;

    @Override
    public String getFieldRepresentationFor(AccessModifier accessModifier, String key) {
        String fieldName = getSimpleNameForObject(accessModifier, key);
        return fieldName;

    }

    @NotNull
    private String getSimpleNameForObject(AccessModifier accessModifier, String key) {
        String Object = key;
        if (nameParser != null)
            Object = nameParser.undo(key);
        String clasNameOption = (classNameOptions != null) ? classNameOptions.getName() : "";