Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arrays of Primitives Create New Classes #1

Open
dlvenable opened this issue Jun 29, 2012 · 0 comments
Open

Arrays of Primitives Create New Classes #1

dlvenable opened this issue Jun 29, 2012 · 0 comments

Comments

@dlvenable
Copy link

Running the cm tool on a JSON document with arrays of primitives, including strings, produced a new class for each primitive. It should generate code which uses those primitives as it does with scalar values.

Here is an example input:

{
   "bunchOfStrings": [
       "hello", "world"
   ],
   "listOfNumbers": [
       2, 4, 6
   ],
   "someBooleans": [
       true, true, false, false, true
   ],
   "howAboutDoubles": [
       3.1415, 2.718
   ]
}

Here is the output:

// Class generated by Clever Models 
import java.util.List; 

public class Test { 
    private List<BunchOfStrings> bunchOfStrings; 
    private List<ListOfNumbers> listOfNumbers; 
    private List<SomeBooleans> someBooleans; 
    private List<HowAboutDoubles> howAboutDoubles; 

    public List<BunchOfS> getBunchOfStrings() { 
         return bunchOfStrings; 
    } 

    public List<ListOfNu> getListOfNumbers() { 
         return listOfNumbers; 
    } 

    public List<SomeBool> getSomeBooleans() { 
         return someBooleans; 
    } 

    public List<HowAbout> getHowAboutDoubles() { 
         return howAboutDoubles; 
    } 

    public void setBunchOfStrings(List<BunchOfS> bunchOfStrings) { 
         this.bunchOfStrings = bunchOfStrings; 
    } 

    public void setListOfNumbers(List<ListOfNu> listOfNumbers) { 
         this.listOfNumbers = listOfNumbers; 
    } 

    public void setSomeBooleans(List<SomeBool> someBooleans) { 
         this.someBooleans = someBooleans; 
    } 

    public void setHowAboutDoubles(List<HowAbout> howAboutDoubles) { 
         this.howAboutDoubles = howAboutDoubles; 
    } 
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant