Skip to content

Instantly share code, notes, and snippets.

/*
* Copyright (c) 2012, dooApp <contact@dooapp.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of dooApp nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
@Table(name="FOO")
public class Bar{
@Column(name="MY_CUSTOM_NAME")
private String name;
}
/*
Table structure :
--------------------
| FOO |
@Entity
public class Person{
@OneToMany(Fetch=FetchType.EAGER)
private List<Child> person;
}
db.selectFrom(PERSON);//select * from Person, Child WHERE Person.id=Child.Person.Id
package com.dooapp.template.builder;
import spoon.template.Local;
import spoon.template.Parameter;
import spoon.template.Template;
public class DefaultConstantTemplate implements Template {
public static final String DEFAULT__NAME__VALUE = "defaultValue._name_";
@Parameter("_name_")
String __name_;
package com.dooapp.template.builder;
import spoon.template.Local;
import spoon.template.Parameter;
import spoon.template.Template;
public class DefaultConstantTemplate implements Template {
@Parameter()
static String _name_;
@Parameter("_NAME_")
[INFO] Running spoon with parameters :
[INFO] [-i, /Users/christophedufour/workspace/test-model/src/main/java, -o, /Users/christophedufour/workspace/test-model/target/generated-sources/spoon, --compliance, 6, -p, com.dooapp.processor.wrapper.GenerateMissingWrapperClassProcessor:com.dooapp.processor.wrapper.AddSuperClassOnBeanProcessor:com.dooapp.processor.wrapper.AddSuperClassOnWrapperProcessor:com.dooapp.processor.property.GenerateWrapperMethodsProcessor:com.dooapp.processor.property.GenerateCreateFieldPropertyContent:com.dooapp.processor.collection.GenerateWrapperCollectionMethodsProcessor:com.dooapp.processor.builder.GenerateMissingBuilderClassProcessor:com.dooapp.processor.builder.AddSuperClassOnBuilderProcessor:com.dooapp.processor.builder.GenerateMethodsProcessor, -t, /var/folders/vh/gt6kjhmn2rd9_pnm_gnlrnlr0000gn/T/Spoon2395517295073850970/com/dooapp/template/WrapperConstructorTemplate.java:/var/folders/vh/gt6kjhmn2rd9_pnm_gnlrnlr0000gn/T/Spoon2395517295073850970/com/dooapp/template/property/ReadTempl
@christophe-dooapp
christophe-dooapp / gist:7566822
Created November 20, 2013 17:01
Property template
package com.dooapp.template.property;
import javafx.beans.property.ObjectProperty;
import spoon.reflect.reference.CtTypeReference;
import spoon.template.Local;
import spoon.template.Parameter;
import spoon.template.Template;
/**
* Main template to handle all getter setter updater and properties into wrappers<br>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>DSDK-entity</groupId>
<artifactId>DSDK-entity</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
public class Project{
private final StringProperty name=new SimpleStringProperty();
}
public class Sample{
private final StringProperty name=new SimpleStringProperty();
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>AProject</groupId>
<artifactId>AProject</artifactId>
<version>1.0-SNAPSHOT</version>