Java + Reflection + @Annotations

I will to show a simple example how to list all methods that are using a given @annotation.

We will use the lib:

Reflections reflection = new Reflections(new ConfigurationBuilder().setUrls(ClasspathHelper.forPackage("com.myapplication.mypackage"))
.setScanners(new MethodAnnotationsScanner()));

Set methods = reflection.getMethodsAnnotatedWith(MyAnnotation.class);

That lib is really powerful and you get to do a lot of things with less code.

Take a look at its documentation and fill what you can to do.

Dropdown Component: Select2 JQuery + Angular JS + Repeater

Particulary the Select2 is a great component dropdown selection.

I have created a directive to work together with Select2 it in my projects with Angular JS and I want to share it.

Below is the directive code.

If you want to se a example running I have made the following example.


    <script src=""></script>
    <script src=""></script>    
    <script src="select2.js"></script>    
    <link rel="stylesheet" href="runnable.css" />
    <link rel="stylesheet" href="select2.css" />
  <body ng-app="app">
    <h1>Componente Select2 JQuery + Angular JS + Repeater</h1>
    <div ng-controller="veiculoController">
        <table class="table table-bordered">
              <th width="60%">Nome Veiculo</th>
              <th>Tipo de pneu</th>
            <tr ng-repeat="veiculo in listaVeiculos">
              <td style="width: 200px">
                <div drop-down-auto-complete="listaTipoPenu" style="width: 200px"
<script src="script.js"></script>


var app = angular.module("app", []);
  function() {
    return {
      link: function(scope, element, attr) {
          var dataList = scope.$parent[attr.dropDownAutoComplete];
          var currentObject = scope[attr.dropDownAutoCompleteProperty.split(".")[0]];
          var propertyChange = attr.dropDownAutoCompleteProperty.split(".")[1];
              data: dataList
          $(element[0]).on("change", function (e) {
            currentObject[propertyChange] = $(element[0]).val();
          for(var x = 0; x < dataList.length; x++){
              if (dataList[x].id == currentObject[propertyChange]){
                $(element[0]).select2('data', dataList[x]);
app.controller('veiculoController', function($scope) {
  $scope.listaVeiculos = [{id: 1, nome: "Fusca", idTipoPneu: 3},
                          {id: 2, nome: "Hilux", idTipoPneu: 2},
                          {id: 3, nome: "Saveiro", idTipoPneu: 1}];
  $scope.listaTipoPenu = [{id: 1, text: "ARO 15"}, {id: 2, text: "ARO 16"}, {id: 3, text: "ARO 17"}];