This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Session sess = factory.openSession(); | |
Transaction tx; | |
try { | |
tx = sess.beginTransaction(); | |
sess.save( obj ); // Persiste algum objeto | |
tx.commit(); | |
} | |
catch (Exception e) { | |
if (tx!=null) tx.rollback(); | |
throw e; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Dependencies --> | |
<dependency> | |
<groupId>javax.media</groupId> | |
<artifactId>jai-core</artifactId> | |
<version>1.1.3</version> | |
</dependency> | |
<dependency> | |
<groupId>com.sun.media</groupId> | |
<artifactId>jai-codec</artifactId> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.image.RenderedImage; | |
import java.io.IOException; | |
import javax.media.jai.JAI; | |
import com.sun.media.jai.codec.FileSeekableStream; | |
import com.sun.media.jai.codec.ImageCodec; | |
import com.sun.media.jai.codec.ImageDecoder; | |
public class TiffConverter { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Pessoa { | |
String nome | |
String sobreNome | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Pessoa implements groovy.lang.GroovyObject extends java.lang.Object { | |
private java.lang.String nome | |
private java.lang.String sobreNome | |
// … Alguns campos omitidos | |
public Pessoa() { | |
//... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@groovy.util.logging.Log | |
class Controller { | |
def index(){ | |
log.info "Entrando no Index..." | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Controller { | |
private static final Logger log = Logger.getLogger(‘Controller’) | |
public java.lang.Object index() { | |
if (log.isLoggable(Level.INFO)) { | |
log.info 'Entrando no Index...' | |
} | |
return null | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Controller { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testarTransformacaoQueIncluiAtributoLog() { | |
def existeCampo = Controller.declaredFields.any { it.name == 'log' } | |
assert existeCampo | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package transformacoes; | |
import ... | |
@Retention(RetentionPolicy.SOURCE) | |
@Target({ElementType.TYPE}) | |
@GroovyASTTransformationClass("transformacoes.LoggerTransformation") | |
public @interface Logger { | |
} |
OlderNewer