Java 类org.yaml.snakeyaml.extensions.compactnotation.CompactConstructor 实例源码

项目:cats    文件:DevRack.java   
public void dumpRacksToFile( List< Rack > rackList, String filePath )
{
    if ( rackList != null )
    {

        Yaml yaml = new Yaml( new CompactConstructor() );
        try
        {
            FileWriter fw = new FileWriter( filePath );
            yaml.dump( rackList, fw );
            fw.close();
        }
        catch ( Exception e )
        {
            e.printStackTrace();
        }
    }
}
项目:cats    文件:SettopControllerTest.java   
@Before
public void setUp(){
    int[] noOfSlots = { INITIAL_NO_OF_SLOTS,INITIAL_NO_OF_SLOTS };
    DevRack devRack = new DevRack();
    devRack.dumpRacksToFile( devRack.create(rackNames, noOfSlots),yamlFilePath+ System.getProperty( "file.separator" ) + RackService.RACK_CONFIG );
    rackService.refresh();



    Yaml yaml = new Yaml( new CompactConstructor() );
    try
    {
        FileWriter fw = new FileWriter( yamlFilePath+ System.getProperty( "file.separator" ) + SettopSlotConfigServiceImpl.SETTOP_TYPE_MAPPING_CONFIG );
        yaml.dump( settopTypes, fw );
        fw.close();
    }
    catch ( Exception e )
    {
        e.printStackTrace();
    }
}
项目:snake-yaml    文件:FloatPropertyTest.java   
public void testCompact() {
    Yaml yaml = new Yaml(new CompactConstructor());
    BeanData obj = (BeanData) yaml
            .load("org.yaml.snakeyaml.issues.issue144.BeanData(id): { number: 123.4 }");
    assertEquals(123.4f, obj.getNumber());
}
项目:snakeyaml    文件:FloatPropertyTest.java   
public void testCompact() {
    Yaml yaml = new Yaml(new CompactConstructor());
    BeanData obj = (BeanData) yaml
            .load("org.yaml.snakeyaml.issues.issue144.BeanData(id): { number: 123.4 }");
    assertEquals(123.4f, obj.getNumber());
}