This file contains hidden or 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
@Controller | |
@RequestMapping("/connect") | |
public class CustomConnectController extends ConnectController { | |
@Autowired | |
public CustomConnectController(ConnectionFactoryLocator connectionFactoryLocator, | |
ConnectionRepository connectionRepository) { | |
super(connectionFactoryLocator, connectionRepository); | |
} |
This file contains hidden or 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
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> | |
<c:forEach var="transacao" items="${transacoes}"> | |
${transacao}<br/> | |
</c:forEach> |
This file contains hidden or 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 br.com.casadocodigo.loja.infra.spring; | |
import org.springframework.beans.BeansException; | |
import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition; | |
import org.springframework.beans.factory.config.BeanDefinition; | |
import org.springframework.beans.factory.config.BeanFactoryPostProcessor; | |
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.core.type.AnnotationMetadata; | |
import org.springframework.stereotype.Controller; |
This file contains hidden or 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
<servlet> | |
<servlet-name>springmvc</servlet-name> | |
<servlet-class> | |
org.springframework.web.servlet.DispatcherServlet | |
</servlet-class> | |
<init-param> | |
<param-name>contextConfigLocation</param-name> | |
<param-value> | |
/WEB-INF/spring-context.xml | |
</param-value> |
This file contains hidden or 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
@(elements: helper.FieldElements) | |
<div class="form-group @if(elements.hasErrors){ has-error }" draggable="true"> | |
<div class="col-sm-2"> | |
<label for="inputNumero" class="control-label">@elements.label</label> | |
</div> | |
<div class="col-sm-10"> | |
<input type="text" class="form-control" name="@elements.name" value="@elements.field.value" id="@elements.id"> | |
</div> | |
</div> |
This file contains hidden or 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 helpers | |
import java.io.File | |
import java.io.FileInputStream | |
import play.api.libs.concurrent.Execution.Implicits._ | |
import org.apache.commons.io.FilenameUtils | |
import org.apache.commons.io.IOUtils | |
import fly.play.s3.BucketFile | |
import fly.play.s3.S3 | |
import fly.play.s3.S3Exception |
This file contains hidden or 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 ExemploMaisComum { | |
private static List<Integer> numeros = Arrays.asList(1,2,3,4,5,6,7,8); | |
//passando por todos os números, a não ser que você programe a parada | |
public static void main(String[] args){ | |
List<Integer> achados = new ArrayList<>(); | |
for(int n : numeros){ | |
if(n % 2 == 0){ | |
achados.add(n); | |
//poderia parar aqui, é claro :). | |
} |
This file contains hidden or 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 scala.reflect.api._ | |
import scala.reflect.runtime._ | |
import scala.reflect.runtime.Mirror._ | |
object Pimps{ | |
implicit def pimp(str:String) = new { | |
def test = println("hello") | |
} | |
} |
This file contains hidden or 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
//para compilar o exemplo faça => scalac arquivo.scala -Xexperimental | |
package br.com.caelum.dynamic | |
import java.util.{GregorianCalendar, Calendar} | |
import java.text.SimpleDateFormat | |
case class Contato(val nome: String, val email: String, val nascimento: Calendar) { | |
override def toString = nome + ";" + email + ";" + new SimpleDateFormat("dd/MM/yyyy").format(nascimento.getTime) | |
} |
This file contains hidden or 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 br.com.caelum.teste; | |
import java.util.Set; | |
import javax.validation.ConstraintViolation; | |
import javax.validation.Validation; | |
import javax.validation.Validator; | |
import javax.validation.ValidatorFactory; | |
import org.hibernate.validator.constraints.ScriptAssert; |