title: How to read a list of strings using SnakeYaml
body: <p>I want to read a simple YAML file using SnakeYaml</p>
  
  <pre><code>#My project 
    name: glog
    dependencies: 
      bling
      blong
  </code></pre>
  
  <p>Using this simple Java class: </p>
  
  <pre><code>public class Project {
      private String name;
  
      private ArrayList&lt;String&gt; dependencies = new ArrayList&lt;String&gt;();
  
  
      private final IvyManager ivyManager = new IvyManager();
  
      public Project() {
  
      }
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public ArrayList&lt;String&gt; getDependencies() {
          return dependencies;
      }
  
      public void setDependencies(ArrayList&lt;String&gt; dependencies) {
          this.dependencies = dependencies;
      }
  }
  </code></pre>
  
  <p>To be able to read the file, I need to prepare the <code>Yaml</code> parser because of the <code>dependencies</code> collection like this: </p>
  
  <pre><code>    Constructor constructor = new Constructor(Project.class);
      TypeDescription projectDesc = new TypeDescription(Project.class);
      projectDesc.putListPropertyType("dependencies", String.class);
      constructor.addTypeDescription(projectDesc);
  
      Yaml yaml = new Yaml(constructor);
      Project result = yaml.loadAs(FileUtils.readFileToString(f),
              Project.class);
  </code></pre>
  
  <p>Unfortunately, this doesn't work. I have the following error: </p>
  
  <pre><code>Cannot create property=dependencies for JavaBean=ninja.core.Project@26653222
   in 'string', line 2, column 3:
        name: glog
        ^
  Can't construct a java object for scalar tag:yaml.org,2002:str; No String constructor found. Exception=java.util.ArrayList.&lt;init&gt;(java.lang.String)
   in 'string', line 4, column 5:
          bling
          ^
  
      at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:308)
      at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:189)
      at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:341)
      at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182)
      at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:141)
      at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:127)
      at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:450)
      at org.yaml.snakeyaml.Yaml.loadAs(Yaml.java:427)
      at ninja.core.ProjectLoader.load(ProjectLoader.java:20)
      at ninja.command.Command.loadCurrentProject(Command.java:44)
      at ninja.command.EclipseCommand.execute(EclipseCommand.java:18)
      at ninja.cmd.Main.execute(Main.java:39)
      at ninja.cmd.Main.main(Main.java:15)
  Caused by: org.yaml.snakeyaml.error.YAMLException: Can't construct a java object for scalar tag:yaml.org,2002:str; No String constructor found. Exception=java.util.ArrayList.&lt;init&gt;(java.lang.String)
      at org.yaml.snakeyaml.constructor.Constructor$ConstructScalar.construct(Constructor.java:406)
      at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182)
      at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:297)
      ... 12 more
  Caused by: java.lang.NoSuchMethodException: java.util.ArrayList.&lt;init&gt;(java.lang.String)
      at java.lang.Class.getConstructor0(Class.java:3082)
      at java.lang.Class.getConstructor(Class.java:1825)
      at org.yaml.snakeyaml.constructor.Constructor$ConstructScalar.construct(Constructor.java:404)
      ... 14 more
  </code></pre>
  
  <p><strong>Is there something wrong with the</strong> <code>String</code> <strong>class there?</strong></p>