<commit_before>Mara
=====================

![Logo](assets/logo.png)

Mara is a library to provide traits or composition capabilities to your Java projects.

But at first place allow me tell who's Mara. Mara is my little princess, she's the first of my two sons and this library is dedicated to she. I love you my princess.

## Last Version

[ ![Download](https://api.bintray.com/packages/txusballesteros/maven/mara/images/download.svg) ](https://bintray.com/txusballesteros/maven/mara/_latestVersion)

## Why?

Why I do this library, many times I think about how I can do reusable components for my projects and how it can be isolated from all of the rest. A month ago someone show me [Kotlin](http://kotlinlang.org/docs/reference/traits.html), a language created by JetBrains and based 100% on JVM. And I thought how I can migrate the Traits capability from Kotlin to Java. The answer to the question is this library.

## How to use

Configure the APT Plugin on your build.gradle file.
```groovy
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
```

Add the library dependencies.
```groovy
dependencies {
    ...
    compile 'com.txusballesteros:mara:0.1'
    apt 'com.txusballesteros:mara-compiler:0.1'
}
```

If you are using any other libraries with AnnotationsProcessors like ButterKnife, Realm, etc... You need to set this in your build.gradle to exclude the Processor that is already packaged:
```groovy
packagingOptions {
    exclude 'META-INF/services/javax.annotation.processing.Processor'
}
```

Creating your first Trait.
```java
@Trait
public class MyFirstTrait {
    public void MyMethod() {
        ...
    }
    ...
}
```

Creating your first Composer.
```java
@TraitComposer(
    traits = {
            MyFirstTrait.class,
            ...
    }
)
public interface MyComposer { }
```

Consuming you Composer and your injected Traits.
```java
Mara_MyComposer myComposer = new Mara_MyComposer.Builder().build();
myComposer.MyMethod();
```

## Constructor Parameters

If your traits has constructor parameters, don't worry, Mara provides automatically
setters into the composer builder class to allow set this values. Please see the example below.

```java
@Trait
public class MyFirstTrait {
    public MyFirstTrait(Context context) {
        ...
    }

    public void MyMethod() {
        ...
    }<commit_msg>Editing README<commit_after>Mara
=====================

![Logo](assets/logo.png)

Mara is a library to provide traits or composition capabilities to your Java projects.

But at first place allow me tell who's Mara. Mara is my little princess, she's the first of my two sons and this library is dedicated to she. I love you my princess.

## Last Version

[ ![Download](https://api.bintray.com/packages/txusballesteros/maven/mara/images/download.svg) ](https://bintray.com/txusballesteros/maven/mara/_latestVersion)

## Why?

Why I do this library, many times I think about how I can do reusable components for my projects and how it can be isolated from all of the rest. A month ago someone show me [Kotlin](http://kotlinlang.org/docs/reference/traits.html), a language created by JetBrains and based 100% on JVM. And I thought how I can migrate the Traits capability from Kotlin to Java. The answer to the question is this library.

## How to use

Configure the APT Plugin on your build.gradle file.
```groovy
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
```

Add the library dependencies.
```groovy
dependencies {
    ...
    compile 'com.txusballesteros:mara:0.1'
    apt 'com.txusballesteros:mara-compiler:0.1'
}
```

If you are using any other libraries with AnnotationsProcessors like ButterKnife, Realm, etc... You need to set this in your build.gradle to exclude the Processor that is already packaged:
```groovy
packagingOptions {
    exclude 'META-INF/services/javax.annotation.processing.Processor'
}
```

Creating your first Trait.
```java
@Trait
public class MyFirstTrait {
    public void MyMethod() {
        ...
    }
    ...
}
```

Creating your first Composer.
```java
@TraitComposer(
    traits = {
            MyFirstTrait.class,
            ...
    }
)
public interface MyComposer { }
```

Consuming you Composer and your injected Traits.
```java
public class MyApp {
    public void onCreate() {
        Mara_MyComposer myComposer = new Mara_MyComposer.Builder().build();
        myComposer.MyMethod();
    }
}
```

## Constructor Parameters

If your traits has constructor parameters, don't worry, Mara provides automatically
setters into the composer builder class to allow set this values. Please see the example below.

```java
@Trait
public class MyFirstTrait {
    public MyFirstTrait(Context context) {
        ...
    }

    public void MyMethod() {
        ...
    }
{'fraction_non_alphanumeric': 0.10373850068506557, 'fraction_numerical': 0.0035231943628890195, 'mean_word_length': 3.4982394366197185, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1100446', 'n_tokens_mistral': 1587, 'n_tokens_neox': 1492, 'n_words': 539}