repo_name stringlengths 7 104 | file_path stringlengths 13 198 | context stringlengths 67 7.15k | import_statement stringlengths 16 4.43k | code stringlengths 40 6.98k | prompt stringlengths 227 8.27k | next_line stringlengths 8 795 |
|---|---|---|---|---|---|---|
TreyRuffy/CommandBlocker | Command Blocker Bungee/src/main/java/me/treyruffy/commandblocker/bungeecord/config/BungeeUpdateConfig.java | // Path: Command Blocker Shared/src/main/java/me/treyruffy/commandblocker/MethodInterface.java
// public interface MethodInterface {
//
// Object getPlugin();
//
// Object getConfig();
// Object getDisabledCommandsConfig();
// Object getMessagesConfig();
// Object getOpBlockConfig();
//
// void saveConfig();
// void saveDisabledCommandsConfig();
// void saveMessagesConfig();
// void saveOpBlockConfig();
//
// File getConfigFile(Object configurationFile);
//
// String getVersion();
//
// String getServerType();
//
// File getDataFolder();
//
// void setupMetrics();
//
// void executeCommand(String cmd);
//
// void sendMessage(Object commandSender, Component message);
//
// List<String> getOldMessages(String category, String message);
// List<String> getOldMessages(String category, String message, Object configurationFile);
//
// Character getChatComponentChar();
//
// String getOldMessage(String category, String message);
// String getOldMessage(String category, String message, Object configurationFile);
//
// void log(String msg);
// }
//
// Path: Command Blocker Shared/src/main/java/me/treyruffy/commandblocker/Universal.java
// public class Universal {
//
// private static Universal instance = null;
// private MethodInterface mi;
//
// public static Universal get() {
// return instance == null ? instance = new Universal() : instance;
// }
//
// public void setup(MethodInterface mi) {
// this.mi = mi;
//
// mi.setupMetrics();
// }
//
// public MethodInterface getMethods() {
// return mi;
// }
//
// }
| import me.treyruffy.commandblocker.MethodInterface;
import me.treyruffy.commandblocker.Universal;
import net.md_5.bungee.config.Configuration;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.util.Objects; | package me.treyruffy.commandblocker.bungeecord.config;
public class BungeeUpdateConfig {
// Updates the config
public void setup() { | // Path: Command Blocker Shared/src/main/java/me/treyruffy/commandblocker/MethodInterface.java
// public interface MethodInterface {
//
// Object getPlugin();
//
// Object getConfig();
// Object getDisabledCommandsConfig();
// Object getMessagesConfig();
// Object getOpBlockConfig();
//
// void saveConfig();
// void saveDisabledCommandsConfig();
// void saveMessagesConfig();
// void saveOpBlockConfig();
//
// File getConfigFile(Object configurationFile);
//
// String getVersion();
//
// String getServerType();
//
// File getDataFolder();
//
// void setupMetrics();
//
// void executeCommand(String cmd);
//
// void sendMessage(Object commandSender, Component message);
//
// List<String> getOldMessages(String category, String message);
// List<String> getOldMessages(String category, String message, Object configurationFile);
//
// Character getChatComponentChar();
//
// String getOldMessage(String category, String message);
// String getOldMessage(String category, String message, Object configurationFile);
//
// void log(String msg);
// }
//
// Path: Command Blocker Shared/src/main/java/me/treyruffy/commandblocker/Universal.java
// public class Universal {
//
// private static Universal instance = null;
// private MethodInterface mi;
//
// public static Universal get() {
// return instance == null ? instance = new Universal() : instance;
// }
//
// public void setup(MethodInterface mi) {
// this.mi = mi;
//
// mi.setupMetrics();
// }
//
// public MethodInterface getMethods() {
// return mi;
// }
//
// }
// Path: Command Blocker Bungee/src/main/java/me/treyruffy/commandblocker/bungeecord/config/BungeeUpdateConfig.java
import me.treyruffy.commandblocker.MethodInterface;
import me.treyruffy.commandblocker.Universal;
import net.md_5.bungee.config.Configuration;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.util.Objects;
package me.treyruffy.commandblocker.bungeecord.config;
public class BungeeUpdateConfig {
// Updates the config
public void setup() { | MethodInterface mi = Universal.get().getMethods(); |
sintrb/JavaDsp | src/com/sin/java/dsp/base/BasePipe.java | // Path: src/com/sin/java/dsp/util/XLog.java
// final public class XLog {
// public static void l(Object l) {
// System.out.println("log: " + (l == null ? "null" : l.toString()));
// }
//
// public static void l(String format, Object... args) {
// l(String.format(format, args));
// }
//
// public static void i(Object i) {
// System.out.println("inf: " + (i == null ? "null" : i.toString()));
// }
//
// public static void i(String format, Object... args) {
// i(String.format(format, args));
// }
//
// public static void e(Object e) {
// System.err.println("err: " + (e == null ? "null" : e.toString()));
// }
//
// public static void e(String format, Object... args) {
// e(String.format(format, args));
// }
//
// public static void w(Object e) {
// System.out.println("wrn: " + (e == null ? "null" : e.toString()));
// }
//
// public static void w(String format, Object... args) {
// w(String.format(format, args));
// }
// }
| import com.sin.java.dsp.util.XLog; |
public ArgumentDescribe getInputDescribe() {
return inputDescribe;
}
public void setInputDescribe(ArgumentDescribe inputDescribe) {
this.inputDescribe = inputDescribe;
}
public ArgumentDescribe getOutputDescribe() {
return outputDescribe;
}
public void setOutputDescribe(ArgumentDescribe outputDescribe) {
this.outputDescribe = outputDescribe;
}
@Override
public String toString() {
return "BasePipe [name=" + name + ", explain=" + explain + ", type=" + type + ", inputDescribe=" + inputDescribe + ", outputDescribe=" + outputDescribe + "]";
}
/**
* 管道的计算
*
* @param input
* 输入参数
* @return 输出参数
*/
public Object calculate(Object input) { | // Path: src/com/sin/java/dsp/util/XLog.java
// final public class XLog {
// public static void l(Object l) {
// System.out.println("log: " + (l == null ? "null" : l.toString()));
// }
//
// public static void l(String format, Object... args) {
// l(String.format(format, args));
// }
//
// public static void i(Object i) {
// System.out.println("inf: " + (i == null ? "null" : i.toString()));
// }
//
// public static void i(String format, Object... args) {
// i(String.format(format, args));
// }
//
// public static void e(Object e) {
// System.err.println("err: " + (e == null ? "null" : e.toString()));
// }
//
// public static void e(String format, Object... args) {
// e(String.format(format, args));
// }
//
// public static void w(Object e) {
// System.out.println("wrn: " + (e == null ? "null" : e.toString()));
// }
//
// public static void w(String format, Object... args) {
// w(String.format(format, args));
// }
// }
// Path: src/com/sin/java/dsp/base/BasePipe.java
import com.sin.java.dsp.util.XLog;
public ArgumentDescribe getInputDescribe() {
return inputDescribe;
}
public void setInputDescribe(ArgumentDescribe inputDescribe) {
this.inputDescribe = inputDescribe;
}
public ArgumentDescribe getOutputDescribe() {
return outputDescribe;
}
public void setOutputDescribe(ArgumentDescribe outputDescribe) {
this.outputDescribe = outputDescribe;
}
@Override
public String toString() {
return "BasePipe [name=" + name + ", explain=" + explain + ", type=" + type + ", inputDescribe=" + inputDescribe + ", outputDescribe=" + outputDescribe + "]";
}
/**
* 管道的计算
*
* @param input
* 输入参数
* @return 输出参数
*/
public Object calculate(Object input) { | XLog.i("管道%s并没有实现calculate方法", name); |
sintrb/JavaDsp | src/com/sin/java/dsp/adapter/DoublesToInts.java | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
| import com.sin.java.dsp.base.ArgumentDescribe; | package com.sin.java.dsp.adapter;
/**
* Double数组转Int数组适配器
*
* @author RobinTang
*
*/
public class DoublesToInts extends BaseAdapter {
/**
* Double数组转Int数组适配器
*/
public DoublesToInts() {
this(0, -1);
}
/**
* Double数组转Int数组适配器
*
* @param offset
* 起始位置
* @param length
* 长度
*/
public DoublesToInts(int offset, int length) { | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
// Path: src/com/sin/java/dsp/adapter/DoublesToInts.java
import com.sin.java.dsp.base.ArgumentDescribe;
package com.sin.java.dsp.adapter;
/**
* Double数组转Int数组适配器
*
* @author RobinTang
*
*/
public class DoublesToInts extends BaseAdapter {
/**
* Double数组转Int数组适配器
*/
public DoublesToInts() {
this(0, -1);
}
/**
* Double数组转Int数组适配器
*
* @param offset
* 起始位置
* @param length
* 长度
*/
public DoublesToInts(int offset, int length) { | super("Double数组转Int数组", "", ArgumentDescribe.doubleArray("输入Double数组"), ArgumentDescribe.intArray("返回Int数组"), offset, length); |
sintrb/JavaDsp | src/com/sin/java/dsp/filter/ABS.java | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
| import com.sin.java.dsp.base.ArgumentDescribe; | package com.sin.java.dsp.filter;
/**
* 绝对值
*
* @author RobinTang
*
*/
public class ABS extends BaseFilter {
private boolean positive = true;
/**
* 绝对值
*/
public ABS() {
this(true);
}
/**
* 绝对值
*
* @param positive
* true为绝对值,false为反绝对值
*/
public ABS(boolean positive) { | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
// Path: src/com/sin/java/dsp/filter/ABS.java
import com.sin.java.dsp.base.ArgumentDescribe;
package com.sin.java.dsp.filter;
/**
* 绝对值
*
* @author RobinTang
*
*/
public class ABS extends BaseFilter {
private boolean positive = true;
/**
* 绝对值
*/
public ABS() {
this(true);
}
/**
* 绝对值
*
* @param positive
* true为绝对值,false为反绝对值
*/
public ABS(boolean positive) { | super("Double数组绝对值", "", ArgumentDescribe.doubleArray("输入Double数组"), ArgumentDescribe.doubleArray("返回绝对值数组")); |
sintrb/JavaDsp | src/com/sin/java/dsp/filter/LinearInterpolater.java | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
| import com.sin.java.dsp.base.ArgumentDescribe; | package com.sin.java.dsp.filter;
/**
* 线性插值器
*
* @author RobinTang
*
*/
public class LinearInterpolater extends BaseFilter {
/**
* 线性差值器
*/
public LinearInterpolater() { | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
// Path: src/com/sin/java/dsp/filter/LinearInterpolater.java
import com.sin.java.dsp.base.ArgumentDescribe;
package com.sin.java.dsp.filter;
/**
* 线性插值器
*
* @author RobinTang
*
*/
public class LinearInterpolater extends BaseFilter {
/**
* 线性差值器
*/
public LinearInterpolater() { | super("Double数组线性插值", "", ArgumentDescribe.doubleArrayArray("输入二维Double数组,double[2][],double[0]为indexs,double[1]为values"), ArgumentDescribe.doubleArrayArray("插值后的二维Double数组")); |
sintrb/JavaDsp | src/com/sin/java/dsp/adapter/IntsToDoubles.java | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
| import com.sin.java.dsp.base.ArgumentDescribe; | package com.sin.java.dsp.adapter;
/**
* Int数组转Double数组适配器
*
* @author RobinTang
*
*/
public class IntsToDoubles extends BaseAdapter {
/**
* Int数组转Double数组适配器
*/
public IntsToDoubles() {
this(0, -1);
}
/**
* Int数组转Double数组适配器
*
* @param offset
* 起始位置
* @param length
* 长度
*/
public IntsToDoubles(int offset, int length) { | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
// Path: src/com/sin/java/dsp/adapter/IntsToDoubles.java
import com.sin.java.dsp.base.ArgumentDescribe;
package com.sin.java.dsp.adapter;
/**
* Int数组转Double数组适配器
*
* @author RobinTang
*
*/
public class IntsToDoubles extends BaseAdapter {
/**
* Int数组转Double数组适配器
*/
public IntsToDoubles() {
this(0, -1);
}
/**
* Int数组转Double数组适配器
*
* @param offset
* 起始位置
* @param length
* 长度
*/
public IntsToDoubles(int offset, int length) { | super("Int数组转Double数组", "", ArgumentDescribe.intArray("输入Int数组"), ArgumentDescribe.doubleArray("返回Double数组"), offset, length); |
sintrb/JavaDsp | src/com/sin/java/dsp/filter/Energy.java | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
| import com.sin.java.dsp.base.ArgumentDescribe; | package com.sin.java.dsp.filter;
/**
* 计算信号能量
*
* @author RobinTang
*
*/
public class Energy extends BaseFilter {
private int[] segments;
/**
* Double数组归一化(两侧归一化)
*
* @param segments
* 信号分段依据,即下标的分段,应该是升序排列,最后的信号能量个数和分段个数相等,最后一个一般为Integer.MAX
*/
public Energy(int[] segments) { | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
// Path: src/com/sin/java/dsp/filter/Energy.java
import com.sin.java.dsp.base.ArgumentDescribe;
package com.sin.java.dsp.filter;
/**
* 计算信号能量
*
* @author RobinTang
*
*/
public class Energy extends BaseFilter {
private int[] segments;
/**
* Double数组归一化(两侧归一化)
*
* @param segments
* 信号分段依据,即下标的分段,应该是升序排列,最后的信号能量个数和分段个数相等,最后一个一般为Integer.MAX
*/
public Energy(int[] segments) { | super("Double数组归一化", "", ArgumentDescribe.doubleArray("输入Double数组"), ArgumentDescribe.doubleArray("返回归一化Double数组")); |
sintrb/JavaDsp | src/com/sin/java/dsp/filter/ToOne2.java | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
//
// Path: src/com/sin/java/dsp/util/SinMath.java
// public final class SinMath {
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @return 平均值
// */
// public static double mean(double[] array) {
// return mean(array, 0, array.length);
// }
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 平均值
// */
// public static double mean(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double sum = 0;
// for (int i = offset; i < end; ++i) {
// sum += array[i];
// }
// return sum / (end - offset);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @return 最大值
// */
// public static double max(double[] array) {
// return max(array, 0, array.length);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最大值
// */
// public static double max(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double max = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] > max)
// max = array[i];
// }
// return max;
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @return 最小值
// */
// public static double min(double[] array) {
// return min(array, 0, array.length);
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最小值
// */
// public static double min(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double min = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] < min)
// min = array[i];
// }
// return min;
// }
// }
| import com.sin.java.dsp.base.ArgumentDescribe;
import com.sin.java.dsp.util.SinMath; | package com.sin.java.dsp.filter;
/**
* Double数组归一化(两侧归一化)
*
* @author RobinTang
*
*/
public class ToOne2 extends BaseFilter {
/**
* Double数组归一化(两侧归一化)
*/
public ToOne2() { | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
//
// Path: src/com/sin/java/dsp/util/SinMath.java
// public final class SinMath {
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @return 平均值
// */
// public static double mean(double[] array) {
// return mean(array, 0, array.length);
// }
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 平均值
// */
// public static double mean(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double sum = 0;
// for (int i = offset; i < end; ++i) {
// sum += array[i];
// }
// return sum / (end - offset);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @return 最大值
// */
// public static double max(double[] array) {
// return max(array, 0, array.length);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最大值
// */
// public static double max(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double max = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] > max)
// max = array[i];
// }
// return max;
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @return 最小值
// */
// public static double min(double[] array) {
// return min(array, 0, array.length);
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最小值
// */
// public static double min(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double min = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] < min)
// min = array[i];
// }
// return min;
// }
// }
// Path: src/com/sin/java/dsp/filter/ToOne2.java
import com.sin.java.dsp.base.ArgumentDescribe;
import com.sin.java.dsp.util.SinMath;
package com.sin.java.dsp.filter;
/**
* Double数组归一化(两侧归一化)
*
* @author RobinTang
*
*/
public class ToOne2 extends BaseFilter {
/**
* Double数组归一化(两侧归一化)
*/
public ToOne2() { | super("Double数组归一化", "", ArgumentDescribe.doubleArray("输入Double数组"), ArgumentDescribe.doubleArray("返回归一化Double数组")); |
sintrb/JavaDsp | src/com/sin/java/dsp/filter/ToOne2.java | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
//
// Path: src/com/sin/java/dsp/util/SinMath.java
// public final class SinMath {
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @return 平均值
// */
// public static double mean(double[] array) {
// return mean(array, 0, array.length);
// }
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 平均值
// */
// public static double mean(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double sum = 0;
// for (int i = offset; i < end; ++i) {
// sum += array[i];
// }
// return sum / (end - offset);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @return 最大值
// */
// public static double max(double[] array) {
// return max(array, 0, array.length);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最大值
// */
// public static double max(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double max = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] > max)
// max = array[i];
// }
// return max;
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @return 最小值
// */
// public static double min(double[] array) {
// return min(array, 0, array.length);
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最小值
// */
// public static double min(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double min = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] < min)
// min = array[i];
// }
// return min;
// }
// }
| import com.sin.java.dsp.base.ArgumentDescribe;
import com.sin.java.dsp.util.SinMath; | package com.sin.java.dsp.filter;
/**
* Double数组归一化(两侧归一化)
*
* @author RobinTang
*
*/
public class ToOne2 extends BaseFilter {
/**
* Double数组归一化(两侧归一化)
*/
public ToOne2() {
super("Double数组归一化", "", ArgumentDescribe.doubleArray("输入Double数组"), ArgumentDescribe.doubleArray("返回归一化Double数组"));
}
@Override
public Object calculate(Object input) {
double[] ins = (double[]) input;
int len = ins.length;
double[] ret = new double[len]; | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
//
// Path: src/com/sin/java/dsp/util/SinMath.java
// public final class SinMath {
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @return 平均值
// */
// public static double mean(double[] array) {
// return mean(array, 0, array.length);
// }
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 平均值
// */
// public static double mean(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double sum = 0;
// for (int i = offset; i < end; ++i) {
// sum += array[i];
// }
// return sum / (end - offset);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @return 最大值
// */
// public static double max(double[] array) {
// return max(array, 0, array.length);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最大值
// */
// public static double max(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double max = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] > max)
// max = array[i];
// }
// return max;
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @return 最小值
// */
// public static double min(double[] array) {
// return min(array, 0, array.length);
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最小值
// */
// public static double min(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double min = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] < min)
// min = array[i];
// }
// return min;
// }
// }
// Path: src/com/sin/java/dsp/filter/ToOne2.java
import com.sin.java.dsp.base.ArgumentDescribe;
import com.sin.java.dsp.util.SinMath;
package com.sin.java.dsp.filter;
/**
* Double数组归一化(两侧归一化)
*
* @author RobinTang
*
*/
public class ToOne2 extends BaseFilter {
/**
* Double数组归一化(两侧归一化)
*/
public ToOne2() {
super("Double数组归一化", "", ArgumentDescribe.doubleArray("输入Double数组"), ArgumentDescribe.doubleArray("返回归一化Double数组"));
}
@Override
public Object calculate(Object input) {
double[] ins = (double[]) input;
int len = ins.length;
double[] ret = new double[len]; | double min = SinMath.min(ins); |
sintrb/JavaDsp | src/com/sin/java/dsp/filter/MeanFilter.java | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
| import com.sin.java.dsp.base.ArgumentDescribe; | package com.sin.java.dsp.filter;
/**
* 均值滤波器 对输入信号进行均值滤波,窗长为windowWidth,滤波后信号长度保持不变
*
* @author RobinTang
*
*/
public class MeanFilter extends BaseFilter {
public int windowWidth; // 窗长
/**
* 均值滤波器,默认窗长为150
*/
public MeanFilter() {
this(150);
}
/**
* 均值滤波器
*
* @param windowWidth
* 窗长
*/
public MeanFilter(int windowWidth) { | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
// Path: src/com/sin/java/dsp/filter/MeanFilter.java
import com.sin.java.dsp.base.ArgumentDescribe;
package com.sin.java.dsp.filter;
/**
* 均值滤波器 对输入信号进行均值滤波,窗长为windowWidth,滤波后信号长度保持不变
*
* @author RobinTang
*
*/
public class MeanFilter extends BaseFilter {
public int windowWidth; // 窗长
/**
* 均值滤波器,默认窗长为150
*/
public MeanFilter() {
this(150);
}
/**
* 均值滤波器
*
* @param windowWidth
* 窗长
*/
public MeanFilter(int windowWidth) { | super("Double均值滤波", "", ArgumentDescribe.doubleArray("输入Double数组"), ArgumentDescribe.doubleArray("返回滤波后Double数组")); |
sintrb/JavaDsp | src/com/sin/java/dsp/filter/MeanToZero.java | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
//
// Path: src/com/sin/java/dsp/util/SinMath.java
// public final class SinMath {
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @return 平均值
// */
// public static double mean(double[] array) {
// return mean(array, 0, array.length);
// }
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 平均值
// */
// public static double mean(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double sum = 0;
// for (int i = offset; i < end; ++i) {
// sum += array[i];
// }
// return sum / (end - offset);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @return 最大值
// */
// public static double max(double[] array) {
// return max(array, 0, array.length);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最大值
// */
// public static double max(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double max = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] > max)
// max = array[i];
// }
// return max;
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @return 最小值
// */
// public static double min(double[] array) {
// return min(array, 0, array.length);
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最小值
// */
// public static double min(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double min = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] < min)
// min = array[i];
// }
// return min;
// }
// }
| import com.sin.java.dsp.base.ArgumentDescribe;
import com.sin.java.dsp.util.SinMath; | package com.sin.java.dsp.filter;
/**
* 平均值归零(即数组中所有元素均减去平均值)
*
* @author RobinTang
*
*/
public class MeanToZero extends BaseFilter {
/**
* 平均值归零(即数组中所有元素均减去平均值)
*/
public MeanToZero() { | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
//
// Path: src/com/sin/java/dsp/util/SinMath.java
// public final class SinMath {
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @return 平均值
// */
// public static double mean(double[] array) {
// return mean(array, 0, array.length);
// }
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 平均值
// */
// public static double mean(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double sum = 0;
// for (int i = offset; i < end; ++i) {
// sum += array[i];
// }
// return sum / (end - offset);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @return 最大值
// */
// public static double max(double[] array) {
// return max(array, 0, array.length);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最大值
// */
// public static double max(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double max = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] > max)
// max = array[i];
// }
// return max;
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @return 最小值
// */
// public static double min(double[] array) {
// return min(array, 0, array.length);
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最小值
// */
// public static double min(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double min = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] < min)
// min = array[i];
// }
// return min;
// }
// }
// Path: src/com/sin/java/dsp/filter/MeanToZero.java
import com.sin.java.dsp.base.ArgumentDescribe;
import com.sin.java.dsp.util.SinMath;
package com.sin.java.dsp.filter;
/**
* 平均值归零(即数组中所有元素均减去平均值)
*
* @author RobinTang
*
*/
public class MeanToZero extends BaseFilter {
/**
* 平均值归零(即数组中所有元素均减去平均值)
*/
public MeanToZero() { | super("Double数组平均值归零", "", ArgumentDescribe.doubleArray("输入Double数组"), ArgumentDescribe.doubleArray("输出减去平均值之后的Double数组")); |
sintrb/JavaDsp | src/com/sin/java/dsp/filter/ShapeTransform.java | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
//
// Path: src/com/sin/java/dsp/util/SinMath.java
// public final class SinMath {
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @return 平均值
// */
// public static double mean(double[] array) {
// return mean(array, 0, array.length);
// }
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 平均值
// */
// public static double mean(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double sum = 0;
// for (int i = offset; i < end; ++i) {
// sum += array[i];
// }
// return sum / (end - offset);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @return 最大值
// */
// public static double max(double[] array) {
// return max(array, 0, array.length);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最大值
// */
// public static double max(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double max = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] > max)
// max = array[i];
// }
// return max;
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @return 最小值
// */
// public static double min(double[] array) {
// return min(array, 0, array.length);
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最小值
// */
// public static double min(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double min = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] < min)
// min = array[i];
// }
// return min;
// }
// }
| import com.sin.java.dsp.base.ArgumentDescribe;
import com.sin.java.dsp.util.SinMath; | package com.sin.java.dsp.filter;
/**
* 形态学提取器 只是获取形态关键点 之后需要进行插值
*
* @author RobinTang
*
*/
public class ShapeTransform extends BaseFilter {
public int windowWidth; // 窗长(即平滑的点数)
/**
* 形态学提取器
*/
public ShapeTransform() {
this(150);
}
/**
* 形态学提取器
*
* @param windowWidth
* 窗长
*/
public ShapeTransform(int windowWidth) { | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
//
// Path: src/com/sin/java/dsp/util/SinMath.java
// public final class SinMath {
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @return 平均值
// */
// public static double mean(double[] array) {
// return mean(array, 0, array.length);
// }
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 平均值
// */
// public static double mean(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double sum = 0;
// for (int i = offset; i < end; ++i) {
// sum += array[i];
// }
// return sum / (end - offset);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @return 最大值
// */
// public static double max(double[] array) {
// return max(array, 0, array.length);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最大值
// */
// public static double max(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double max = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] > max)
// max = array[i];
// }
// return max;
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @return 最小值
// */
// public static double min(double[] array) {
// return min(array, 0, array.length);
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最小值
// */
// public static double min(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double min = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] < min)
// min = array[i];
// }
// return min;
// }
// }
// Path: src/com/sin/java/dsp/filter/ShapeTransform.java
import com.sin.java.dsp.base.ArgumentDescribe;
import com.sin.java.dsp.util.SinMath;
package com.sin.java.dsp.filter;
/**
* 形态学提取器 只是获取形态关键点 之后需要进行插值
*
* @author RobinTang
*
*/
public class ShapeTransform extends BaseFilter {
public int windowWidth; // 窗长(即平滑的点数)
/**
* 形态学提取器
*/
public ShapeTransform() {
this(150);
}
/**
* 形态学提取器
*
* @param windowWidth
* 窗长
*/
public ShapeTransform(int windowWidth) { | super("形态学提取", "", ArgumentDescribe.doubleArray("输入Double数组"), ArgumentDescribe.doubleArrayArray("返回二维Double数组,double[2][],double[0]为indexs,double[1]为values")); |
sintrb/JavaDsp | src/com/sin/java/dsp/filter/ToOne.java | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
//
// Path: src/com/sin/java/dsp/util/SinMath.java
// public final class SinMath {
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @return 平均值
// */
// public static double mean(double[] array) {
// return mean(array, 0, array.length);
// }
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 平均值
// */
// public static double mean(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double sum = 0;
// for (int i = offset; i < end; ++i) {
// sum += array[i];
// }
// return sum / (end - offset);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @return 最大值
// */
// public static double max(double[] array) {
// return max(array, 0, array.length);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最大值
// */
// public static double max(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double max = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] > max)
// max = array[i];
// }
// return max;
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @return 最小值
// */
// public static double min(double[] array) {
// return min(array, 0, array.length);
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最小值
// */
// public static double min(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double min = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] < min)
// min = array[i];
// }
// return min;
// }
// }
| import com.sin.java.dsp.base.ArgumentDescribe;
import com.sin.java.dsp.util.SinMath; | package com.sin.java.dsp.filter;
/**
* Double数组归一化
*
* @author RobinTang
*
*/
public class ToOne extends BaseFilter {
/**
* Double数组归一化
*/
public ToOne() { | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
//
// Path: src/com/sin/java/dsp/util/SinMath.java
// public final class SinMath {
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @return 平均值
// */
// public static double mean(double[] array) {
// return mean(array, 0, array.length);
// }
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 平均值
// */
// public static double mean(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double sum = 0;
// for (int i = offset; i < end; ++i) {
// sum += array[i];
// }
// return sum / (end - offset);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @return 最大值
// */
// public static double max(double[] array) {
// return max(array, 0, array.length);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最大值
// */
// public static double max(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double max = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] > max)
// max = array[i];
// }
// return max;
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @return 最小值
// */
// public static double min(double[] array) {
// return min(array, 0, array.length);
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最小值
// */
// public static double min(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double min = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] < min)
// min = array[i];
// }
// return min;
// }
// }
// Path: src/com/sin/java/dsp/filter/ToOne.java
import com.sin.java.dsp.base.ArgumentDescribe;
import com.sin.java.dsp.util.SinMath;
package com.sin.java.dsp.filter;
/**
* Double数组归一化
*
* @author RobinTang
*
*/
public class ToOne extends BaseFilter {
/**
* Double数组归一化
*/
public ToOne() { | super("Double数组归一化", "", ArgumentDescribe.doubleArray("输入Double数组"), ArgumentDescribe.doubleArray("返回归一化Double数组")); |
sintrb/JavaDsp | src/com/sin/java/dsp/filter/ToOne.java | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
//
// Path: src/com/sin/java/dsp/util/SinMath.java
// public final class SinMath {
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @return 平均值
// */
// public static double mean(double[] array) {
// return mean(array, 0, array.length);
// }
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 平均值
// */
// public static double mean(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double sum = 0;
// for (int i = offset; i < end; ++i) {
// sum += array[i];
// }
// return sum / (end - offset);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @return 最大值
// */
// public static double max(double[] array) {
// return max(array, 0, array.length);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最大值
// */
// public static double max(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double max = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] > max)
// max = array[i];
// }
// return max;
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @return 最小值
// */
// public static double min(double[] array) {
// return min(array, 0, array.length);
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最小值
// */
// public static double min(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double min = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] < min)
// min = array[i];
// }
// return min;
// }
// }
| import com.sin.java.dsp.base.ArgumentDescribe;
import com.sin.java.dsp.util.SinMath; | package com.sin.java.dsp.filter;
/**
* Double数组归一化
*
* @author RobinTang
*
*/
public class ToOne extends BaseFilter {
/**
* Double数组归一化
*/
public ToOne() {
super("Double数组归一化", "", ArgumentDescribe.doubleArray("输入Double数组"), ArgumentDescribe.doubleArray("返回归一化Double数组"));
}
@Override
public Object calculate(Object input) {
double[] ins = (double[]) input;
int len = ins.length;
double[] ret = new double[len]; | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
//
// Path: src/com/sin/java/dsp/util/SinMath.java
// public final class SinMath {
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @return 平均值
// */
// public static double mean(double[] array) {
// return mean(array, 0, array.length);
// }
//
// /**
// * 求平均值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 平均值
// */
// public static double mean(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double sum = 0;
// for (int i = offset; i < end; ++i) {
// sum += array[i];
// }
// return sum / (end - offset);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @return 最大值
// */
// public static double max(double[] array) {
// return max(array, 0, array.length);
// }
//
// /**
// * 求最大值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最大值
// */
// public static double max(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double max = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] > max)
// max = array[i];
// }
// return max;
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @return 最小值
// */
// public static double min(double[] array) {
// return min(array, 0, array.length);
// }
//
// /**
// * 求最小值
// *
// * @param array
// * 输入的数组
// * @param offset
// * 数组下标偏移
// * @param length
// * 长度
// * @return 最小值
// */
// public static double min(double[] array, int offset, int length) {
// int end = array.length > (offset + length) ? offset + length : array.length;
// double min = array[offset];
// for (int i = offset; i < end; ++i) {
// if (array[i] < min)
// min = array[i];
// }
// return min;
// }
// }
// Path: src/com/sin/java/dsp/filter/ToOne.java
import com.sin.java.dsp.base.ArgumentDescribe;
import com.sin.java.dsp.util.SinMath;
package com.sin.java.dsp.filter;
/**
* Double数组归一化
*
* @author RobinTang
*
*/
public class ToOne extends BaseFilter {
/**
* Double数组归一化
*/
public ToOne() {
super("Double数组归一化", "", ArgumentDescribe.doubleArray("输入Double数组"), ArgumentDescribe.doubleArray("返回归一化Double数组"));
}
@Override
public Object calculate(Object input) {
double[] ins = (double[]) input;
int len = ins.length;
double[] ret = new double[len]; | double min = SinMath.min(ins); |
sintrb/JavaDsp | src/com/sin/java/dsp/filter/SignalStretch.java | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
| import com.sin.java.dsp.base.ArgumentDescribe; | package com.sin.java.dsp.filter;
/**
* 信号拉伸
*
* @author RobinTang
*
*/
public class SignalStretch extends BaseFilter {
private int outlen = 1;
/**
* 信号拉伸
*
* @param multiple
* 拉伸倍数
*/
public SignalStretch(int outlen) { | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
// Path: src/com/sin/java/dsp/filter/SignalStretch.java
import com.sin.java.dsp.base.ArgumentDescribe;
package com.sin.java.dsp.filter;
/**
* 信号拉伸
*
* @author RobinTang
*
*/
public class SignalStretch extends BaseFilter {
private int outlen = 1;
/**
* 信号拉伸
*
* @param multiple
* 拉伸倍数
*/
public SignalStretch(int outlen) { | super("信号拉伸", "", ArgumentDescribe.doubleArray("输入Double数组"), ArgumentDescribe.doubleArray("返回拉伸后的Double数组")); |
sintrb/JavaDsp | src/com/sin/java/dsp/filter/SignalPicker.java | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
| import com.sin.java.dsp.base.ArgumentDescribe; | package com.sin.java.dsp.filter;
/**
* 信号提取器
*
* @author RobinTang
*
*/
public class SignalPicker extends BaseFilter {
private int offset; // 起始位置
private int lenght; // 长度
private boolean positive;
/**
* 信号提取器,默认提取全部(复制)
*/
public SignalPicker() {
this(0, -1, true);
}
/**
* 信号提取器,默认提取全部正信号
*
* @param positive
* true获取正信号,false获取负信号
*/
public SignalPicker(boolean positive) {
this(0, -1, positive);
}
/**
* 信号提取器
*
* @param offset
* 起始位置
* @param length
* 长度
* @param positive
* true获取正信号,false获取负信号
*/
public SignalPicker(int offset, int length, boolean positive) { | // Path: src/com/sin/java/dsp/base/ArgumentDescribe.java
// public class ArgumentDescribe {
// private ArgumentType type;
// private String describe;
//
// public ArgumentDescribe(ArgumentType type, String describe) {
// super();
// this.type = type;
// this.describe = describe;
// }
//
// public ArgumentType getType() {
// return type;
// }
//
// public void setType(ArgumentType type) {
// this.type = type;
// }
//
// public String getDescribe() {
// return describe;
// }
//
// public void setDescribe(String describe) {
// this.describe = describe;
// }
//
// public static ArgumentDescribe intArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeIntArray, desc);
// }
// public static ArgumentDescribe doubleArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeDoubleArray, desc);
// }
// public static ArgumentDescribe complexArray(String desc) {
// return new ArgumentDescribe(ArgumentType.TypeComplexArray, desc);
// }
// public static ArgumentDescribe doubleArrayArray(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDoubleArrayArray, desc);
// }
// public static ArgumentDescribe objectDictionary(String desc){
// return new ArgumentDescribe(ArgumentType.TypeDictionary, desc);
// }
// public static ArgumentDescribe string(String desc){
// return new ArgumentDescribe(ArgumentType.TypeString, desc);
// }
// public static ArgumentDescribe objectList(String desc){
// return new ArgumentDescribe(ArgumentType.TypeList, desc);
// }
// public static ArgumentDescribe object(String desc){
// return new ArgumentDescribe(ArgumentType.TypeObject, desc);
// }
// }
// Path: src/com/sin/java/dsp/filter/SignalPicker.java
import com.sin.java.dsp.base.ArgumentDescribe;
package com.sin.java.dsp.filter;
/**
* 信号提取器
*
* @author RobinTang
*
*/
public class SignalPicker extends BaseFilter {
private int offset; // 起始位置
private int lenght; // 长度
private boolean positive;
/**
* 信号提取器,默认提取全部(复制)
*/
public SignalPicker() {
this(0, -1, true);
}
/**
* 信号提取器,默认提取全部正信号
*
* @param positive
* true获取正信号,false获取负信号
*/
public SignalPicker(boolean positive) {
this(0, -1, positive);
}
/**
* 信号提取器
*
* @param offset
* 起始位置
* @param length
* 长度
* @param positive
* true获取正信号,false获取负信号
*/
public SignalPicker(int offset, int length, boolean positive) { | super("Double数组信号提取", "", ArgumentDescribe.doubleArray("输入Double数组"), ArgumentDescribe.doubleArray("返回提取Double数组")); |
sathipal/lwm2m_over_mqtt | src/com/ibm/mqttv3/binding/Request.java | // Path: src/com/ibm/mqttv3/binding/MQTT.java
// public enum GET {
// DISCOVER(0),
// READ(1),
// OBSERVE(2);
//
// public final int value;
//
// GET(int value) {
// this.value = value;
// }
//
// public static GET valueOf(int value) {
// switch (value) {
// case 0: return DISCOVER;
// case 1: return READ;
// case 2: return OBSERVE;
// default: return null;
// }
// }
//
// public int getValue() {
// return value;
// }
//
// public String toString() {
// return Integer.toString(value);
// }
//
// public static GET value(String value) {
// return valueOf(Integer.parseInt(value));
// }
// };
//
// Path: src/com/ibm/mqttv3/binding/MQTT.java
// public enum Operation {
// GET,
// POST,
// PUT,
// DELETE,
// RESET;
// };
| import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import com.ibm.mqttv3.binding.MQTT.GET;
import com.ibm.mqttv3.binding.MQTT.Operation; | package com.ibm.mqttv3.binding;
public class Request {
private static final Logger LOG = LoggerFactory.getLogger(Request.class);
public static final String REQUEST_TOPIC_STARTER = "LWM/S";
public static final String RESPONSE_TOPIC_STARTER = "LWM/R";
private String organizationID;
private String endpointID;
private String applicationID; | // Path: src/com/ibm/mqttv3/binding/MQTT.java
// public enum GET {
// DISCOVER(0),
// READ(1),
// OBSERVE(2);
//
// public final int value;
//
// GET(int value) {
// this.value = value;
// }
//
// public static GET valueOf(int value) {
// switch (value) {
// case 0: return DISCOVER;
// case 1: return READ;
// case 2: return OBSERVE;
// default: return null;
// }
// }
//
// public int getValue() {
// return value;
// }
//
// public String toString() {
// return Integer.toString(value);
// }
//
// public static GET value(String value) {
// return valueOf(Integer.parseInt(value));
// }
// };
//
// Path: src/com/ibm/mqttv3/binding/MQTT.java
// public enum Operation {
// GET,
// POST,
// PUT,
// DELETE,
// RESET;
// };
// Path: src/com/ibm/mqttv3/binding/Request.java
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import com.ibm.mqttv3.binding.MQTT.GET;
import com.ibm.mqttv3.binding.MQTT.Operation;
package com.ibm.mqttv3.binding;
public class Request {
private static final Logger LOG = LoggerFactory.getLogger(Request.class);
public static final String REQUEST_TOPIC_STARTER = "LWM/S";
public static final String RESPONSE_TOPIC_STARTER = "LWM/R";
private String organizationID;
private String endpointID;
private String applicationID; | private Operation operation; |
sathipal/lwm2m_over_mqtt | src/com/ibm/mqttv3/binding/Request.java | // Path: src/com/ibm/mqttv3/binding/MQTT.java
// public enum GET {
// DISCOVER(0),
// READ(1),
// OBSERVE(2);
//
// public final int value;
//
// GET(int value) {
// this.value = value;
// }
//
// public static GET valueOf(int value) {
// switch (value) {
// case 0: return DISCOVER;
// case 1: return READ;
// case 2: return OBSERVE;
// default: return null;
// }
// }
//
// public int getValue() {
// return value;
// }
//
// public String toString() {
// return Integer.toString(value);
// }
//
// public static GET value(String value) {
// return valueOf(Integer.parseInt(value));
// }
// };
//
// Path: src/com/ibm/mqttv3/binding/MQTT.java
// public enum Operation {
// GET,
// POST,
// PUT,
// DELETE,
// RESET;
// };
| import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import com.ibm.mqttv3.binding.MQTT.GET;
import com.ibm.mqttv3.binding.MQTT.Operation; | public void setEndPointId(String endPointId) {
this.endpointID = endPointId;
}
public String toString() {
return this.getTopic() +" [" + this.getMessageAsString() + "]";
}
public String getObjectId() {
if(null != node) {
return node.objectId;
}
return null;
}
public String getObjectInstanceId() {
if(null != node) {
return node.objectIdInstance;
}
return null;
}
public String getResourceId() {
if(null != node) {
return node.resourceId;
}
return null;
}
public boolean isObserve() { | // Path: src/com/ibm/mqttv3/binding/MQTT.java
// public enum GET {
// DISCOVER(0),
// READ(1),
// OBSERVE(2);
//
// public final int value;
//
// GET(int value) {
// this.value = value;
// }
//
// public static GET valueOf(int value) {
// switch (value) {
// case 0: return DISCOVER;
// case 1: return READ;
// case 2: return OBSERVE;
// default: return null;
// }
// }
//
// public int getValue() {
// return value;
// }
//
// public String toString() {
// return Integer.toString(value);
// }
//
// public static GET value(String value) {
// return valueOf(Integer.parseInt(value));
// }
// };
//
// Path: src/com/ibm/mqttv3/binding/MQTT.java
// public enum Operation {
// GET,
// POST,
// PUT,
// DELETE,
// RESET;
// };
// Path: src/com/ibm/mqttv3/binding/Request.java
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import com.ibm.mqttv3.binding.MQTT.GET;
import com.ibm.mqttv3.binding.MQTT.Operation;
public void setEndPointId(String endPointId) {
this.endpointID = endPointId;
}
public String toString() {
return this.getTopic() +" [" + this.getMessageAsString() + "]";
}
public String getObjectId() {
if(null != node) {
return node.objectId;
}
return null;
}
public String getObjectInstanceId() {
if(null != node) {
return node.objectIdInstance;
}
return null;
}
public String getResourceId() {
if(null != node) {
return node.resourceId;
}
return null;
}
public boolean isObserve() { | if(( getOperation() == Operation.GET) && |
sathipal/lwm2m_over_mqtt | src/com/ibm/mqttv3/binding/MQTTExchange.java | // Path: src/com/ibm/mqttv3/binding/MQTT.java
// public enum Operation {
// GET,
// POST,
// PUT,
// DELETE,
// RESET;
// };
| import com.ibm.mqttv3.binding.MQTT.Operation; | package com.ibm.mqttv3.binding;
/**
* The Class MQTTExchange represents an exchange of MQTT request and response
*
*/
public class MQTTExchange {
private Request request;
private Response response;
private Resource resource;
private MQTTWrapper mqttClient;
public static boolean bSERVER = true;
public MQTTExchange(Request request, Response response) {
this.request = request;
this.response = response;
}
public MQTTExchange(MQTTExchange exchange, Resource Resource) {
}
public void setResource(Resource resource) {
this.resource = resource;
}
public Resource getResource() {
return this.resource;
}
/**
* Gets the request code: <tt>GET</tt>, <tt>POST</tt>, <tt>PUT</tt> or
* <tt>DELETE</tt>.
*
* @return the request code
*/ | // Path: src/com/ibm/mqttv3/binding/MQTT.java
// public enum Operation {
// GET,
// POST,
// PUT,
// DELETE,
// RESET;
// };
// Path: src/com/ibm/mqttv3/binding/MQTTExchange.java
import com.ibm.mqttv3.binding.MQTT.Operation;
package com.ibm.mqttv3.binding;
/**
* The Class MQTTExchange represents an exchange of MQTT request and response
*
*/
public class MQTTExchange {
private Request request;
private Response response;
private Resource resource;
private MQTTWrapper mqttClient;
public static boolean bSERVER = true;
public MQTTExchange(Request request, Response response) {
this.request = request;
this.response = response;
}
public MQTTExchange(MQTTExchange exchange, Resource Resource) {
}
public void setResource(Resource resource) {
this.resource = resource;
}
public Resource getResource() {
return this.resource;
}
/**
* Gets the request code: <tt>GET</tt>, <tt>POST</tt>, <tt>PUT</tt> or
* <tt>DELETE</tt>.
*
* @return the request code
*/ | public Operation getRequestCode() { |
sathipal/lwm2m_over_mqtt | src/com/ibm/mqttv3/binding/MqttV3MessageReceiver.java | // Path: src/com/ibm/mqttv3/binding/MQTT.java
// public enum Operation {
// GET,
// POST,
// PUT,
// DELETE,
// RESET;
// };
| import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import com.ibm.mqttv3.binding.MQTT.Operation; |
protected void handleMessage(String topic, MqttMessage message) {
LOG.info("MSG { "+topic + " ["+message.toString()+"]}");
if(topic.startsWith(Request.RESPONSE_TOPIC_STARTER)) {
String[] paths = topic.split("/");
Long messageID = Long.valueOf(paths[paths.length - 1]);
// the last one must contain the message-id
AbstractRequestObserver requestObserver =
requestObservers.get(messageID);
if(requestObserver != null) {
Response response = new Response(message);
if(ResponseCode.isSuccess(ResponseCode.valueOf(response.getCode()))) {
requestObserver.onResponse(response);
} else {
requestObserver.onError(response);
}
}
return;
}
Request request = new Request(topic, message);
MQTTExchange exchange = new MQTTExchange(request, null);
exchange.setMqttClient(this.mqttClient);
Resource resource = getResource(request);
if(resource == null) {
// Check if its a POST operation, in which case
// we need to return the parent resource to create
// the new instance | // Path: src/com/ibm/mqttv3/binding/MQTT.java
// public enum Operation {
// GET,
// POST,
// PUT,
// DELETE,
// RESET;
// };
// Path: src/com/ibm/mqttv3/binding/MqttV3MessageReceiver.java
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import com.ibm.mqttv3.binding.MQTT.Operation;
protected void handleMessage(String topic, MqttMessage message) {
LOG.info("MSG { "+topic + " ["+message.toString()+"]}");
if(topic.startsWith(Request.RESPONSE_TOPIC_STARTER)) {
String[] paths = topic.split("/");
Long messageID = Long.valueOf(paths[paths.length - 1]);
// the last one must contain the message-id
AbstractRequestObserver requestObserver =
requestObservers.get(messageID);
if(requestObserver != null) {
Response response = new Response(message);
if(ResponseCode.isSuccess(ResponseCode.valueOf(response.getCode()))) {
requestObserver.onResponse(response);
} else {
requestObserver.onError(response);
}
}
return;
}
Request request = new Request(topic, message);
MQTTExchange exchange = new MQTTExchange(request, null);
exchange.setMqttClient(this.mqttClient);
Resource resource = getResource(request);
if(resource == null) {
// Check if its a POST operation, in which case
// we need to return the parent resource to create
// the new instance | if(request.getOperation() == Operation.POST) { |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/TestSectionModule.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
| import dagger.Module;
import dagger.Provides;
import javax.inject.Singleton;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection;
/**
* Created by Sergio Martinez Rodriguez
* Date 16/7/15.
*/
@Module
public class TestSectionModule{
| // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/TestSectionModule.java
import dagger.Module;
import dagger.Provides;
import javax.inject.Singleton;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection;
/**
* Created by Sergio Martinez Rodriguez
* Date 16/7/15.
*/
@Module
public class TestSectionModule{
| @PerSection @Provides public SectionProperty provideSectionProperty(){ |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/TestSectionModule.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
| import dagger.Module;
import dagger.Provides;
import javax.inject.Singleton;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection;
/**
* Created by Sergio Martinez Rodriguez
* Date 16/7/15.
*/
@Module
public class TestSectionModule{
@PerSection @Provides public SectionProperty provideSectionProperty(){
return new SectionProperty();
}
| // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/TestSectionModule.java
import dagger.Module;
import dagger.Provides;
import javax.inject.Singleton;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection;
/**
* Created by Sergio Martinez Rodriguez
* Date 16/7/15.
*/
@Module
public class TestSectionModule{
@PerSection @Provides public SectionProperty provideSectionProperty(){
return new SectionProperty();
}
| @Provides public NotScopedProperty provideNotScopedProperty(){ |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/App.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/AppComponent.java
// @Singleton @Component(modules = AppModule.class)
// public interface AppComponent {
// void inject(App app);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
| import android.app.Application;
import android.util.Log;
import java.util.HashMap;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.di.components.AppComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.components.DaggerAppComponent;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class App extends Application {
@Inject A a; | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/AppComponent.java
// @Singleton @Component(modules = AppModule.class)
// public interface AppComponent {
// void inject(App app);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/App.java
import android.app.Application;
import android.util.Log;
import java.util.HashMap;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.di.components.AppComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.components.DaggerAppComponent;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class App extends Application {
@Inject A a; | @Inject Log4Me logger; |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/App.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/AppComponent.java
// @Singleton @Component(modules = AppModule.class)
// public interface AppComponent {
// void inject(App app);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
| import android.app.Application;
import android.util.Log;
import java.util.HashMap;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.di.components.AppComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.components.DaggerAppComponent;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class App extends Application {
@Inject A a;
@Inject Log4Me logger;
@Inject List<String> diContainer;
| // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/AppComponent.java
// @Singleton @Component(modules = AppModule.class)
// public interface AppComponent {
// void inject(App app);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/App.java
import android.app.Application;
import android.util.Log;
import java.util.HashMap;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.di.components.AppComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.components.DaggerAppComponent;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class App extends Application {
@Inject A a;
@Inject Log4Me logger;
@Inject List<String> diContainer;
| private AppComponent appComponent; |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/activities/MainActivityComponent.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/AppComponent.java
// @Singleton @Component(modules = AppModule.class)
// public interface AppComponent {
// void inject(App app);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/ActivityModule.java
// @Module
// public class ActivityModule {
//
// BaseInjectionActivity baseInjectionActivity;
//
// public ActivityModule(BaseInjectionActivity baseInjectionActivity) {
// this.baseInjectionActivity = baseInjectionActivity;
// }
//
// @Provides @PerActivity B provideB(){
// return new B();
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/MainFragment.java
// public class MainFragment extends BaseFragment<MainFragmentComponent> {
//
// @Inject B b;
// @Inject A a;
// @Inject C c;
// @Inject List<String> diInjectioHistoric;
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// return inflater.inflate(R.layout.fragment_main, container, false);
// }
//
// @Override public void onStart() {
// super.onStart();
// testDI();
// }
//
// private void testDI() {
// diInjectioHistoric.add(MainFragment.class.getName());
// diInjectioHistoric.add(b.toString());
// diInjectioHistoric.add(a.toString());
// diInjectioHistoric.add(c.toString());
// }
//
// //region dependency injection Methods
// @Override protected void initDIComponent() {
// fragmentComponent = (getParentComponent(MainActivityComponent.class)).plus(
// new FragmentModule(this), new MainFragmentModule(this));
// fragmentComponent.injectFragment(this);
// }
//
// public interface Pluser{
// MainFragmentComponent plus(FragmentModule secondFragmentModule, MainFragmentModule baseFragmentModule);
// }
// //endregion
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
| import dagger.Component;
import java.util.List;
import me.martinez.sergio.daggertwobasearchitecture.di.components.AppComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.ActivityModule;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerActivity;
import me.martinez.sergio.daggertwobasearchitecture.fragments.MainFragment;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.activities;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@PerActivity
@Component(dependencies = AppComponent.class, modules = {ActivityModule.class, MainActivityModule.class}) | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/AppComponent.java
// @Singleton @Component(modules = AppModule.class)
// public interface AppComponent {
// void inject(App app);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/ActivityModule.java
// @Module
// public class ActivityModule {
//
// BaseInjectionActivity baseInjectionActivity;
//
// public ActivityModule(BaseInjectionActivity baseInjectionActivity) {
// this.baseInjectionActivity = baseInjectionActivity;
// }
//
// @Provides @PerActivity B provideB(){
// return new B();
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/MainFragment.java
// public class MainFragment extends BaseFragment<MainFragmentComponent> {
//
// @Inject B b;
// @Inject A a;
// @Inject C c;
// @Inject List<String> diInjectioHistoric;
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// return inflater.inflate(R.layout.fragment_main, container, false);
// }
//
// @Override public void onStart() {
// super.onStart();
// testDI();
// }
//
// private void testDI() {
// diInjectioHistoric.add(MainFragment.class.getName());
// diInjectioHistoric.add(b.toString());
// diInjectioHistoric.add(a.toString());
// diInjectioHistoric.add(c.toString());
// }
//
// //region dependency injection Methods
// @Override protected void initDIComponent() {
// fragmentComponent = (getParentComponent(MainActivityComponent.class)).plus(
// new FragmentModule(this), new MainFragmentModule(this));
// fragmentComponent.injectFragment(this);
// }
//
// public interface Pluser{
// MainFragmentComponent plus(FragmentModule secondFragmentModule, MainFragmentModule baseFragmentModule);
// }
// //endregion
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/activities/MainActivityComponent.java
import dagger.Component;
import java.util.List;
import me.martinez.sergio.daggertwobasearchitecture.di.components.AppComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.ActivityModule;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerActivity;
import me.martinez.sergio.daggertwobasearchitecture.fragments.MainFragment;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.activities;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@PerActivity
@Component(dependencies = AppComponent.class, modules = {ActivityModule.class, MainActivityModule.class}) | public interface MainActivityComponent extends MainFragment.Pluser{ |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/activities/MainActivityComponent.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/AppComponent.java
// @Singleton @Component(modules = AppModule.class)
// public interface AppComponent {
// void inject(App app);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/ActivityModule.java
// @Module
// public class ActivityModule {
//
// BaseInjectionActivity baseInjectionActivity;
//
// public ActivityModule(BaseInjectionActivity baseInjectionActivity) {
// this.baseInjectionActivity = baseInjectionActivity;
// }
//
// @Provides @PerActivity B provideB(){
// return new B();
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/MainFragment.java
// public class MainFragment extends BaseFragment<MainFragmentComponent> {
//
// @Inject B b;
// @Inject A a;
// @Inject C c;
// @Inject List<String> diInjectioHistoric;
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// return inflater.inflate(R.layout.fragment_main, container, false);
// }
//
// @Override public void onStart() {
// super.onStart();
// testDI();
// }
//
// private void testDI() {
// diInjectioHistoric.add(MainFragment.class.getName());
// diInjectioHistoric.add(b.toString());
// diInjectioHistoric.add(a.toString());
// diInjectioHistoric.add(c.toString());
// }
//
// //region dependency injection Methods
// @Override protected void initDIComponent() {
// fragmentComponent = (getParentComponent(MainActivityComponent.class)).plus(
// new FragmentModule(this), new MainFragmentModule(this));
// fragmentComponent.injectFragment(this);
// }
//
// public interface Pluser{
// MainFragmentComponent plus(FragmentModule secondFragmentModule, MainFragmentModule baseFragmentModule);
// }
// //endregion
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
| import dagger.Component;
import java.util.List;
import me.martinez.sergio.daggertwobasearchitecture.di.components.AppComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.ActivityModule;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerActivity;
import me.martinez.sergio.daggertwobasearchitecture.fragments.MainFragment;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.activities;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@PerActivity
@Component(dependencies = AppComponent.class, modules = {ActivityModule.class, MainActivityModule.class})
public interface MainActivityComponent extends MainFragment.Pluser{
void injectActivity(MainActivity mainActivity); | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/AppComponent.java
// @Singleton @Component(modules = AppModule.class)
// public interface AppComponent {
// void inject(App app);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/ActivityModule.java
// @Module
// public class ActivityModule {
//
// BaseInjectionActivity baseInjectionActivity;
//
// public ActivityModule(BaseInjectionActivity baseInjectionActivity) {
// this.baseInjectionActivity = baseInjectionActivity;
// }
//
// @Provides @PerActivity B provideB(){
// return new B();
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/MainFragment.java
// public class MainFragment extends BaseFragment<MainFragmentComponent> {
//
// @Inject B b;
// @Inject A a;
// @Inject C c;
// @Inject List<String> diInjectioHistoric;
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// return inflater.inflate(R.layout.fragment_main, container, false);
// }
//
// @Override public void onStart() {
// super.onStart();
// testDI();
// }
//
// private void testDI() {
// diInjectioHistoric.add(MainFragment.class.getName());
// diInjectioHistoric.add(b.toString());
// diInjectioHistoric.add(a.toString());
// diInjectioHistoric.add(c.toString());
// }
//
// //region dependency injection Methods
// @Override protected void initDIComponent() {
// fragmentComponent = (getParentComponent(MainActivityComponent.class)).plus(
// new FragmentModule(this), new MainFragmentModule(this));
// fragmentComponent.injectFragment(this);
// }
//
// public interface Pluser{
// MainFragmentComponent plus(FragmentModule secondFragmentModule, MainFragmentModule baseFragmentModule);
// }
// //endregion
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/activities/MainActivityComponent.java
import dagger.Component;
import java.util.List;
import me.martinez.sergio.daggertwobasearchitecture.di.components.AppComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.ActivityModule;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerActivity;
import me.martinez.sergio.daggertwobasearchitecture.fragments.MainFragment;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.activities;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@PerActivity
@Component(dependencies = AppComponent.class, modules = {ActivityModule.class, MainActivityModule.class})
public interface MainActivityComponent extends MainFragment.Pluser{
void injectActivity(MainActivity mainActivity); | A provideA(); |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/activities/MainActivityComponent.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/AppComponent.java
// @Singleton @Component(modules = AppModule.class)
// public interface AppComponent {
// void inject(App app);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/ActivityModule.java
// @Module
// public class ActivityModule {
//
// BaseInjectionActivity baseInjectionActivity;
//
// public ActivityModule(BaseInjectionActivity baseInjectionActivity) {
// this.baseInjectionActivity = baseInjectionActivity;
// }
//
// @Provides @PerActivity B provideB(){
// return new B();
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/MainFragment.java
// public class MainFragment extends BaseFragment<MainFragmentComponent> {
//
// @Inject B b;
// @Inject A a;
// @Inject C c;
// @Inject List<String> diInjectioHistoric;
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// return inflater.inflate(R.layout.fragment_main, container, false);
// }
//
// @Override public void onStart() {
// super.onStart();
// testDI();
// }
//
// private void testDI() {
// diInjectioHistoric.add(MainFragment.class.getName());
// diInjectioHistoric.add(b.toString());
// diInjectioHistoric.add(a.toString());
// diInjectioHistoric.add(c.toString());
// }
//
// //region dependency injection Methods
// @Override protected void initDIComponent() {
// fragmentComponent = (getParentComponent(MainActivityComponent.class)).plus(
// new FragmentModule(this), new MainFragmentModule(this));
// fragmentComponent.injectFragment(this);
// }
//
// public interface Pluser{
// MainFragmentComponent plus(FragmentModule secondFragmentModule, MainFragmentModule baseFragmentModule);
// }
// //endregion
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
| import dagger.Component;
import java.util.List;
import me.martinez.sergio.daggertwobasearchitecture.di.components.AppComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.ActivityModule;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerActivity;
import me.martinez.sergio.daggertwobasearchitecture.fragments.MainFragment;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.activities;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@PerActivity
@Component(dependencies = AppComponent.class, modules = {ActivityModule.class, MainActivityModule.class})
public interface MainActivityComponent extends MainFragment.Pluser{
void injectActivity(MainActivity mainActivity);
A provideA();
List<String> provideDiInjectionHistory(); | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/AppComponent.java
// @Singleton @Component(modules = AppModule.class)
// public interface AppComponent {
// void inject(App app);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/ActivityModule.java
// @Module
// public class ActivityModule {
//
// BaseInjectionActivity baseInjectionActivity;
//
// public ActivityModule(BaseInjectionActivity baseInjectionActivity) {
// this.baseInjectionActivity = baseInjectionActivity;
// }
//
// @Provides @PerActivity B provideB(){
// return new B();
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/MainFragment.java
// public class MainFragment extends BaseFragment<MainFragmentComponent> {
//
// @Inject B b;
// @Inject A a;
// @Inject C c;
// @Inject List<String> diInjectioHistoric;
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// return inflater.inflate(R.layout.fragment_main, container, false);
// }
//
// @Override public void onStart() {
// super.onStart();
// testDI();
// }
//
// private void testDI() {
// diInjectioHistoric.add(MainFragment.class.getName());
// diInjectioHistoric.add(b.toString());
// diInjectioHistoric.add(a.toString());
// diInjectioHistoric.add(c.toString());
// }
//
// //region dependency injection Methods
// @Override protected void initDIComponent() {
// fragmentComponent = (getParentComponent(MainActivityComponent.class)).plus(
// new FragmentModule(this), new MainFragmentModule(this));
// fragmentComponent.injectFragment(this);
// }
//
// public interface Pluser{
// MainFragmentComponent plus(FragmentModule secondFragmentModule, MainFragmentModule baseFragmentModule);
// }
// //endregion
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/activities/MainActivityComponent.java
import dagger.Component;
import java.util.List;
import me.martinez.sergio.daggertwobasearchitecture.di.components.AppComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.ActivityModule;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerActivity;
import me.martinez.sergio.daggertwobasearchitecture.fragments.MainFragment;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.activities;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@PerActivity
@Component(dependencies = AppComponent.class, modules = {ActivityModule.class, MainActivityModule.class})
public interface MainActivityComponent extends MainFragment.Pluser{
void injectActivity(MainActivity mainActivity);
A provideA();
List<String> provideDiInjectionHistory(); | Log4Me provideLog4Me(); |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/IncludedModule.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4MeImpl.java
// public class Log4MeImpl implements Log4Me {
//
// private int defaultLoglevel;
// private static final String LOGS_PREFIX = "DI TESTS :: ";
//
// public Log4MeImpl() {
// defaultLoglevel = Log.DEBUG;
// }
//
// @Override public void log(String message, int logLevel, Object clazz) {
// if (logLevel == Log.DEBUG){
// Log.d(clazz.getClass().getName(), LOGS_PREFIX + message);
// }
// }
//
// @Override public void log(String message, int logLevel) {
// log(message, defaultLoglevel, Log4MeImpl.class.getName()) ;
// }
//
// @Override public void log(String message) {
// log(message, defaultLoglevel);
// }
// }
| import dagger.Module;
import dagger.Provides;
import javax.inject.Singleton;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4MeImpl; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.modules;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module
public class IncludedModule { | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4MeImpl.java
// public class Log4MeImpl implements Log4Me {
//
// private int defaultLoglevel;
// private static final String LOGS_PREFIX = "DI TESTS :: ";
//
// public Log4MeImpl() {
// defaultLoglevel = Log.DEBUG;
// }
//
// @Override public void log(String message, int logLevel, Object clazz) {
// if (logLevel == Log.DEBUG){
// Log.d(clazz.getClass().getName(), LOGS_PREFIX + message);
// }
// }
//
// @Override public void log(String message, int logLevel) {
// log(message, defaultLoglevel, Log4MeImpl.class.getName()) ;
// }
//
// @Override public void log(String message) {
// log(message, defaultLoglevel);
// }
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/IncludedModule.java
import dagger.Module;
import dagger.Provides;
import javax.inject.Singleton;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4MeImpl;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.modules;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module
public class IncludedModule { | @Provides @Singleton A provideA(){ |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/IncludedModule.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4MeImpl.java
// public class Log4MeImpl implements Log4Me {
//
// private int defaultLoglevel;
// private static final String LOGS_PREFIX = "DI TESTS :: ";
//
// public Log4MeImpl() {
// defaultLoglevel = Log.DEBUG;
// }
//
// @Override public void log(String message, int logLevel, Object clazz) {
// if (logLevel == Log.DEBUG){
// Log.d(clazz.getClass().getName(), LOGS_PREFIX + message);
// }
// }
//
// @Override public void log(String message, int logLevel) {
// log(message, defaultLoglevel, Log4MeImpl.class.getName()) ;
// }
//
// @Override public void log(String message) {
// log(message, defaultLoglevel);
// }
// }
| import dagger.Module;
import dagger.Provides;
import javax.inject.Singleton;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4MeImpl; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.modules;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module
public class IncludedModule {
@Provides @Singleton A provideA(){
return new A();
} | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4MeImpl.java
// public class Log4MeImpl implements Log4Me {
//
// private int defaultLoglevel;
// private static final String LOGS_PREFIX = "DI TESTS :: ";
//
// public Log4MeImpl() {
// defaultLoglevel = Log.DEBUG;
// }
//
// @Override public void log(String message, int logLevel, Object clazz) {
// if (logLevel == Log.DEBUG){
// Log.d(clazz.getClass().getName(), LOGS_PREFIX + message);
// }
// }
//
// @Override public void log(String message, int logLevel) {
// log(message, defaultLoglevel, Log4MeImpl.class.getName()) ;
// }
//
// @Override public void log(String message) {
// log(message, defaultLoglevel);
// }
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/IncludedModule.java
import dagger.Module;
import dagger.Provides;
import javax.inject.Singleton;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4MeImpl;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.modules;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module
public class IncludedModule {
@Provides @Singleton A provideA(){
return new A();
} | @Provides @Singleton Log4Me provideLog4Me(){ |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/IncludedModule.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4MeImpl.java
// public class Log4MeImpl implements Log4Me {
//
// private int defaultLoglevel;
// private static final String LOGS_PREFIX = "DI TESTS :: ";
//
// public Log4MeImpl() {
// defaultLoglevel = Log.DEBUG;
// }
//
// @Override public void log(String message, int logLevel, Object clazz) {
// if (logLevel == Log.DEBUG){
// Log.d(clazz.getClass().getName(), LOGS_PREFIX + message);
// }
// }
//
// @Override public void log(String message, int logLevel) {
// log(message, defaultLoglevel, Log4MeImpl.class.getName()) ;
// }
//
// @Override public void log(String message) {
// log(message, defaultLoglevel);
// }
// }
| import dagger.Module;
import dagger.Provides;
import javax.inject.Singleton;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4MeImpl; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.modules;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module
public class IncludedModule {
@Provides @Singleton A provideA(){
return new A();
}
@Provides @Singleton Log4Me provideLog4Me(){ | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4MeImpl.java
// public class Log4MeImpl implements Log4Me {
//
// private int defaultLoglevel;
// private static final String LOGS_PREFIX = "DI TESTS :: ";
//
// public Log4MeImpl() {
// defaultLoglevel = Log.DEBUG;
// }
//
// @Override public void log(String message, int logLevel, Object clazz) {
// if (logLevel == Log.DEBUG){
// Log.d(clazz.getClass().getName(), LOGS_PREFIX + message);
// }
// }
//
// @Override public void log(String message, int logLevel) {
// log(message, defaultLoglevel, Log4MeImpl.class.getName()) ;
// }
//
// @Override public void log(String message) {
// log(message, defaultLoglevel);
// }
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/IncludedModule.java
import dagger.Module;
import dagger.Provides;
import javax.inject.Singleton;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4MeImpl;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.modules;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module
public class IncludedModule {
@Provides @Singleton A provideA(){
return new A();
}
@Provides @Singleton Log4Me provideLog4Me(){ | return new Log4MeImpl(); |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/MainFragment.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/activities/MainActivityComponent.java
// @PerActivity
// @Component(dependencies = AppComponent.class, modules = {ActivityModule.class, MainActivityModule.class})
// public interface MainActivityComponent extends MainFragment.Pluser{
// void injectActivity(MainActivity mainActivity);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/B.java
// public class B {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/C.java
// public class C {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
| import me.martinez.sergio.daggertwobasearchitecture.test.D;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.activities.MainActivityComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.test.B;
import me.martinez.sergio.daggertwobasearchitecture.test.C; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class MainFragment extends BaseFragment<MainFragmentComponent> {
@Inject B b; | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/activities/MainActivityComponent.java
// @PerActivity
// @Component(dependencies = AppComponent.class, modules = {ActivityModule.class, MainActivityModule.class})
// public interface MainActivityComponent extends MainFragment.Pluser{
// void injectActivity(MainActivity mainActivity);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/B.java
// public class B {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/C.java
// public class C {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/MainFragment.java
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.activities.MainActivityComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.test.B;
import me.martinez.sergio.daggertwobasearchitecture.test.C;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class MainFragment extends BaseFragment<MainFragmentComponent> {
@Inject B b; | @Inject A a; |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/MainFragment.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/activities/MainActivityComponent.java
// @PerActivity
// @Component(dependencies = AppComponent.class, modules = {ActivityModule.class, MainActivityModule.class})
// public interface MainActivityComponent extends MainFragment.Pluser{
// void injectActivity(MainActivity mainActivity);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/B.java
// public class B {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/C.java
// public class C {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
| import me.martinez.sergio.daggertwobasearchitecture.test.D;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.activities.MainActivityComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.test.B;
import me.martinez.sergio.daggertwobasearchitecture.test.C; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class MainFragment extends BaseFragment<MainFragmentComponent> {
@Inject B b;
@Inject A a; | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/activities/MainActivityComponent.java
// @PerActivity
// @Component(dependencies = AppComponent.class, modules = {ActivityModule.class, MainActivityModule.class})
// public interface MainActivityComponent extends MainFragment.Pluser{
// void injectActivity(MainActivity mainActivity);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/B.java
// public class B {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/C.java
// public class C {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/MainFragment.java
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.activities.MainActivityComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.test.B;
import me.martinez.sergio.daggertwobasearchitecture.test.C;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class MainFragment extends BaseFragment<MainFragmentComponent> {
@Inject B b;
@Inject A a; | @Inject C c; |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/MainFragment.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/activities/MainActivityComponent.java
// @PerActivity
// @Component(dependencies = AppComponent.class, modules = {ActivityModule.class, MainActivityModule.class})
// public interface MainActivityComponent extends MainFragment.Pluser{
// void injectActivity(MainActivity mainActivity);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/B.java
// public class B {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/C.java
// public class C {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
| import me.martinez.sergio.daggertwobasearchitecture.test.D;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.activities.MainActivityComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.test.B;
import me.martinez.sergio.daggertwobasearchitecture.test.C; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class MainFragment extends BaseFragment<MainFragmentComponent> {
@Inject B b;
@Inject A a;
@Inject C c;
@Inject List<String> diInjectioHistoric;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_main, container, false);
}
@Override public void onStart() {
super.onStart();
testDI();
}
private void testDI() {
diInjectioHistoric.add(MainFragment.class.getName());
diInjectioHistoric.add(b.toString());
diInjectioHistoric.add(a.toString());
diInjectioHistoric.add(c.toString());
}
//region dependency injection Methods
@Override protected void initDIComponent() { | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/activities/MainActivityComponent.java
// @PerActivity
// @Component(dependencies = AppComponent.class, modules = {ActivityModule.class, MainActivityModule.class})
// public interface MainActivityComponent extends MainFragment.Pluser{
// void injectActivity(MainActivity mainActivity);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/B.java
// public class B {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/C.java
// public class C {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/MainFragment.java
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.activities.MainActivityComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.test.B;
import me.martinez.sergio.daggertwobasearchitecture.test.C;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class MainFragment extends BaseFragment<MainFragmentComponent> {
@Inject B b;
@Inject A a;
@Inject C c;
@Inject List<String> diInjectioHistoric;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_main, container, false);
}
@Override public void onStart() {
super.onStart();
testDI();
}
private void testDI() {
diInjectioHistoric.add(MainFragment.class.getName());
diInjectioHistoric.add(b.toString());
diInjectioHistoric.add(a.toString());
diInjectioHistoric.add(c.toString());
}
//region dependency injection Methods
@Override protected void initDIComponent() { | fragmentComponent = (getParentComponent(MainActivityComponent.class)).plus( |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/MainFragment.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/activities/MainActivityComponent.java
// @PerActivity
// @Component(dependencies = AppComponent.class, modules = {ActivityModule.class, MainActivityModule.class})
// public interface MainActivityComponent extends MainFragment.Pluser{
// void injectActivity(MainActivity mainActivity);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/B.java
// public class B {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/C.java
// public class C {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
| import me.martinez.sergio.daggertwobasearchitecture.test.D;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.activities.MainActivityComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.test.B;
import me.martinez.sergio.daggertwobasearchitecture.test.C; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class MainFragment extends BaseFragment<MainFragmentComponent> {
@Inject B b;
@Inject A a;
@Inject C c;
@Inject List<String> diInjectioHistoric;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_main, container, false);
}
@Override public void onStart() {
super.onStart();
testDI();
}
private void testDI() {
diInjectioHistoric.add(MainFragment.class.getName());
diInjectioHistoric.add(b.toString());
diInjectioHistoric.add(a.toString());
diInjectioHistoric.add(c.toString());
}
//region dependency injection Methods
@Override protected void initDIComponent() {
fragmentComponent = (getParentComponent(MainActivityComponent.class)).plus( | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/activities/MainActivityComponent.java
// @PerActivity
// @Component(dependencies = AppComponent.class, modules = {ActivityModule.class, MainActivityModule.class})
// public interface MainActivityComponent extends MainFragment.Pluser{
// void injectActivity(MainActivity mainActivity);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/B.java
// public class B {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/C.java
// public class C {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/MainFragment.java
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.activities.MainActivityComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.test.B;
import me.martinez.sergio.daggertwobasearchitecture.test.C;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class MainFragment extends BaseFragment<MainFragmentComponent> {
@Inject B b;
@Inject A a;
@Inject C c;
@Inject List<String> diInjectioHistoric;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_main, container, false);
}
@Override public void onStart() {
super.onStart();
testDI();
}
private void testDI() {
diInjectioHistoric.add(MainFragment.class.getName());
diInjectioHistoric.add(b.toString());
diInjectioHistoric.add(a.toString());
diInjectioHistoric.add(c.toString());
}
//region dependency injection Methods
@Override protected void initDIComponent() {
fragmentComponent = (getParentComponent(MainActivityComponent.class)).plus( | new FragmentModule(this), new MainFragmentModule(this)); |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/MainFragmentModule.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/C.java
// public class C {}
| import dagger.Module;
import dagger.Provides;
import me.martinez.sergio.daggertwobasearchitecture.test.C; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module()
public class MainFragmentModule{
MainFragment mainFragment;
public MainFragmentModule(MainFragment mainFragment) {
this.mainFragment = mainFragment;
}
| // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/C.java
// public class C {}
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/MainFragmentModule.java
import dagger.Module;
import dagger.Provides;
import me.martinez.sergio.daggertwobasearchitecture.test.C;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module()
public class MainFragmentModule{
MainFragment mainFragment;
public MainFragmentModule(MainFragment mainFragment) {
this.mainFragment = mainFragment;
}
| @Provides C provideC(){ |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragmentModule.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentPresenter.java
// public class FirstFragmentPresenter {
//
// private final FirstFragmentView firstFragmentView;
// private final D d;
//
// public FirstFragmentPresenter(FirstFragmentView firstFragmentView, D d) {
// this.firstFragmentView = firstFragmentView;
// this.d = d;
// }
//
// public D getD(){
// return d;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentView.java
// public interface FirstFragmentView{
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
| import dagger.Module;
import dagger.Provides;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerFragment;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import me.martinez.sergio.daggertwobasearchitecture.test.E; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module()
public class FirstFragmentModule{
| // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentPresenter.java
// public class FirstFragmentPresenter {
//
// private final FirstFragmentView firstFragmentView;
// private final D d;
//
// public FirstFragmentPresenter(FirstFragmentView firstFragmentView, D d) {
// this.firstFragmentView = firstFragmentView;
// this.d = d;
// }
//
// public D getD(){
// return d;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentView.java
// public interface FirstFragmentView{
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragmentModule.java
import dagger.Module;
import dagger.Provides;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerFragment;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import me.martinez.sergio.daggertwobasearchitecture.test.E;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module()
public class FirstFragmentModule{
| private FirstFragmentView firstFragmentView; |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragmentModule.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentPresenter.java
// public class FirstFragmentPresenter {
//
// private final FirstFragmentView firstFragmentView;
// private final D d;
//
// public FirstFragmentPresenter(FirstFragmentView firstFragmentView, D d) {
// this.firstFragmentView = firstFragmentView;
// this.d = d;
// }
//
// public D getD(){
// return d;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentView.java
// public interface FirstFragmentView{
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
| import dagger.Module;
import dagger.Provides;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerFragment;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import me.martinez.sergio.daggertwobasearchitecture.test.E; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module()
public class FirstFragmentModule{
private FirstFragmentView firstFragmentView;
public FirstFragmentModule(FirstFragmentView firstFragmentView) {
this.firstFragmentView = firstFragmentView;
}
| // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentPresenter.java
// public class FirstFragmentPresenter {
//
// private final FirstFragmentView firstFragmentView;
// private final D d;
//
// public FirstFragmentPresenter(FirstFragmentView firstFragmentView, D d) {
// this.firstFragmentView = firstFragmentView;
// this.d = d;
// }
//
// public D getD(){
// return d;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentView.java
// public interface FirstFragmentView{
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragmentModule.java
import dagger.Module;
import dagger.Provides;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerFragment;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import me.martinez.sergio.daggertwobasearchitecture.test.E;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module()
public class FirstFragmentModule{
private FirstFragmentView firstFragmentView;
public FirstFragmentModule(FirstFragmentView firstFragmentView) {
this.firstFragmentView = firstFragmentView;
}
| @PerFragment @Provides FirstFragmentPresenter provideFirstFragmentPresenter(D d){ |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragmentModule.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentPresenter.java
// public class FirstFragmentPresenter {
//
// private final FirstFragmentView firstFragmentView;
// private final D d;
//
// public FirstFragmentPresenter(FirstFragmentView firstFragmentView, D d) {
// this.firstFragmentView = firstFragmentView;
// this.d = d;
// }
//
// public D getD(){
// return d;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentView.java
// public interface FirstFragmentView{
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
| import dagger.Module;
import dagger.Provides;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerFragment;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import me.martinez.sergio.daggertwobasearchitecture.test.E; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module()
public class FirstFragmentModule{
private FirstFragmentView firstFragmentView;
public FirstFragmentModule(FirstFragmentView firstFragmentView) {
this.firstFragmentView = firstFragmentView;
}
| // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentPresenter.java
// public class FirstFragmentPresenter {
//
// private final FirstFragmentView firstFragmentView;
// private final D d;
//
// public FirstFragmentPresenter(FirstFragmentView firstFragmentView, D d) {
// this.firstFragmentView = firstFragmentView;
// this.d = d;
// }
//
// public D getD(){
// return d;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentView.java
// public interface FirstFragmentView{
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragmentModule.java
import dagger.Module;
import dagger.Provides;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerFragment;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import me.martinez.sergio.daggertwobasearchitecture.test.E;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module()
public class FirstFragmentModule{
private FirstFragmentView firstFragmentView;
public FirstFragmentModule(FirstFragmentView firstFragmentView) {
this.firstFragmentView = firstFragmentView;
}
| @PerFragment @Provides FirstFragmentPresenter provideFirstFragmentPresenter(D d){ |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragmentModule.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentPresenter.java
// public class FirstFragmentPresenter {
//
// private final FirstFragmentView firstFragmentView;
// private final D d;
//
// public FirstFragmentPresenter(FirstFragmentView firstFragmentView, D d) {
// this.firstFragmentView = firstFragmentView;
// this.d = d;
// }
//
// public D getD(){
// return d;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentView.java
// public interface FirstFragmentView{
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
| import dagger.Module;
import dagger.Provides;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerFragment;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import me.martinez.sergio.daggertwobasearchitecture.test.E; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module()
public class FirstFragmentModule{
private FirstFragmentView firstFragmentView;
public FirstFragmentModule(FirstFragmentView firstFragmentView) {
this.firstFragmentView = firstFragmentView;
}
@PerFragment @Provides FirstFragmentPresenter provideFirstFragmentPresenter(D d){
return new FirstFragmentPresenter(firstFragmentView, d);
}
| // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentPresenter.java
// public class FirstFragmentPresenter {
//
// private final FirstFragmentView firstFragmentView;
// private final D d;
//
// public FirstFragmentPresenter(FirstFragmentView firstFragmentView, D d) {
// this.firstFragmentView = firstFragmentView;
// this.d = d;
// }
//
// public D getD(){
// return d;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentView.java
// public interface FirstFragmentView{
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragmentModule.java
import dagger.Module;
import dagger.Provides;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerFragment;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import me.martinez.sergio.daggertwobasearchitecture.test.E;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module()
public class FirstFragmentModule{
private FirstFragmentView firstFragmentView;
public FirstFragmentModule(FirstFragmentView firstFragmentView) {
this.firstFragmentView = firstFragmentView;
}
@PerFragment @Provides FirstFragmentPresenter provideFirstFragmentPresenter(D d){
return new FirstFragmentPresenter(firstFragmentView, d);
}
| @PerFragment @Provides E provideE(){ |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/SecondFragment.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentPresenter.java
// public class SecondFragmentPresenter {
//
// private final SecondFragmentView secondFragmentView;
//
// public SecondFragmentPresenter(SecondFragmentView secondFragmentView) {
// this.secondFragmentView = secondFragmentView;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentView.java
// public interface SecondFragmentView {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
| import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.D; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class SecondFragment extends BaseFragment<SecondFragmentComponent> implements
SecondFragmentView{
| // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentPresenter.java
// public class SecondFragmentPresenter {
//
// private final SecondFragmentView secondFragmentView;
//
// public SecondFragmentPresenter(SecondFragmentView secondFragmentView) {
// this.secondFragmentView = secondFragmentView;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentView.java
// public interface SecondFragmentView {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/SecondFragment.java
import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class SecondFragment extends BaseFragment<SecondFragmentComponent> implements
SecondFragmentView{
| @Inject SecondFragmentPresenter secondFragmentPresenter; |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/SecondFragment.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentPresenter.java
// public class SecondFragmentPresenter {
//
// private final SecondFragmentView secondFragmentView;
//
// public SecondFragmentPresenter(SecondFragmentView secondFragmentView) {
// this.secondFragmentView = secondFragmentView;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentView.java
// public interface SecondFragmentView {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
| import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.D; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class SecondFragment extends BaseFragment<SecondFragmentComponent> implements
SecondFragmentView{
@Inject SecondFragmentPresenter secondFragmentPresenter; | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentPresenter.java
// public class SecondFragmentPresenter {
//
// private final SecondFragmentView secondFragmentView;
//
// public SecondFragmentPresenter(SecondFragmentView secondFragmentView) {
// this.secondFragmentView = secondFragmentView;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentView.java
// public interface SecondFragmentView {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/SecondFragment.java
import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class SecondFragment extends BaseFragment<SecondFragmentComponent> implements
SecondFragmentView{
@Inject SecondFragmentPresenter secondFragmentPresenter; | @Inject SectionProperty sectionProperty; |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/SecondFragment.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentPresenter.java
// public class SecondFragmentPresenter {
//
// private final SecondFragmentView secondFragmentView;
//
// public SecondFragmentPresenter(SecondFragmentView secondFragmentView) {
// this.secondFragmentView = secondFragmentView;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentView.java
// public interface SecondFragmentView {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
| import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.D; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class SecondFragment extends BaseFragment<SecondFragmentComponent> implements
SecondFragmentView{
@Inject SecondFragmentPresenter secondFragmentPresenter;
@Inject SectionProperty sectionProperty; | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentPresenter.java
// public class SecondFragmentPresenter {
//
// private final SecondFragmentView secondFragmentView;
//
// public SecondFragmentPresenter(SecondFragmentView secondFragmentView) {
// this.secondFragmentView = secondFragmentView;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentView.java
// public interface SecondFragmentView {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/SecondFragment.java
import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class SecondFragment extends BaseFragment<SecondFragmentComponent> implements
SecondFragmentView{
@Inject SecondFragmentPresenter secondFragmentPresenter;
@Inject SectionProperty sectionProperty; | @Inject NotScopedProperty notScopedProperty; |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/SecondFragment.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentPresenter.java
// public class SecondFragmentPresenter {
//
// private final SecondFragmentView secondFragmentView;
//
// public SecondFragmentPresenter(SecondFragmentView secondFragmentView) {
// this.secondFragmentView = secondFragmentView;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentView.java
// public interface SecondFragmentView {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
| import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.D; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class SecondFragment extends BaseFragment<SecondFragmentComponent> implements
SecondFragmentView{
@Inject SecondFragmentPresenter secondFragmentPresenter;
@Inject SectionProperty sectionProperty;
@Inject NotScopedProperty notScopedProperty;
@Inject List<String> diInjectionHistory; | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentPresenter.java
// public class SecondFragmentPresenter {
//
// private final SecondFragmentView secondFragmentView;
//
// public SecondFragmentPresenter(SecondFragmentView secondFragmentView) {
// this.secondFragmentView = secondFragmentView;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentView.java
// public interface SecondFragmentView {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/SecondFragment.java
import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class SecondFragment extends BaseFragment<SecondFragmentComponent> implements
SecondFragmentView{
@Inject SecondFragmentPresenter secondFragmentPresenter;
@Inject SectionProperty sectionProperty;
@Inject NotScopedProperty notScopedProperty;
@Inject List<String> diInjectionHistory; | @Inject Log4Me logger; |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/SecondFragment.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentPresenter.java
// public class SecondFragmentPresenter {
//
// private final SecondFragmentView secondFragmentView;
//
// public SecondFragmentPresenter(SecondFragmentView secondFragmentView) {
// this.secondFragmentView = secondFragmentView;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentView.java
// public interface SecondFragmentView {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
| import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.D; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class SecondFragment extends BaseFragment<SecondFragmentComponent> implements
SecondFragmentView{
@Inject SecondFragmentPresenter secondFragmentPresenter;
@Inject SectionProperty sectionProperty;
@Inject NotScopedProperty notScopedProperty;
@Inject List<String> diInjectionHistory;
@Inject Log4Me logger; | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentPresenter.java
// public class SecondFragmentPresenter {
//
// private final SecondFragmentView secondFragmentView;
//
// public SecondFragmentPresenter(SecondFragmentView secondFragmentView) {
// this.secondFragmentView = secondFragmentView;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentView.java
// public interface SecondFragmentView {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/SecondFragment.java
import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class SecondFragment extends BaseFragment<SecondFragmentComponent> implements
SecondFragmentView{
@Inject SecondFragmentPresenter secondFragmentPresenter;
@Inject SectionProperty sectionProperty;
@Inject NotScopedProperty notScopedProperty;
@Inject List<String> diInjectionHistory;
@Inject Log4Me logger; | @Inject E e; |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/SecondFragment.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentPresenter.java
// public class SecondFragmentPresenter {
//
// private final SecondFragmentView secondFragmentView;
//
// public SecondFragmentPresenter(SecondFragmentView secondFragmentView) {
// this.secondFragmentView = secondFragmentView;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentView.java
// public interface SecondFragmentView {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
| import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.D; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class SecondFragment extends BaseFragment<SecondFragmentComponent> implements
SecondFragmentView{
@Inject SecondFragmentPresenter secondFragmentPresenter;
@Inject SectionProperty sectionProperty;
@Inject NotScopedProperty notScopedProperty;
@Inject List<String> diInjectionHistory;
@Inject Log4Me logger;
@Inject E e; | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentPresenter.java
// public class SecondFragmentPresenter {
//
// private final SecondFragmentView secondFragmentView;
//
// public SecondFragmentPresenter(SecondFragmentView secondFragmentView) {
// this.secondFragmentView = secondFragmentView;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentView.java
// public interface SecondFragmentView {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/SecondFragment.java
import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class SecondFragment extends BaseFragment<SecondFragmentComponent> implements
SecondFragmentView{
@Inject SecondFragmentPresenter secondFragmentPresenter;
@Inject SectionProperty sectionProperty;
@Inject NotScopedProperty notScopedProperty;
@Inject List<String> diInjectionHistory;
@Inject Log4Me logger;
@Inject E e; | @Inject D d; |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/SecondFragmentModule.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentPresenter.java
// public class SecondFragmentPresenter {
//
// private final SecondFragmentView secondFragmentView;
//
// public SecondFragmentPresenter(SecondFragmentView secondFragmentView) {
// this.secondFragmentView = secondFragmentView;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentView.java
// public interface SecondFragmentView {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
| import dagger.Module;
import dagger.Provides;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerFragment;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.E; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module()
public class SecondFragmentModule{
| // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentPresenter.java
// public class SecondFragmentPresenter {
//
// private final SecondFragmentView secondFragmentView;
//
// public SecondFragmentPresenter(SecondFragmentView secondFragmentView) {
// this.secondFragmentView = secondFragmentView;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentView.java
// public interface SecondFragmentView {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/SecondFragmentModule.java
import dagger.Module;
import dagger.Provides;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerFragment;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.E;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module()
public class SecondFragmentModule{
| private SecondFragmentView secondFragmentView; |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/SecondFragmentModule.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentPresenter.java
// public class SecondFragmentPresenter {
//
// private final SecondFragmentView secondFragmentView;
//
// public SecondFragmentPresenter(SecondFragmentView secondFragmentView) {
// this.secondFragmentView = secondFragmentView;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentView.java
// public interface SecondFragmentView {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
| import dagger.Module;
import dagger.Provides;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerFragment;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.E; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module()
public class SecondFragmentModule{
private SecondFragmentView secondFragmentView;
public SecondFragmentModule(SecondFragmentView secondFragmentView) {
this.secondFragmentView = secondFragmentView;
}
| // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentPresenter.java
// public class SecondFragmentPresenter {
//
// private final SecondFragmentView secondFragmentView;
//
// public SecondFragmentPresenter(SecondFragmentView secondFragmentView) {
// this.secondFragmentView = secondFragmentView;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentView.java
// public interface SecondFragmentView {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/SecondFragmentModule.java
import dagger.Module;
import dagger.Provides;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerFragment;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.E;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module()
public class SecondFragmentModule{
private SecondFragmentView secondFragmentView;
public SecondFragmentModule(SecondFragmentView secondFragmentView) {
this.secondFragmentView = secondFragmentView;
}
| @PerFragment @Provides SecondFragmentPresenter provideSecondFragmentPresenter(){ |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/SecondFragmentModule.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentPresenter.java
// public class SecondFragmentPresenter {
//
// private final SecondFragmentView secondFragmentView;
//
// public SecondFragmentPresenter(SecondFragmentView secondFragmentView) {
// this.secondFragmentView = secondFragmentView;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentView.java
// public interface SecondFragmentView {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
| import dagger.Module;
import dagger.Provides;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerFragment;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.E; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module()
public class SecondFragmentModule{
private SecondFragmentView secondFragmentView;
public SecondFragmentModule(SecondFragmentView secondFragmentView) {
this.secondFragmentView = secondFragmentView;
}
@PerFragment @Provides SecondFragmentPresenter provideSecondFragmentPresenter(){
return new SecondFragmentPresenter(secondFragmentView);
}
| // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentPresenter.java
// public class SecondFragmentPresenter {
//
// private final SecondFragmentView secondFragmentView;
//
// public SecondFragmentPresenter(SecondFragmentView secondFragmentView) {
// this.secondFragmentView = secondFragmentView;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/presentation/SecondFragmentView.java
// public interface SecondFragmentView {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/SecondFragmentModule.java
import dagger.Module;
import dagger.Provides;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerFragment;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.presentation.SecondFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.E;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module()
public class SecondFragmentModule{
private SecondFragmentView secondFragmentView;
public SecondFragmentModule(SecondFragmentView secondFragmentView) {
this.secondFragmentView = secondFragmentView;
}
@PerFragment @Provides SecondFragmentPresenter provideSecondFragmentPresenter(){
return new SecondFragmentPresenter(secondFragmentView);
}
| @PerFragment @Provides E provideE(){ |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/AppComponent.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/App.java
// public class App extends Application {
//
// @Inject A a;
// @Inject Log4Me logger;
// @Inject List<String> diContainer;
//
// private AppComponent appComponent;
//
// @Override public void onCreate() {
// super.onCreate();
//
// initDI();
// testDI();
//
// }
//
// private void initDI() {
// appComponent = DaggerAppComponent.create();
//
// /** DaggerAppComponent.create() is equivalent to :
// * DaggerAppComponent.builder().appModule(new AppModule()).build()
// * when module has not arguments
// **/
//
// appComponent.inject(this);
// }
//
// private void testDI() {
//
// diContainer.add(App.class.getName());
//
// if (logger != null ){
// diContainer.add(logger.toString());
// }
//
// if (a!=null){
// logger.log("Dependency Injection is working");
// diContainer.add(a.toString());
//
// }
// }
//
// public AppComponent getAppComponent() {
// return appComponent;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/AppModule.java
// @Module(includes = IncludedModule.class)
// public class AppModule {
//
// @Singleton @Provides List<String> provideDiInjectionHistory(){
// return new ArrayList<>();
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
| import dagger.Component;
import java.util.List;
import javax.inject.Singleton;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.App;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.AppModule;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.components;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Singleton @Component(modules = AppModule.class)
public interface AppComponent { | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/App.java
// public class App extends Application {
//
// @Inject A a;
// @Inject Log4Me logger;
// @Inject List<String> diContainer;
//
// private AppComponent appComponent;
//
// @Override public void onCreate() {
// super.onCreate();
//
// initDI();
// testDI();
//
// }
//
// private void initDI() {
// appComponent = DaggerAppComponent.create();
//
// /** DaggerAppComponent.create() is equivalent to :
// * DaggerAppComponent.builder().appModule(new AppModule()).build()
// * when module has not arguments
// **/
//
// appComponent.inject(this);
// }
//
// private void testDI() {
//
// diContainer.add(App.class.getName());
//
// if (logger != null ){
// diContainer.add(logger.toString());
// }
//
// if (a!=null){
// logger.log("Dependency Injection is working");
// diContainer.add(a.toString());
//
// }
// }
//
// public AppComponent getAppComponent() {
// return appComponent;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/AppModule.java
// @Module(includes = IncludedModule.class)
// public class AppModule {
//
// @Singleton @Provides List<String> provideDiInjectionHistory(){
// return new ArrayList<>();
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/AppComponent.java
import dagger.Component;
import java.util.List;
import javax.inject.Singleton;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.App;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.AppModule;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.components;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Singleton @Component(modules = AppModule.class)
public interface AppComponent { | void inject(App app); |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/AppComponent.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/App.java
// public class App extends Application {
//
// @Inject A a;
// @Inject Log4Me logger;
// @Inject List<String> diContainer;
//
// private AppComponent appComponent;
//
// @Override public void onCreate() {
// super.onCreate();
//
// initDI();
// testDI();
//
// }
//
// private void initDI() {
// appComponent = DaggerAppComponent.create();
//
// /** DaggerAppComponent.create() is equivalent to :
// * DaggerAppComponent.builder().appModule(new AppModule()).build()
// * when module has not arguments
// **/
//
// appComponent.inject(this);
// }
//
// private void testDI() {
//
// diContainer.add(App.class.getName());
//
// if (logger != null ){
// diContainer.add(logger.toString());
// }
//
// if (a!=null){
// logger.log("Dependency Injection is working");
// diContainer.add(a.toString());
//
// }
// }
//
// public AppComponent getAppComponent() {
// return appComponent;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/AppModule.java
// @Module(includes = IncludedModule.class)
// public class AppModule {
//
// @Singleton @Provides List<String> provideDiInjectionHistory(){
// return new ArrayList<>();
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
| import dagger.Component;
import java.util.List;
import javax.inject.Singleton;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.App;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.AppModule;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.components;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Singleton @Component(modules = AppModule.class)
public interface AppComponent {
void inject(App app); | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/App.java
// public class App extends Application {
//
// @Inject A a;
// @Inject Log4Me logger;
// @Inject List<String> diContainer;
//
// private AppComponent appComponent;
//
// @Override public void onCreate() {
// super.onCreate();
//
// initDI();
// testDI();
//
// }
//
// private void initDI() {
// appComponent = DaggerAppComponent.create();
//
// /** DaggerAppComponent.create() is equivalent to :
// * DaggerAppComponent.builder().appModule(new AppModule()).build()
// * when module has not arguments
// **/
//
// appComponent.inject(this);
// }
//
// private void testDI() {
//
// diContainer.add(App.class.getName());
//
// if (logger != null ){
// diContainer.add(logger.toString());
// }
//
// if (a!=null){
// logger.log("Dependency Injection is working");
// diContainer.add(a.toString());
//
// }
// }
//
// public AppComponent getAppComponent() {
// return appComponent;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/AppModule.java
// @Module(includes = IncludedModule.class)
// public class AppModule {
//
// @Singleton @Provides List<String> provideDiInjectionHistory(){
// return new ArrayList<>();
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/AppComponent.java
import dagger.Component;
import java.util.List;
import javax.inject.Singleton;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.App;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.AppModule;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.components;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Singleton @Component(modules = AppModule.class)
public interface AppComponent {
void inject(App app); | A provideA(); |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/AppComponent.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/App.java
// public class App extends Application {
//
// @Inject A a;
// @Inject Log4Me logger;
// @Inject List<String> diContainer;
//
// private AppComponent appComponent;
//
// @Override public void onCreate() {
// super.onCreate();
//
// initDI();
// testDI();
//
// }
//
// private void initDI() {
// appComponent = DaggerAppComponent.create();
//
// /** DaggerAppComponent.create() is equivalent to :
// * DaggerAppComponent.builder().appModule(new AppModule()).build()
// * when module has not arguments
// **/
//
// appComponent.inject(this);
// }
//
// private void testDI() {
//
// diContainer.add(App.class.getName());
//
// if (logger != null ){
// diContainer.add(logger.toString());
// }
//
// if (a!=null){
// logger.log("Dependency Injection is working");
// diContainer.add(a.toString());
//
// }
// }
//
// public AppComponent getAppComponent() {
// return appComponent;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/AppModule.java
// @Module(includes = IncludedModule.class)
// public class AppModule {
//
// @Singleton @Provides List<String> provideDiInjectionHistory(){
// return new ArrayList<>();
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
| import dagger.Component;
import java.util.List;
import javax.inject.Singleton;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.App;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.AppModule;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.components;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Singleton @Component(modules = AppModule.class)
public interface AppComponent {
void inject(App app);
A provideA();
List<String> provideDiInjectionHistory(); | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/App.java
// public class App extends Application {
//
// @Inject A a;
// @Inject Log4Me logger;
// @Inject List<String> diContainer;
//
// private AppComponent appComponent;
//
// @Override public void onCreate() {
// super.onCreate();
//
// initDI();
// testDI();
//
// }
//
// private void initDI() {
// appComponent = DaggerAppComponent.create();
//
// /** DaggerAppComponent.create() is equivalent to :
// * DaggerAppComponent.builder().appModule(new AppModule()).build()
// * when module has not arguments
// **/
//
// appComponent.inject(this);
// }
//
// private void testDI() {
//
// diContainer.add(App.class.getName());
//
// if (logger != null ){
// diContainer.add(logger.toString());
// }
//
// if (a!=null){
// logger.log("Dependency Injection is working");
// diContainer.add(a.toString());
//
// }
// }
//
// public AppComponent getAppComponent() {
// return appComponent;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/AppModule.java
// @Module(includes = IncludedModule.class)
// public class AppModule {
//
// @Singleton @Provides List<String> provideDiInjectionHistory(){
// return new ArrayList<>();
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/utils/Log4Me.java
// public interface Log4Me {
// void log(String message, int logLevel, Object clazz);
// void log(String message, int logLevel);
// void log(String message);
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/AppComponent.java
import dagger.Component;
import java.util.List;
import javax.inject.Singleton;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.App;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.AppModule;
import me.martinez.sergio.daggertwobasearchitecture.utils.Log4Me;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.components;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Singleton @Component(modules = AppModule.class)
public interface AppComponent {
void inject(App app);
A provideA();
List<String> provideDiInjectionHistory(); | Log4Me provideLog4Me(); |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/ActivityModule.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseInjectionActivity.java
// public abstract class BaseInjectionActivity<T> extends AppCompatActivity{
//
// protected T activityComponent;
//
// @Override protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDI();
// }
//
// protected abstract void initDI();
//
// public AppComponent getAppComponent() {
// AppComponent appComponent = ((App) getApplication()).getAppComponent();
// return appComponent;
// }
//
// public Object getActivityComponent() {
// return activityComponent;
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/B.java
// public class B {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
| import dagger.Module;
import dagger.Provides;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerActivity;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseInjectionActivity;
import me.martinez.sergio.daggertwobasearchitecture.test.B;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.modules;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module
public class ActivityModule {
| // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseInjectionActivity.java
// public abstract class BaseInjectionActivity<T> extends AppCompatActivity{
//
// protected T activityComponent;
//
// @Override protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDI();
// }
//
// protected abstract void initDI();
//
// public AppComponent getAppComponent() {
// AppComponent appComponent = ((App) getApplication()).getAppComponent();
// return appComponent;
// }
//
// public Object getActivityComponent() {
// return activityComponent;
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/B.java
// public class B {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/ActivityModule.java
import dagger.Module;
import dagger.Provides;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerActivity;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseInjectionActivity;
import me.martinez.sergio.daggertwobasearchitecture.test.B;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.modules;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module
public class ActivityModule {
| BaseInjectionActivity baseInjectionActivity; |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/ActivityModule.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseInjectionActivity.java
// public abstract class BaseInjectionActivity<T> extends AppCompatActivity{
//
// protected T activityComponent;
//
// @Override protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDI();
// }
//
// protected abstract void initDI();
//
// public AppComponent getAppComponent() {
// AppComponent appComponent = ((App) getApplication()).getAppComponent();
// return appComponent;
// }
//
// public Object getActivityComponent() {
// return activityComponent;
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/B.java
// public class B {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
| import dagger.Module;
import dagger.Provides;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerActivity;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseInjectionActivity;
import me.martinez.sergio.daggertwobasearchitecture.test.B;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.modules;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module
public class ActivityModule {
BaseInjectionActivity baseInjectionActivity;
public ActivityModule(BaseInjectionActivity baseInjectionActivity) {
this.baseInjectionActivity = baseInjectionActivity;
}
| // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseInjectionActivity.java
// public abstract class BaseInjectionActivity<T> extends AppCompatActivity{
//
// protected T activityComponent;
//
// @Override protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDI();
// }
//
// protected abstract void initDI();
//
// public AppComponent getAppComponent() {
// AppComponent appComponent = ((App) getApplication()).getAppComponent();
// return appComponent;
// }
//
// public Object getActivityComponent() {
// return activityComponent;
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/B.java
// public class B {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/ActivityModule.java
import dagger.Module;
import dagger.Provides;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerActivity;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseInjectionActivity;
import me.martinez.sergio.daggertwobasearchitecture.test.B;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.modules;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@Module
public class ActivityModule {
BaseInjectionActivity baseInjectionActivity;
public ActivityModule(BaseInjectionActivity baseInjectionActivity) {
this.baseInjectionActivity = baseInjectionActivity;
}
| @Provides @PerActivity B provideB(){ |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseInjectionActivity.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/AppComponent.java
// @Singleton @Component(modules = AppModule.class)
// public interface AppComponent {
// void inject(App app);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
| import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import me.martinez.sergio.daggertwobasearchitecture.di.components.AppComponent; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public abstract class BaseInjectionActivity<T> extends AppCompatActivity{
protected T activityComponent;
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initDI();
}
protected abstract void initDI();
| // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/AppComponent.java
// @Singleton @Component(modules = AppModule.class)
// public interface AppComponent {
// void inject(App app);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseInjectionActivity.java
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import me.martinez.sergio.daggertwobasearchitecture.di.components.AppComponent;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public abstract class BaseInjectionActivity<T> extends AppCompatActivity{
protected T activityComponent;
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initDI();
}
protected abstract void initDI();
| public AppComponent getAppComponent() { |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
| import dagger.Module;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.modules;
/**
* Created by Sergio Martinez Rodriguez
* Date 16/7/15.
*/
@Module
public class FragmentModule { | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
import dagger.Module;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.modules;
/**
* Created by Sergio Martinez Rodriguez
* Date 16/7/15.
*/
@Module
public class FragmentModule { | BaseFragment baseFragment; |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/activities/MainActivityComponent.java
// @PerActivity
// @Component(dependencies = AppComponent.class, modules = {ActivityModule.class, MainActivityModule.class})
// public interface MainActivityComponent extends MainFragment.Pluser{
// void injectActivity(MainActivity mainActivity);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/TestSectionModule.java
// @Module
// public class TestSectionModule{
//
// @PerSection @Provides public SectionProperty provideSectionProperty(){
// return new SectionProperty();
// }
//
// @Provides public NotScopedProperty provideNotScopedProperty(){
// return new NotScopedProperty();
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragment.java
// public class FirstFragment extends BaseFragment<FirstFragmentComponent> implements
// FirstFragmentView {
//
// @Inject A a;
// @Inject E e;
// @Inject D d;
// @Inject List<String> diInjectionHistory;
// @Inject FirstFragmentPresenter firstFragmentPresenter;
// @Inject SectionProperty sectionProperty;
// @Inject NotScopedProperty notScopedProperty;
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// return inflater.inflate(R.layout.fragment_main, container, false);
// }
//
// @Override public void onStart() {
// super.onStart();
// testDI();
// }
//
// //region Test DI stuff
// private void testDI() {
//
// diInjectionHistory.add(FirstFragment.class.getName());
// diInjectionHistory.add(firstFragmentPresenter.toString());
// diInjectionHistory.add(notScopedProperty.toString());
// diInjectionHistory.add(sectionProperty.toString());
// diInjectionHistory.add(a.toString());
// diInjectionHistory.add(e.toString());
// diInjectionHistory.add(d.toString());
//
// }
//
// @Override protected void initDIComponent() {
// fragmentComponent = (getParentComponent(SectionComponentMain.class)).plus(
// new FragmentModule(this), new FirstFragmentModule(this));
// fragmentComponent.injectFragment(this);
// }
//
// public interface Pluser{
// FirstFragmentComponent plus(FragmentModule fragmentModule, FirstFragmentModule firstFragmentModule);
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/SecondFragment.java
// public class SecondFragment extends BaseFragment<SecondFragmentComponent> implements
// SecondFragmentView{
//
// @Inject SecondFragmentPresenter secondFragmentPresenter;
// @Inject SectionProperty sectionProperty;
// @Inject NotScopedProperty notScopedProperty;
// @Inject List<String> diInjectionHistory;
// @Inject Log4Me logger;
// @Inject E e;
// @Inject D d;
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// return inflater.inflate(R.layout.fragment_main, container, false);
// }
//
// @Override public void onStart() {
// super.onStart();
// testDI();
// }
//
// //region Test DI stuff
// private void testDI() {
//
// diInjectionHistory.add(SecondFragment.class.getName());
// diInjectionHistory.add(secondFragmentPresenter.toString());
// diInjectionHistory.add(notScopedProperty.toString());
// diInjectionHistory.add(sectionProperty.toString());
// diInjectionHistory.add(logger.toString());
// diInjectionHistory.add(e.toString());
// diInjectionHistory.add(d.toString());
//
// logger.log(diInjectionHistory.toString());
//
//
// }
//
// @Override protected void initDIComponent() {
// fragmentComponent = (getParentComponent(SectionComponentMain.class)).plus(
// new FragmentModule(this), new SecondFragmentModule(this));
// fragmentComponent.injectFragment(this);
// }
//
// public interface Pluser{
// SecondFragmentComponent plus(FragmentModule secondFragmentModule, SecondFragmentModule firstFragmentModule);
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
| import dagger.Component;
import me.martinez.sergio.daggertwobasearchitecture.activities.MainActivityComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.TestSectionModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.FirstFragment;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.SecondFragment;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.components;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@PerSection
@Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
public interface SectionComponentMain extends | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/activities/MainActivityComponent.java
// @PerActivity
// @Component(dependencies = AppComponent.class, modules = {ActivityModule.class, MainActivityModule.class})
// public interface MainActivityComponent extends MainFragment.Pluser{
// void injectActivity(MainActivity mainActivity);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/TestSectionModule.java
// @Module
// public class TestSectionModule{
//
// @PerSection @Provides public SectionProperty provideSectionProperty(){
// return new SectionProperty();
// }
//
// @Provides public NotScopedProperty provideNotScopedProperty(){
// return new NotScopedProperty();
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragment.java
// public class FirstFragment extends BaseFragment<FirstFragmentComponent> implements
// FirstFragmentView {
//
// @Inject A a;
// @Inject E e;
// @Inject D d;
// @Inject List<String> diInjectionHistory;
// @Inject FirstFragmentPresenter firstFragmentPresenter;
// @Inject SectionProperty sectionProperty;
// @Inject NotScopedProperty notScopedProperty;
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// return inflater.inflate(R.layout.fragment_main, container, false);
// }
//
// @Override public void onStart() {
// super.onStart();
// testDI();
// }
//
// //region Test DI stuff
// private void testDI() {
//
// diInjectionHistory.add(FirstFragment.class.getName());
// diInjectionHistory.add(firstFragmentPresenter.toString());
// diInjectionHistory.add(notScopedProperty.toString());
// diInjectionHistory.add(sectionProperty.toString());
// diInjectionHistory.add(a.toString());
// diInjectionHistory.add(e.toString());
// diInjectionHistory.add(d.toString());
//
// }
//
// @Override protected void initDIComponent() {
// fragmentComponent = (getParentComponent(SectionComponentMain.class)).plus(
// new FragmentModule(this), new FirstFragmentModule(this));
// fragmentComponent.injectFragment(this);
// }
//
// public interface Pluser{
// FirstFragmentComponent plus(FragmentModule fragmentModule, FirstFragmentModule firstFragmentModule);
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/SecondFragment.java
// public class SecondFragment extends BaseFragment<SecondFragmentComponent> implements
// SecondFragmentView{
//
// @Inject SecondFragmentPresenter secondFragmentPresenter;
// @Inject SectionProperty sectionProperty;
// @Inject NotScopedProperty notScopedProperty;
// @Inject List<String> diInjectionHistory;
// @Inject Log4Me logger;
// @Inject E e;
// @Inject D d;
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// return inflater.inflate(R.layout.fragment_main, container, false);
// }
//
// @Override public void onStart() {
// super.onStart();
// testDI();
// }
//
// //region Test DI stuff
// private void testDI() {
//
// diInjectionHistory.add(SecondFragment.class.getName());
// diInjectionHistory.add(secondFragmentPresenter.toString());
// diInjectionHistory.add(notScopedProperty.toString());
// diInjectionHistory.add(sectionProperty.toString());
// diInjectionHistory.add(logger.toString());
// diInjectionHistory.add(e.toString());
// diInjectionHistory.add(d.toString());
//
// logger.log(diInjectionHistory.toString());
//
//
// }
//
// @Override protected void initDIComponent() {
// fragmentComponent = (getParentComponent(SectionComponentMain.class)).plus(
// new FragmentModule(this), new SecondFragmentModule(this));
// fragmentComponent.injectFragment(this);
// }
//
// public interface Pluser{
// SecondFragmentComponent plus(FragmentModule secondFragmentModule, SecondFragmentModule firstFragmentModule);
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
import dagger.Component;
import me.martinez.sergio.daggertwobasearchitecture.activities.MainActivityComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.TestSectionModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.FirstFragment;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.SecondFragment;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.components;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@PerSection
@Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
public interface SectionComponentMain extends | FirstFragment.Pluser, |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/activities/MainActivityComponent.java
// @PerActivity
// @Component(dependencies = AppComponent.class, modules = {ActivityModule.class, MainActivityModule.class})
// public interface MainActivityComponent extends MainFragment.Pluser{
// void injectActivity(MainActivity mainActivity);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/TestSectionModule.java
// @Module
// public class TestSectionModule{
//
// @PerSection @Provides public SectionProperty provideSectionProperty(){
// return new SectionProperty();
// }
//
// @Provides public NotScopedProperty provideNotScopedProperty(){
// return new NotScopedProperty();
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragment.java
// public class FirstFragment extends BaseFragment<FirstFragmentComponent> implements
// FirstFragmentView {
//
// @Inject A a;
// @Inject E e;
// @Inject D d;
// @Inject List<String> diInjectionHistory;
// @Inject FirstFragmentPresenter firstFragmentPresenter;
// @Inject SectionProperty sectionProperty;
// @Inject NotScopedProperty notScopedProperty;
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// return inflater.inflate(R.layout.fragment_main, container, false);
// }
//
// @Override public void onStart() {
// super.onStart();
// testDI();
// }
//
// //region Test DI stuff
// private void testDI() {
//
// diInjectionHistory.add(FirstFragment.class.getName());
// diInjectionHistory.add(firstFragmentPresenter.toString());
// diInjectionHistory.add(notScopedProperty.toString());
// diInjectionHistory.add(sectionProperty.toString());
// diInjectionHistory.add(a.toString());
// diInjectionHistory.add(e.toString());
// diInjectionHistory.add(d.toString());
//
// }
//
// @Override protected void initDIComponent() {
// fragmentComponent = (getParentComponent(SectionComponentMain.class)).plus(
// new FragmentModule(this), new FirstFragmentModule(this));
// fragmentComponent.injectFragment(this);
// }
//
// public interface Pluser{
// FirstFragmentComponent plus(FragmentModule fragmentModule, FirstFragmentModule firstFragmentModule);
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/SecondFragment.java
// public class SecondFragment extends BaseFragment<SecondFragmentComponent> implements
// SecondFragmentView{
//
// @Inject SecondFragmentPresenter secondFragmentPresenter;
// @Inject SectionProperty sectionProperty;
// @Inject NotScopedProperty notScopedProperty;
// @Inject List<String> diInjectionHistory;
// @Inject Log4Me logger;
// @Inject E e;
// @Inject D d;
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// return inflater.inflate(R.layout.fragment_main, container, false);
// }
//
// @Override public void onStart() {
// super.onStart();
// testDI();
// }
//
// //region Test DI stuff
// private void testDI() {
//
// diInjectionHistory.add(SecondFragment.class.getName());
// diInjectionHistory.add(secondFragmentPresenter.toString());
// diInjectionHistory.add(notScopedProperty.toString());
// diInjectionHistory.add(sectionProperty.toString());
// diInjectionHistory.add(logger.toString());
// diInjectionHistory.add(e.toString());
// diInjectionHistory.add(d.toString());
//
// logger.log(diInjectionHistory.toString());
//
//
// }
//
// @Override protected void initDIComponent() {
// fragmentComponent = (getParentComponent(SectionComponentMain.class)).plus(
// new FragmentModule(this), new SecondFragmentModule(this));
// fragmentComponent.injectFragment(this);
// }
//
// public interface Pluser{
// SecondFragmentComponent plus(FragmentModule secondFragmentModule, SecondFragmentModule firstFragmentModule);
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
| import dagger.Component;
import me.martinez.sergio.daggertwobasearchitecture.activities.MainActivityComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.TestSectionModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.FirstFragment;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.SecondFragment;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.components;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@PerSection
@Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
public interface SectionComponentMain extends
FirstFragment.Pluser, | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/activities/MainActivityComponent.java
// @PerActivity
// @Component(dependencies = AppComponent.class, modules = {ActivityModule.class, MainActivityModule.class})
// public interface MainActivityComponent extends MainFragment.Pluser{
// void injectActivity(MainActivity mainActivity);
// A provideA();
// List<String> provideDiInjectionHistory();
// Log4Me provideLog4Me();
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/TestSectionModule.java
// @Module
// public class TestSectionModule{
//
// @PerSection @Provides public SectionProperty provideSectionProperty(){
// return new SectionProperty();
// }
//
// @Provides public NotScopedProperty provideNotScopedProperty(){
// return new NotScopedProperty();
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragment.java
// public class FirstFragment extends BaseFragment<FirstFragmentComponent> implements
// FirstFragmentView {
//
// @Inject A a;
// @Inject E e;
// @Inject D d;
// @Inject List<String> diInjectionHistory;
// @Inject FirstFragmentPresenter firstFragmentPresenter;
// @Inject SectionProperty sectionProperty;
// @Inject NotScopedProperty notScopedProperty;
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// return inflater.inflate(R.layout.fragment_main, container, false);
// }
//
// @Override public void onStart() {
// super.onStart();
// testDI();
// }
//
// //region Test DI stuff
// private void testDI() {
//
// diInjectionHistory.add(FirstFragment.class.getName());
// diInjectionHistory.add(firstFragmentPresenter.toString());
// diInjectionHistory.add(notScopedProperty.toString());
// diInjectionHistory.add(sectionProperty.toString());
// diInjectionHistory.add(a.toString());
// diInjectionHistory.add(e.toString());
// diInjectionHistory.add(d.toString());
//
// }
//
// @Override protected void initDIComponent() {
// fragmentComponent = (getParentComponent(SectionComponentMain.class)).plus(
// new FragmentModule(this), new FirstFragmentModule(this));
// fragmentComponent.injectFragment(this);
// }
//
// public interface Pluser{
// FirstFragmentComponent plus(FragmentModule fragmentModule, FirstFragmentModule firstFragmentModule);
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/secondstep/SecondFragment.java
// public class SecondFragment extends BaseFragment<SecondFragmentComponent> implements
// SecondFragmentView{
//
// @Inject SecondFragmentPresenter secondFragmentPresenter;
// @Inject SectionProperty sectionProperty;
// @Inject NotScopedProperty notScopedProperty;
// @Inject List<String> diInjectionHistory;
// @Inject Log4Me logger;
// @Inject E e;
// @Inject D d;
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// return inflater.inflate(R.layout.fragment_main, container, false);
// }
//
// @Override public void onStart() {
// super.onStart();
// testDI();
// }
//
// //region Test DI stuff
// private void testDI() {
//
// diInjectionHistory.add(SecondFragment.class.getName());
// diInjectionHistory.add(secondFragmentPresenter.toString());
// diInjectionHistory.add(notScopedProperty.toString());
// diInjectionHistory.add(sectionProperty.toString());
// diInjectionHistory.add(logger.toString());
// diInjectionHistory.add(e.toString());
// diInjectionHistory.add(d.toString());
//
// logger.log(diInjectionHistory.toString());
//
//
// }
//
// @Override protected void initDIComponent() {
// fragmentComponent = (getParentComponent(SectionComponentMain.class)).plus(
// new FragmentModule(this), new SecondFragmentModule(this));
// fragmentComponent.injectFragment(this);
// }
//
// public interface Pluser{
// SecondFragmentComponent plus(FragmentModule secondFragmentModule, SecondFragmentModule firstFragmentModule);
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
import dagger.Component;
import me.martinez.sergio.daggertwobasearchitecture.activities.MainActivityComponent;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.TestSectionModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.FirstFragment;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.secondstep.SecondFragment;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.di.components;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
@PerSection
@Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
public interface SectionComponentMain extends
FirstFragment.Pluser, | SecondFragment.Pluser{ |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentPresenter.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
| import me.martinez.sergio.daggertwobasearchitecture.test.D; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation;
/**
* Created by Sergio Martinez Rodriguez
* Date 18/7/15.
*/
public class FirstFragmentPresenter {
private final FirstFragmentView firstFragmentView; | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentPresenter.java
import me.martinez.sergio.daggertwobasearchitecture.test.D;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation;
/**
* Created by Sergio Martinez Rodriguez
* Date 18/7/15.
*/
public class FirstFragmentPresenter {
private final FirstFragmentView firstFragmentView; | private final D d; |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragment.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentPresenter.java
// public class FirstFragmentPresenter {
//
// private final FirstFragmentView firstFragmentView;
// private final D d;
//
// public FirstFragmentPresenter(FirstFragmentView firstFragmentView, D d) {
// this.firstFragmentView = firstFragmentView;
// this.d = d;
// }
//
// public D getD(){
// return d;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentView.java
// public interface FirstFragmentView{
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
| import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class FirstFragment extends BaseFragment<FirstFragmentComponent> implements
FirstFragmentView {
| // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentPresenter.java
// public class FirstFragmentPresenter {
//
// private final FirstFragmentView firstFragmentView;
// private final D d;
//
// public FirstFragmentPresenter(FirstFragmentView firstFragmentView, D d) {
// this.firstFragmentView = firstFragmentView;
// this.d = d;
// }
//
// public D getD(){
// return d;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentView.java
// public interface FirstFragmentView{
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragment.java
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class FirstFragment extends BaseFragment<FirstFragmentComponent> implements
FirstFragmentView {
| @Inject A a; |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragment.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentPresenter.java
// public class FirstFragmentPresenter {
//
// private final FirstFragmentView firstFragmentView;
// private final D d;
//
// public FirstFragmentPresenter(FirstFragmentView firstFragmentView, D d) {
// this.firstFragmentView = firstFragmentView;
// this.d = d;
// }
//
// public D getD(){
// return d;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentView.java
// public interface FirstFragmentView{
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
| import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class FirstFragment extends BaseFragment<FirstFragmentComponent> implements
FirstFragmentView {
@Inject A a; | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentPresenter.java
// public class FirstFragmentPresenter {
//
// private final FirstFragmentView firstFragmentView;
// private final D d;
//
// public FirstFragmentPresenter(FirstFragmentView firstFragmentView, D d) {
// this.firstFragmentView = firstFragmentView;
// this.d = d;
// }
//
// public D getD(){
// return d;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentView.java
// public interface FirstFragmentView{
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragment.java
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class FirstFragment extends BaseFragment<FirstFragmentComponent> implements
FirstFragmentView {
@Inject A a; | @Inject E e; |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragment.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentPresenter.java
// public class FirstFragmentPresenter {
//
// private final FirstFragmentView firstFragmentView;
// private final D d;
//
// public FirstFragmentPresenter(FirstFragmentView firstFragmentView, D d) {
// this.firstFragmentView = firstFragmentView;
// this.d = d;
// }
//
// public D getD(){
// return d;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentView.java
// public interface FirstFragmentView{
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
| import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class FirstFragment extends BaseFragment<FirstFragmentComponent> implements
FirstFragmentView {
@Inject A a;
@Inject E e; | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentPresenter.java
// public class FirstFragmentPresenter {
//
// private final FirstFragmentView firstFragmentView;
// private final D d;
//
// public FirstFragmentPresenter(FirstFragmentView firstFragmentView, D d) {
// this.firstFragmentView = firstFragmentView;
// this.d = d;
// }
//
// public D getD(){
// return d;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentView.java
// public interface FirstFragmentView{
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragment.java
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class FirstFragment extends BaseFragment<FirstFragmentComponent> implements
FirstFragmentView {
@Inject A a;
@Inject E e; | @Inject D d; |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragment.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentPresenter.java
// public class FirstFragmentPresenter {
//
// private final FirstFragmentView firstFragmentView;
// private final D d;
//
// public FirstFragmentPresenter(FirstFragmentView firstFragmentView, D d) {
// this.firstFragmentView = firstFragmentView;
// this.d = d;
// }
//
// public D getD(){
// return d;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentView.java
// public interface FirstFragmentView{
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
| import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class FirstFragment extends BaseFragment<FirstFragmentComponent> implements
FirstFragmentView {
@Inject A a;
@Inject E e;
@Inject D d;
@Inject List<String> diInjectionHistory; | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentPresenter.java
// public class FirstFragmentPresenter {
//
// private final FirstFragmentView firstFragmentView;
// private final D d;
//
// public FirstFragmentPresenter(FirstFragmentView firstFragmentView, D d) {
// this.firstFragmentView = firstFragmentView;
// this.d = d;
// }
//
// public D getD(){
// return d;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentView.java
// public interface FirstFragmentView{
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragment.java
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class FirstFragment extends BaseFragment<FirstFragmentComponent> implements
FirstFragmentView {
@Inject A a;
@Inject E e;
@Inject D d;
@Inject List<String> diInjectionHistory; | @Inject FirstFragmentPresenter firstFragmentPresenter; |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragment.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentPresenter.java
// public class FirstFragmentPresenter {
//
// private final FirstFragmentView firstFragmentView;
// private final D d;
//
// public FirstFragmentPresenter(FirstFragmentView firstFragmentView, D d) {
// this.firstFragmentView = firstFragmentView;
// this.d = d;
// }
//
// public D getD(){
// return d;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentView.java
// public interface FirstFragmentView{
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
| import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class FirstFragment extends BaseFragment<FirstFragmentComponent> implements
FirstFragmentView {
@Inject A a;
@Inject E e;
@Inject D d;
@Inject List<String> diInjectionHistory;
@Inject FirstFragmentPresenter firstFragmentPresenter; | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentPresenter.java
// public class FirstFragmentPresenter {
//
// private final FirstFragmentView firstFragmentView;
// private final D d;
//
// public FirstFragmentPresenter(FirstFragmentView firstFragmentView, D d) {
// this.firstFragmentView = firstFragmentView;
// this.d = d;
// }
//
// public D getD(){
// return d;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentView.java
// public interface FirstFragmentView{
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragment.java
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class FirstFragment extends BaseFragment<FirstFragmentComponent> implements
FirstFragmentView {
@Inject A a;
@Inject E e;
@Inject D d;
@Inject List<String> diInjectionHistory;
@Inject FirstFragmentPresenter firstFragmentPresenter; | @Inject SectionProperty sectionProperty; |
fSergio101/DaggerTwoBaseArchitecture | app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragment.java | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentPresenter.java
// public class FirstFragmentPresenter {
//
// private final FirstFragmentView firstFragmentView;
// private final D d;
//
// public FirstFragmentPresenter(FirstFragmentView firstFragmentView, D d) {
// this.firstFragmentView = firstFragmentView;
// this.d = d;
// }
//
// public D getD(){
// return d;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentView.java
// public interface FirstFragmentView{
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
| import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty; | /*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class FirstFragment extends BaseFragment<FirstFragmentComponent> implements
FirstFragmentView {
@Inject A a;
@Inject E e;
@Inject D d;
@Inject List<String> diInjectionHistory;
@Inject FirstFragmentPresenter firstFragmentPresenter;
@Inject SectionProperty sectionProperty; | // Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/components/SectionComponentMain.java
// @PerSection
// @Component( dependencies = MainActivityComponent.class, modules = TestSectionModule.class)
// public interface SectionComponentMain extends
// FirstFragment.Pluser,
// SecondFragment.Pluser{
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/injectableelements/base/BaseFragment.java
// public abstract class BaseFragment<T> extends Fragment {
//
// protected T fragmentComponent;
//
// @Override public void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// initDIComponent();
// setRetainInstance(true);
// }
//
// public T getFragmentComponent() {
// return fragmentComponent;
// }
//
// protected abstract void initDIComponent();
//
// /**
// * Gets a component for dependency injection by its type.
// */
// protected <C> C getParentComponent(Class<C> componentType) {
// return componentType.cast(((BaseInjectionActivity) getActivity()).getActivityComponent());
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/di/modules/FragmentModule.java
// @Module
// public class FragmentModule {
// BaseFragment baseFragment;
//
// public FragmentModule(BaseFragment baseFragment) {
// this.baseFragment = baseFragment;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentPresenter.java
// public class FirstFragmentPresenter {
//
// private final FirstFragmentView firstFragmentView;
// private final D d;
//
// public FirstFragmentPresenter(FirstFragmentView firstFragmentView, D d) {
// this.firstFragmentView = firstFragmentView;
// this.d = d;
// }
//
// public D getD(){
// return d;
// }
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/presentation/FirstFragmentView.java
// public interface FirstFragmentView{
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/A.java
// public class A {}
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/D.java
// public class D {
//
// @Inject
// public D() {
//
// }
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/E.java
// public class E {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/NotScopedProperty.java
// public class NotScopedProperty {
//
// }
//
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/test/SectionProperty.java
// public class SectionProperty {
//
// }
// Path: app/src/main/java/me/martinez/sergio/daggertwobasearchitecture/fragments/sections/testsection/firststep/FirstFragment.java
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import javax.inject.Inject;
import me.martinez.sergio.daggertwobasearchitecture.R;
import me.martinez.sergio.daggertwobasearchitecture.di.anotations.scopes.PerSection;
import me.martinez.sergio.daggertwobasearchitecture.di.components.SectionComponentMain;
import me.martinez.sergio.daggertwobasearchitecture.di.injectableelements.base.BaseFragment;
import me.martinez.sergio.daggertwobasearchitecture.di.modules.FragmentModule;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentPresenter;
import me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep.presentation.FirstFragmentView;
import me.martinez.sergio.daggertwobasearchitecture.test.A;
import me.martinez.sergio.daggertwobasearchitecture.test.D;
import me.martinez.sergio.daggertwobasearchitecture.test.E;
import me.martinez.sergio.daggertwobasearchitecture.test.NotScopedProperty;
import me.martinez.sergio.daggertwobasearchitecture.test.SectionProperty;
/*
* Copyright (C) 2015 Sergio Martinez Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.martinez.sergio.daggertwobasearchitecture.fragments.sections.testsection.firststep;
/**
* Created by Sergio Martinez Rodriguez
* Date 15/7/15.
*/
public class FirstFragment extends BaseFragment<FirstFragmentComponent> implements
FirstFragmentView {
@Inject A a;
@Inject E e;
@Inject D d;
@Inject List<String> diInjectionHistory;
@Inject FirstFragmentPresenter firstFragmentPresenter;
@Inject SectionProperty sectionProperty; | @Inject NotScopedProperty notScopedProperty; |
sky-uk/cqlmigrate | src/main/java/uk/sky/cqlmigrate/CassandraLockingMechanism.java | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
| import com.datastax.oss.driver.api.core.ConsistencyLevel;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import com.datastax.oss.driver.api.core.cql.Row;
import com.datastax.oss.driver.api.core.cql.SimpleStatement;
import com.datastax.oss.driver.api.core.servererrors.WriteTimeoutException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException;
import static java.lang.String.format; | package uk.sky.cqlmigrate;
class CassandraLockingMechanism extends LockingMechanism {
private static final Logger log = LoggerFactory.getLogger(CassandraLockingMechanism.class);
private final CqlSession session;
private final ConsistencyLevel consistencyLevel;
private final String lockKeyspace;
private PreparedStatement selectLockQuery;
private PreparedStatement insertLockQuery;
private PreparedStatement deleteLockQuery;
private boolean isRetryAfterWriteTimeout;
public CassandraLockingMechanism(CqlSession session, String keyspace, ConsistencyLevel consistencyLevel, String lockKeyspace) {
super(keyspace + ".schema_migration");
this.session = session;
this.consistencyLevel = consistencyLevel;
this.lockKeyspace = lockKeyspace;
}
/**
* Prepares queries for acquiring and releasing lock.
*
* @throws CannotAcquireLockException if any DriverException thrown while executing queries.
*/
@Override | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
// Path: src/main/java/uk/sky/cqlmigrate/CassandraLockingMechanism.java
import com.datastax.oss.driver.api.core.ConsistencyLevel;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import com.datastax.oss.driver.api.core.cql.Row;
import com.datastax.oss.driver.api.core.cql.SimpleStatement;
import com.datastax.oss.driver.api.core.servererrors.WriteTimeoutException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException;
import static java.lang.String.format;
package uk.sky.cqlmigrate;
class CassandraLockingMechanism extends LockingMechanism {
private static final Logger log = LoggerFactory.getLogger(CassandraLockingMechanism.class);
private final CqlSession session;
private final ConsistencyLevel consistencyLevel;
private final String lockKeyspace;
private PreparedStatement selectLockQuery;
private PreparedStatement insertLockQuery;
private PreparedStatement deleteLockQuery;
private boolean isRetryAfterWriteTimeout;
public CassandraLockingMechanism(CqlSession session, String keyspace, ConsistencyLevel consistencyLevel, String lockKeyspace) {
super(keyspace + ".schema_migration");
this.session = session;
this.consistencyLevel = consistencyLevel;
this.lockKeyspace = lockKeyspace;
}
/**
* Prepares queries for acquiring and releasing lock.
*
* @throws CannotAcquireLockException if any DriverException thrown while executing queries.
*/
@Override | public void init() throws CannotAcquireLockException { |
sky-uk/cqlmigrate | src/main/java/uk/sky/cqlmigrate/CassandraLockingMechanism.java | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
| import com.datastax.oss.driver.api.core.ConsistencyLevel;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import com.datastax.oss.driver.api.core.cql.Row;
import com.datastax.oss.driver.api.core.cql.SimpleStatement;
import com.datastax.oss.driver.api.core.servererrors.WriteTimeoutException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException;
import static java.lang.String.format; | log.info("Lock currently held by {}", currentLock);
return false;
}
} catch (WriteTimeoutException wte) {
log.warn("Query to acquire lock for {} failed to execute: {}", clientId, wte.getMessage());
return false;
} catch (DriverException de) {
throw new CannotAcquireLockException(format("Query to acquire lock %s for client %s failed to execute", lockName, clientId), de);
}
}
/**
* Verify that a select of the locks completes successfully
*
* @throws DriverException propagated from the session.execute() call.
*/
private void verifyClusterIsHealthy() {
session.execute(selectLockQuery.bind());
}
/**
* {@inheritDoc}
* <p>
* Deletes lock from locks table.
* If a WriteTimeoutException has previously been thrown this
* will check if the lock did get successfully deleted.
*
* @throws CannotReleaseLockException if any DriverException thrown while executing queries.
*/
@Override | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
// Path: src/main/java/uk/sky/cqlmigrate/CassandraLockingMechanism.java
import com.datastax.oss.driver.api.core.ConsistencyLevel;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.driver.api.core.cql.PreparedStatement;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import com.datastax.oss.driver.api.core.cql.Row;
import com.datastax.oss.driver.api.core.cql.SimpleStatement;
import com.datastax.oss.driver.api.core.servererrors.WriteTimeoutException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException;
import static java.lang.String.format;
log.info("Lock currently held by {}", currentLock);
return false;
}
} catch (WriteTimeoutException wte) {
log.warn("Query to acquire lock for {} failed to execute: {}", clientId, wte.getMessage());
return false;
} catch (DriverException de) {
throw new CannotAcquireLockException(format("Query to acquire lock %s for client %s failed to execute", lockName, clientId), de);
}
}
/**
* Verify that a select of the locks completes successfully
*
* @throws DriverException propagated from the session.execute() call.
*/
private void verifyClusterIsHealthy() {
session.execute(selectLockQuery.bind());
}
/**
* {@inheritDoc}
* <p>
* Deletes lock from locks table.
* If a WriteTimeoutException has previously been thrown this
* will check if the lock did get successfully deleted.
*
* @throws CannotReleaseLockException if any DriverException thrown while executing queries.
*/
@Override | public boolean release(String clientId) throws CannotReleaseLockException { |
sky-uk/cqlmigrate | src/test/java/uk/sky/cqlmigrate/ChecksumCalculatorTest.java | // Path: src/main/java/uk/sky/cqlmigrate/ChecksumCalculator.java
// static String calculateChecksum(Path path) {
// try {
// final MessageDigest digest = MessageDigest.getInstance("SHA-1");
// final byte[] hash = digest.digest(Files.readAllBytes(path));
// return bytesToHex(hash);
// } catch (IOException | NoSuchAlgorithmException e) {
// throw new RuntimeException(e);
// }
// }
| import org.assertj.core.api.Assertions;
import org.junit.Test;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import static org.assertj.core.api.Assertions.assertThat;
import static uk.sky.cqlmigrate.ChecksumCalculator.calculateChecksum; | package uk.sky.cqlmigrate;
public class ChecksumCalculatorTest {
@Test
public void calculateChecksumThrowsWhenFileDoesNotExist() throws Exception {
// given
Path path = Paths.get("/non-existant-file.cql");
// When | // Path: src/main/java/uk/sky/cqlmigrate/ChecksumCalculator.java
// static String calculateChecksum(Path path) {
// try {
// final MessageDigest digest = MessageDigest.getInstance("SHA-1");
// final byte[] hash = digest.digest(Files.readAllBytes(path));
// return bytesToHex(hash);
// } catch (IOException | NoSuchAlgorithmException e) {
// throw new RuntimeException(e);
// }
// }
// Path: src/test/java/uk/sky/cqlmigrate/ChecksumCalculatorTest.java
import org.assertj.core.api.Assertions;
import org.junit.Test;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import static org.assertj.core.api.Assertions.assertThat;
import static uk.sky.cqlmigrate.ChecksumCalculator.calculateChecksum;
package uk.sky.cqlmigrate;
public class ChecksumCalculatorTest {
@Test
public void calculateChecksumThrowsWhenFileDoesNotExist() throws Exception {
// given
Path path = Paths.get("/non-existant-file.cql");
// When | RuntimeException runtimeException = Assertions.catchThrowableOfType(() -> calculateChecksum(path), RuntimeException.class); |
sky-uk/cqlmigrate | src/main/java/uk/sky/cqlmigrate/LockingMechanism.java | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
| import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException; | package uk.sky.cqlmigrate;
abstract class LockingMechanism {
protected final String lockName;
public LockingMechanism(String lockName) {
this.lockName = lockName;
}
public void init() {
}
/**
* Returns true if successfully acquired lock.
*
* @param clientId client to acquire the lock for
* @return if the lock was successfully acquired. A false value means that the lock was not acquired,
* or that the result of the operation is unknown.
* @throws CannotAcquireLockException if any fatal failure occurs when trying to acquire lock.
*/ | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
// Path: src/main/java/uk/sky/cqlmigrate/LockingMechanism.java
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException;
package uk.sky.cqlmigrate;
abstract class LockingMechanism {
protected final String lockName;
public LockingMechanism(String lockName) {
this.lockName = lockName;
}
public void init() {
}
/**
* Returns true if successfully acquired lock.
*
* @param clientId client to acquire the lock for
* @return if the lock was successfully acquired. A false value means that the lock was not acquired,
* or that the result of the operation is unknown.
* @throws CannotAcquireLockException if any fatal failure occurs when trying to acquire lock.
*/ | abstract public boolean acquire(String clientId) throws CannotAcquireLockException; |
sky-uk/cqlmigrate | src/main/java/uk/sky/cqlmigrate/LockingMechanism.java | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
| import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException; | package uk.sky.cqlmigrate;
abstract class LockingMechanism {
protected final String lockName;
public LockingMechanism(String lockName) {
this.lockName = lockName;
}
public void init() {
}
/**
* Returns true if successfully acquired lock.
*
* @param clientId client to acquire the lock for
* @return if the lock was successfully acquired. A false value means that the lock was not acquired,
* or that the result of the operation is unknown.
* @throws CannotAcquireLockException if any fatal failure occurs when trying to acquire lock.
*/
abstract public boolean acquire(String clientId) throws CannotAcquireLockException;
/**
* @param clientId client to release the lock for
* @return true if the lock was successfully released. A false value means that the lock was not released,
* or that the result of the operation is unknown.
* @throws CannotReleaseLockException if any fatal failure occurs when trying to release lock.
*/ | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
// Path: src/main/java/uk/sky/cqlmigrate/LockingMechanism.java
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException;
package uk.sky.cqlmigrate;
abstract class LockingMechanism {
protected final String lockName;
public LockingMechanism(String lockName) {
this.lockName = lockName;
}
public void init() {
}
/**
* Returns true if successfully acquired lock.
*
* @param clientId client to acquire the lock for
* @return if the lock was successfully acquired. A false value means that the lock was not acquired,
* or that the result of the operation is unknown.
* @throws CannotAcquireLockException if any fatal failure occurs when trying to acquire lock.
*/
abstract public boolean acquire(String clientId) throws CannotAcquireLockException;
/**
* @param clientId client to release the lock for
* @return true if the lock was successfully released. A false value means that the lock was not released,
* or that the result of the operation is unknown.
* @throws CannotReleaseLockException if any fatal failure occurs when trying to release lock.
*/ | abstract public boolean release(String clientId) throws CannotReleaseLockException; |
sky-uk/cqlmigrate | src/test/java/uk/sky/cqlmigrate/CqlMigratorImplTest.java | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
| import com.datastax.oss.driver.api.core.ConsistencyLevel;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import com.datastax.oss.driver.api.core.cql.Row;
import com.datastax.oss.driver.api.core.cql.SimpleStatement;
import com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata;
import com.datastax.oss.driver.api.core.metadata.schema.TableMetadata;
import com.datastax.oss.driver.api.core.servererrors.SyntaxError;
import com.google.common.util.concurrent.Uninterruptibles;
import org.apache.cassandra.exceptions.ConfigurationException;
import org.apache.thrift.transport.TTransportException;
import org.cassandraunit.utils.EmbeddedCassandraServerHelper;
import org.junit.*;
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Instant;
import java.time.Duration;
import java.util.*;
import java.util.concurrent.*;
import static com.datastax.oss.driver.api.core.cql.SimpleStatement.newInstance;
import static java.time.Duration.ofMillis;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
import static org.assertj.core.api.Assertions.*;
import static org.junit.Assert.fail; | //when
MIGRATOR.migrate(CASSANDRA_HOSTS, LOCAL_DC, binaryPort, username, password, TEST_KEYSPACE, cqlPaths);
//then
assertThat(session.getMetadata().getKeyspace(TEST_KEYSPACE)).isNotEmpty();
}
@Test(timeout = 5000)
public void shouldThrowCannotAcquireLockExceptionIfLockCannotBeAcquiredAfterTimeout() throws Exception {
//given
CqlMigrator migrator = new CqlMigratorImpl(CqlMigratorConfig.builder()
.withLockConfig(CassandraLockConfig.builder().withPollingInterval(ofMillis(50)).withTimeout(ofMillis(300)).build())
.withReadConsistencyLevel(ConsistencyLevel.ALL)
.withWriteConsistencyLevel(ConsistencyLevel.ALL)
.build(), new SessionContextFactory());
String client = UUID.randomUUID().toString();
session.execute(newInstance("INSERT INTO cqlmigrate.locks (name, client) VALUES (?, ?)", LOCK_NAME, client));
Collection<Path> cqlPaths = singletonList(getResourcePath("cql_bootstrap"));
//when
Future<?> future = executorService.submit(() -> migrator.migrate(
CASSANDRA_HOSTS, LOCAL_DC, binaryPort, username, password, TEST_KEYSPACE, cqlPaths));
Thread.sleep(310);
Throwable throwable = catchThrowable(future::get);
//then
assertThat(throwable).isInstanceOf(ExecutionException.class); | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
// Path: src/test/java/uk/sky/cqlmigrate/CqlMigratorImplTest.java
import com.datastax.oss.driver.api.core.ConsistencyLevel;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.cql.ResultSet;
import com.datastax.oss.driver.api.core.cql.Row;
import com.datastax.oss.driver.api.core.cql.SimpleStatement;
import com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata;
import com.datastax.oss.driver.api.core.metadata.schema.TableMetadata;
import com.datastax.oss.driver.api.core.servererrors.SyntaxError;
import com.google.common.util.concurrent.Uninterruptibles;
import org.apache.cassandra.exceptions.ConfigurationException;
import org.apache.thrift.transport.TTransportException;
import org.cassandraunit.utils.EmbeddedCassandraServerHelper;
import org.junit.*;
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Instant;
import java.time.Duration;
import java.util.*;
import java.util.concurrent.*;
import static com.datastax.oss.driver.api.core.cql.SimpleStatement.newInstance;
import static java.time.Duration.ofMillis;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonList;
import static org.assertj.core.api.Assertions.*;
import static org.junit.Assert.fail;
//when
MIGRATOR.migrate(CASSANDRA_HOSTS, LOCAL_DC, binaryPort, username, password, TEST_KEYSPACE, cqlPaths);
//then
assertThat(session.getMetadata().getKeyspace(TEST_KEYSPACE)).isNotEmpty();
}
@Test(timeout = 5000)
public void shouldThrowCannotAcquireLockExceptionIfLockCannotBeAcquiredAfterTimeout() throws Exception {
//given
CqlMigrator migrator = new CqlMigratorImpl(CqlMigratorConfig.builder()
.withLockConfig(CassandraLockConfig.builder().withPollingInterval(ofMillis(50)).withTimeout(ofMillis(300)).build())
.withReadConsistencyLevel(ConsistencyLevel.ALL)
.withWriteConsistencyLevel(ConsistencyLevel.ALL)
.build(), new SessionContextFactory());
String client = UUID.randomUUID().toString();
session.execute(newInstance("INSERT INTO cqlmigrate.locks (name, client) VALUES (?, ?)", LOCK_NAME, client));
Collection<Path> cqlPaths = singletonList(getResourcePath("cql_bootstrap"));
//when
Future<?> future = executorService.submit(() -> migrator.migrate(
CASSANDRA_HOSTS, LOCAL_DC, binaryPort, username, password, TEST_KEYSPACE, cqlPaths));
Thread.sleep(310);
Throwable throwable = catchThrowable(future::get);
//then
assertThat(throwable).isInstanceOf(ExecutionException.class); | assertThat(throwable.getCause()).isInstanceOf(CannotAcquireLockException.class); |
sky-uk/cqlmigrate | src/main/java/uk/sky/cqlmigrate/Lock.java | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
| import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException;
import java.util.concurrent.TimeoutException; | package uk.sky.cqlmigrate;
/**
* Each instance attempts to acquire the lock.
*/
class Lock {
private static final Logger log = LoggerFactory.getLogger(Lock.class);
private final LockingMechanism lockingMechanism;
private final LockConfig lockConfig;
/**
*
* @param lockingMechanism {@code LockingMechanism} to use to acquire the lock
* @param lockConfig {@code LockConfig} for configuring the lock polling interval, timeout and client id
*/
Lock(LockingMechanism lockingMechanism, LockConfig lockConfig) {
this.lockingMechanism = lockingMechanism;
this.lockConfig = lockConfig;
}
/**
* If the lock is successfully acquired, the method will return, otherwise
* this will wait until the lock has been released. If a lock cannot
* be acquired within the configured timeout interval, an exception is thrown.
*
* @throws CannotAcquireLockException if this cannot acquire lock within the specified time interval or locking mechanism fails
*/ | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
// Path: src/main/java/uk/sky/cqlmigrate/Lock.java
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException;
import java.util.concurrent.TimeoutException;
package uk.sky.cqlmigrate;
/**
* Each instance attempts to acquire the lock.
*/
class Lock {
private static final Logger log = LoggerFactory.getLogger(Lock.class);
private final LockingMechanism lockingMechanism;
private final LockConfig lockConfig;
/**
*
* @param lockingMechanism {@code LockingMechanism} to use to acquire the lock
* @param lockConfig {@code LockConfig} for configuring the lock polling interval, timeout and client id
*/
Lock(LockingMechanism lockingMechanism, LockConfig lockConfig) {
this.lockingMechanism = lockingMechanism;
this.lockConfig = lockConfig;
}
/**
* If the lock is successfully acquired, the method will return, otherwise
* this will wait until the lock has been released. If a lock cannot
* be acquired within the configured timeout interval, an exception is thrown.
*
* @throws CannotAcquireLockException if this cannot acquire lock within the specified time interval or locking mechanism fails
*/ | public void lock() throws CannotAcquireLockException { |
sky-uk/cqlmigrate | src/main/java/uk/sky/cqlmigrate/Lock.java | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
| import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException;
import java.util.concurrent.TimeoutException; | package uk.sky.cqlmigrate;
/**
* Each instance attempts to acquire the lock.
*/
class Lock {
private static final Logger log = LoggerFactory.getLogger(Lock.class);
private final LockingMechanism lockingMechanism;
private final LockConfig lockConfig;
/**
*
* @param lockingMechanism {@code LockingMechanism} to use to acquire the lock
* @param lockConfig {@code LockConfig} for configuring the lock polling interval, timeout and client id
*/
Lock(LockingMechanism lockingMechanism, LockConfig lockConfig) {
this.lockingMechanism = lockingMechanism;
this.lockConfig = lockConfig;
}
/**
* If the lock is successfully acquired, the method will return, otherwise
* this will wait until the lock has been released. If a lock cannot
* be acquired within the configured timeout interval, an exception is thrown.
*
* @throws CannotAcquireLockException if this cannot acquire lock within the specified time interval or locking mechanism fails
*/
public void lock() throws CannotAcquireLockException {
lockingMechanism.init();
String lockName = lockingMechanism.getLockName();
String clientId = lockConfig.getClientId();
try {
log.info("Attempting to acquire lock for '{}', using client id '{}'", lockName, lockConfig.getClientId());
RetryTask.attempt(() -> lockingMechanism.acquire(clientId))
.withTimeout(lockConfig.getTimeout())
.withPollingInterval(lockConfig.getPollingInterval())
.untilSuccess();
} catch (TimeoutException te) {
log.warn("Unable to acquire lock for {}", lockConfig.getClientId(), te);
throw new CannotAcquireLockException("Lock currently in use", te);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new CannotAcquireLockException(String.format("Polling to acquire lock %s for client %s was interrupted", lockName, lockConfig.getClientId()), e);
}
}
/**
* Will release the lock using the locking mechanism. If a lock cannot
* be released within the configured timeout interval, an exception is thrown.
*
* @param migrationFailed true if migration failed, false otherwise
* @throws CannotReleaseLockException if this cannot release lock within the specified time interval or locking mechanism fails
*/ | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
// Path: src/main/java/uk/sky/cqlmigrate/Lock.java
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException;
import java.util.concurrent.TimeoutException;
package uk.sky.cqlmigrate;
/**
* Each instance attempts to acquire the lock.
*/
class Lock {
private static final Logger log = LoggerFactory.getLogger(Lock.class);
private final LockingMechanism lockingMechanism;
private final LockConfig lockConfig;
/**
*
* @param lockingMechanism {@code LockingMechanism} to use to acquire the lock
* @param lockConfig {@code LockConfig} for configuring the lock polling interval, timeout and client id
*/
Lock(LockingMechanism lockingMechanism, LockConfig lockConfig) {
this.lockingMechanism = lockingMechanism;
this.lockConfig = lockConfig;
}
/**
* If the lock is successfully acquired, the method will return, otherwise
* this will wait until the lock has been released. If a lock cannot
* be acquired within the configured timeout interval, an exception is thrown.
*
* @throws CannotAcquireLockException if this cannot acquire lock within the specified time interval or locking mechanism fails
*/
public void lock() throws CannotAcquireLockException {
lockingMechanism.init();
String lockName = lockingMechanism.getLockName();
String clientId = lockConfig.getClientId();
try {
log.info("Attempting to acquire lock for '{}', using client id '{}'", lockName, lockConfig.getClientId());
RetryTask.attempt(() -> lockingMechanism.acquire(clientId))
.withTimeout(lockConfig.getTimeout())
.withPollingInterval(lockConfig.getPollingInterval())
.untilSuccess();
} catch (TimeoutException te) {
log.warn("Unable to acquire lock for {}", lockConfig.getClientId(), te);
throw new CannotAcquireLockException("Lock currently in use", te);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new CannotAcquireLockException(String.format("Polling to acquire lock %s for client %s was interrupted", lockName, lockConfig.getClientId()), e);
}
}
/**
* Will release the lock using the locking mechanism. If a lock cannot
* be released within the configured timeout interval, an exception is thrown.
*
* @param migrationFailed true if migration failed, false otherwise
* @throws CannotReleaseLockException if this cannot release lock within the specified time interval or locking mechanism fails
*/ | public void unlock(boolean migrationFailed) throws CannotReleaseLockException { |
sky-uk/cqlmigrate | src/test/java/uk/sky/cqlmigrate/LockTest.java | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
| import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;
import static org.junit.Assert.fail;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InOrder;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException;
import java.time.Duration; | given(lockingMechanism.acquire(LOCK_CONFIG.getClientId())).willReturn(true);
//when
lock.lock();
}
@Test
public void retriesToAcquireLockAfterIntervalIfFailedTheFirstTime() throws Throwable {
//given
given(lockingMechanism.acquire(LOCK_CONFIG.getClientId())).willReturn(false, true);
//when
long startTime = System.currentTimeMillis();
lock.lock();
long duration = System.currentTimeMillis() - startTime;
//then
assertThat(duration).isGreaterThanOrEqualTo(POLLING_MILLIS);
}
@Test
public void throwsExceptionIfFailedToAcquireLockBeforeTimeout() throws Throwable {
//given
given(lockingMechanism.acquire(LOCK_CONFIG.getClientId())).willReturn(false);
//when
long startTime = System.currentTimeMillis();
try {
lock.lock();
fail("Expected Exception"); | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
// Path: src/test/java/uk/sky/cqlmigrate/LockTest.java
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;
import static org.junit.Assert.fail;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InOrder;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException;
import java.time.Duration;
given(lockingMechanism.acquire(LOCK_CONFIG.getClientId())).willReturn(true);
//when
lock.lock();
}
@Test
public void retriesToAcquireLockAfterIntervalIfFailedTheFirstTime() throws Throwable {
//given
given(lockingMechanism.acquire(LOCK_CONFIG.getClientId())).willReturn(false, true);
//when
long startTime = System.currentTimeMillis();
lock.lock();
long duration = System.currentTimeMillis() - startTime;
//then
assertThat(duration).isGreaterThanOrEqualTo(POLLING_MILLIS);
}
@Test
public void throwsExceptionIfFailedToAcquireLockBeforeTimeout() throws Throwable {
//given
given(lockingMechanism.acquire(LOCK_CONFIG.getClientId())).willReturn(false);
//when
long startTime = System.currentTimeMillis();
try {
lock.lock();
fail("Expected Exception"); | } catch (CannotAcquireLockException e) {} |
sky-uk/cqlmigrate | src/test/java/uk/sky/cqlmigrate/LockTest.java | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
| import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;
import static org.junit.Assert.fail;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InOrder;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException;
import java.time.Duration; |
@Test
public void retriesToReleaseLockAfterIntervalIfFailedTheFirstTime() throws Throwable {
//given
given(lockingMechanism.acquire(LOCK_CONFIG.getClientId())).willReturn(true);
given(lockingMechanism.release(LOCK_CONFIG.getClientId())).willReturn(false, true);
lock.lock();
//when
long startTime = System.currentTimeMillis();
lock.unlock(false);
long duration = System.currentTimeMillis() - startTime;
//then
assertThat(duration).isGreaterThanOrEqualTo(POLLING_MILLIS);
verify(lockingMechanism, times(2)).release(LOCK_CONFIG.getClientId());
}
@Test
public void throwsExceptionIfFailedToReleaseLockBeforeTimeout() throws Throwable {
//given
given(lockingMechanism.acquire(LOCK_CONFIG.getClientId())).willReturn(true);
given(lockingMechanism.release(LOCK_CONFIG.getClientId())).willReturn(false);
lock.lock();
//when
long startTime = System.currentTimeMillis();
try {
lock.unlock(false);
fail("Expected Exception"); | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
// Path: src/test/java/uk/sky/cqlmigrate/LockTest.java
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;
import static org.junit.Assert.fail;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InOrder;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException;
import java.time.Duration;
@Test
public void retriesToReleaseLockAfterIntervalIfFailedTheFirstTime() throws Throwable {
//given
given(lockingMechanism.acquire(LOCK_CONFIG.getClientId())).willReturn(true);
given(lockingMechanism.release(LOCK_CONFIG.getClientId())).willReturn(false, true);
lock.lock();
//when
long startTime = System.currentTimeMillis();
lock.unlock(false);
long duration = System.currentTimeMillis() - startTime;
//then
assertThat(duration).isGreaterThanOrEqualTo(POLLING_MILLIS);
verify(lockingMechanism, times(2)).release(LOCK_CONFIG.getClientId());
}
@Test
public void throwsExceptionIfFailedToReleaseLockBeforeTimeout() throws Throwable {
//given
given(lockingMechanism.acquire(LOCK_CONFIG.getClientId())).willReturn(true);
given(lockingMechanism.release(LOCK_CONFIG.getClientId())).willReturn(false);
lock.lock();
//when
long startTime = System.currentTimeMillis();
try {
lock.unlock(false);
fail("Expected Exception"); | } catch (CannotReleaseLockException e) { |
sky-uk/cqlmigrate | src/main/java/uk/sky/cqlmigrate/ClusterHealth.java | // Path: src/main/java/uk/sky/cqlmigrate/exception/ClusterUnhealthyException.java
// public class ClusterUnhealthyException extends RuntimeException {
// public ClusterUnhealthyException(String message) {
// super(message);
// }
// }
| import com.datastax.oss.driver.api.core.metadata.Node;
import com.datastax.oss.driver.api.core.metadata.NodeState;
import com.datastax.oss.driver.api.core.session.Session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.sky.cqlmigrate.exception.ClusterUnhealthyException;
import java.net.InetAddress;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors; | package uk.sky.cqlmigrate;
class ClusterHealth {
private static final Logger log = LoggerFactory.getLogger(ClusterHealth.class);
private final Session session;
ClusterHealth(Session session) {
this.session = session;
}
| // Path: src/main/java/uk/sky/cqlmigrate/exception/ClusterUnhealthyException.java
// public class ClusterUnhealthyException extends RuntimeException {
// public ClusterUnhealthyException(String message) {
// super(message);
// }
// }
// Path: src/main/java/uk/sky/cqlmigrate/ClusterHealth.java
import com.datastax.oss.driver.api.core.metadata.Node;
import com.datastax.oss.driver.api.core.metadata.NodeState;
import com.datastax.oss.driver.api.core.session.Session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.sky.cqlmigrate.exception.ClusterUnhealthyException;
import java.net.InetAddress;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors;
package uk.sky.cqlmigrate;
class ClusterHealth {
private static final Logger log = LoggerFactory.getLogger(ClusterHealth.class);
private final Session session;
ClusterHealth(Session session) {
this.session = session;
}
| void check() throws ClusterUnhealthyException { |
sky-uk/cqlmigrate | src/test/java/uk/sky/cqlmigrate/CassandraLockingMechanismTest.java | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
//
// Path: src/test/java/uk/sky/cqlmigrate/util/PortScavenger.java
// public class PortScavenger {
//
// public static int getFreePort() {
// ServerSocket socket = null;
// try {
// socket = new ServerSocket(0);
// socket.setReuseAddress(true);
// int port = socket.getLocalPort();
// closeSocket(socket);
// return port;
// } catch (IOException ignored) {
// } finally {
// closeSocket(socket);
// }
// throw new IllegalStateException("Could not find a free TCP/IP port to start embedded Jetty HTTP Server on");
//
// }
//
// private static void closeSocket(ServerSocket socket) {
// if (socket != null) {
// try {
// socket.close();
// } catch (IOException ignored) {
// }
// }
// }
// }
| import com.datastax.oss.driver.api.core.ConsistencyLevel;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.protocol.internal.request.Prepare;
import com.datastax.oss.simulacron.common.cluster.ClusterSpec;
import com.datastax.oss.simulacron.common.cluster.DataCenterSpec;
import com.datastax.oss.simulacron.common.cluster.QueryLog;
import com.datastax.oss.simulacron.common.codec.WriteType;
import com.datastax.oss.simulacron.server.BoundCluster;
import com.datastax.oss.simulacron.server.Server;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import org.assertj.core.api.AbstractThrowableAssert;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException;
import uk.sky.cqlmigrate.util.PortScavenger;
import java.net.Inet4Address;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.UUID;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import static com.datastax.oss.simulacron.common.stubbing.PrimeDsl.*;
import static java.lang.String.valueOf;
import static org.assertj.core.api.Assertions.*; | package uk.sky.cqlmigrate;
public class CassandraLockingMechanismTest {
private static final String LOCK_KEYSPACE = "lock-keyspace";
private static final String CLIENT_ID = UUID.randomUUID().toString();
private static final String PREPARE_INSERT_QUERY = "INSERT INTO cqlmigrate.locks (name, client) VALUES (?, ?) IF NOT EXISTS";
private static final String PREPARE_DELETE_QUERY = "DELETE FROM cqlmigrate.locks WHERE name = ? IF client = ?";
| // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
//
// Path: src/test/java/uk/sky/cqlmigrate/util/PortScavenger.java
// public class PortScavenger {
//
// public static int getFreePort() {
// ServerSocket socket = null;
// try {
// socket = new ServerSocket(0);
// socket.setReuseAddress(true);
// int port = socket.getLocalPort();
// closeSocket(socket);
// return port;
// } catch (IOException ignored) {
// } finally {
// closeSocket(socket);
// }
// throw new IllegalStateException("Could not find a free TCP/IP port to start embedded Jetty HTTP Server on");
//
// }
//
// private static void closeSocket(ServerSocket socket) {
// if (socket != null) {
// try {
// socket.close();
// } catch (IOException ignored) {
// }
// }
// }
// }
// Path: src/test/java/uk/sky/cqlmigrate/CassandraLockingMechanismTest.java
import com.datastax.oss.driver.api.core.ConsistencyLevel;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.protocol.internal.request.Prepare;
import com.datastax.oss.simulacron.common.cluster.ClusterSpec;
import com.datastax.oss.simulacron.common.cluster.DataCenterSpec;
import com.datastax.oss.simulacron.common.cluster.QueryLog;
import com.datastax.oss.simulacron.common.codec.WriteType;
import com.datastax.oss.simulacron.server.BoundCluster;
import com.datastax.oss.simulacron.server.Server;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import org.assertj.core.api.AbstractThrowableAssert;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException;
import uk.sky.cqlmigrate.util.PortScavenger;
import java.net.Inet4Address;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.UUID;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import static com.datastax.oss.simulacron.common.stubbing.PrimeDsl.*;
import static java.lang.String.valueOf;
import static org.assertj.core.api.Assertions.*;
package uk.sky.cqlmigrate;
public class CassandraLockingMechanismTest {
private static final String LOCK_KEYSPACE = "lock-keyspace";
private static final String CLIENT_ID = UUID.randomUUID().toString();
private static final String PREPARE_INSERT_QUERY = "INSERT INTO cqlmigrate.locks (name, client) VALUES (?, ?) IF NOT EXISTS";
private static final String PREPARE_DELETE_QUERY = "DELETE FROM cqlmigrate.locks WHERE name = ? IF client = ?";
| private static final int defaultStartingPort = PortScavenger.getFreePort(); |
sky-uk/cqlmigrate | src/test/java/uk/sky/cqlmigrate/CassandraLockingMechanismTest.java | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
//
// Path: src/test/java/uk/sky/cqlmigrate/util/PortScavenger.java
// public class PortScavenger {
//
// public static int getFreePort() {
// ServerSocket socket = null;
// try {
// socket = new ServerSocket(0);
// socket.setReuseAddress(true);
// int port = socket.getLocalPort();
// closeSocket(socket);
// return port;
// } catch (IOException ignored) {
// } finally {
// closeSocket(socket);
// }
// throw new IllegalStateException("Could not find a free TCP/IP port to start embedded Jetty HTTP Server on");
//
// }
//
// private static void closeSocket(ServerSocket socket) {
// if (socket != null) {
// try {
// socket.close();
// } catch (IOException ignored) {
// }
// }
// }
// }
| import com.datastax.oss.driver.api.core.ConsistencyLevel;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.protocol.internal.request.Prepare;
import com.datastax.oss.simulacron.common.cluster.ClusterSpec;
import com.datastax.oss.simulacron.common.cluster.DataCenterSpec;
import com.datastax.oss.simulacron.common.cluster.QueryLog;
import com.datastax.oss.simulacron.common.codec.WriteType;
import com.datastax.oss.simulacron.server.BoundCluster;
import com.datastax.oss.simulacron.server.Server;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import org.assertj.core.api.AbstractThrowableAssert;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException;
import uk.sky.cqlmigrate.util.PortScavenger;
import java.net.Inet4Address;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.UUID;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import static com.datastax.oss.simulacron.common.stubbing.PrimeDsl.*;
import static java.lang.String.valueOf;
import static org.assertj.core.api.Assertions.*; | .describedAs("lock not acquired")
.isFalse();
}
@Test
public void shouldUnsuccessfullyAcquireLockWhenInsertIsNotApplied() {
//given
cluster.prime(primeInsertQuery(LOCK_KEYSPACE, CLIENT_ID, true).
then(writeTimeout(com.datastax.oss.simulacron.common.codec.ConsistencyLevel.ALL, 1, 1, WriteType.SIMPLE)));
//when
lockingMechanism.init();
boolean acquiredLock = lockingMechanism.acquire(CLIENT_ID);
//then
assertThat(acquiredLock)
.describedAs("lock was not acquired")
.isFalse();
}
@Test
public void shouldThrowExceptionIfQueryFailsToExecuteWhenAcquiringLock() {
cluster.prime(primeInsertQuery(LOCK_KEYSPACE, CLIENT_ID, true).
then(unavailable(com.datastax.oss.simulacron.common.codec.ConsistencyLevel.ALL, 1, 1)));
lockingMechanism.init();
//when
Throwable throwable = catchThrowable(() -> lockingMechanism.acquire(CLIENT_ID));
//then
assertThat(throwable)
.isNotNull() | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
//
// Path: src/test/java/uk/sky/cqlmigrate/util/PortScavenger.java
// public class PortScavenger {
//
// public static int getFreePort() {
// ServerSocket socket = null;
// try {
// socket = new ServerSocket(0);
// socket.setReuseAddress(true);
// int port = socket.getLocalPort();
// closeSocket(socket);
// return port;
// } catch (IOException ignored) {
// } finally {
// closeSocket(socket);
// }
// throw new IllegalStateException("Could not find a free TCP/IP port to start embedded Jetty HTTP Server on");
//
// }
//
// private static void closeSocket(ServerSocket socket) {
// if (socket != null) {
// try {
// socket.close();
// } catch (IOException ignored) {
// }
// }
// }
// }
// Path: src/test/java/uk/sky/cqlmigrate/CassandraLockingMechanismTest.java
import com.datastax.oss.driver.api.core.ConsistencyLevel;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.protocol.internal.request.Prepare;
import com.datastax.oss.simulacron.common.cluster.ClusterSpec;
import com.datastax.oss.simulacron.common.cluster.DataCenterSpec;
import com.datastax.oss.simulacron.common.cluster.QueryLog;
import com.datastax.oss.simulacron.common.codec.WriteType;
import com.datastax.oss.simulacron.server.BoundCluster;
import com.datastax.oss.simulacron.server.Server;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import org.assertj.core.api.AbstractThrowableAssert;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException;
import uk.sky.cqlmigrate.util.PortScavenger;
import java.net.Inet4Address;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.UUID;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import static com.datastax.oss.simulacron.common.stubbing.PrimeDsl.*;
import static java.lang.String.valueOf;
import static org.assertj.core.api.Assertions.*;
.describedAs("lock not acquired")
.isFalse();
}
@Test
public void shouldUnsuccessfullyAcquireLockWhenInsertIsNotApplied() {
//given
cluster.prime(primeInsertQuery(LOCK_KEYSPACE, CLIENT_ID, true).
then(writeTimeout(com.datastax.oss.simulacron.common.codec.ConsistencyLevel.ALL, 1, 1, WriteType.SIMPLE)));
//when
lockingMechanism.init();
boolean acquiredLock = lockingMechanism.acquire(CLIENT_ID);
//then
assertThat(acquiredLock)
.describedAs("lock was not acquired")
.isFalse();
}
@Test
public void shouldThrowExceptionIfQueryFailsToExecuteWhenAcquiringLock() {
cluster.prime(primeInsertQuery(LOCK_KEYSPACE, CLIENT_ID, true).
then(unavailable(com.datastax.oss.simulacron.common.codec.ConsistencyLevel.ALL, 1, 1)));
lockingMechanism.init();
//when
Throwable throwable = catchThrowable(() -> lockingMechanism.acquire(CLIENT_ID));
//then
assertThat(throwable)
.isNotNull() | .isInstanceOf(CannotAcquireLockException.class) |
sky-uk/cqlmigrate | src/test/java/uk/sky/cqlmigrate/CassandraLockingMechanismTest.java | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
//
// Path: src/test/java/uk/sky/cqlmigrate/util/PortScavenger.java
// public class PortScavenger {
//
// public static int getFreePort() {
// ServerSocket socket = null;
// try {
// socket = new ServerSocket(0);
// socket.setReuseAddress(true);
// int port = socket.getLocalPort();
// closeSocket(socket);
// return port;
// } catch (IOException ignored) {
// } finally {
// closeSocket(socket);
// }
// throw new IllegalStateException("Could not find a free TCP/IP port to start embedded Jetty HTTP Server on");
//
// }
//
// private static void closeSocket(ServerSocket socket) {
// if (socket != null) {
// try {
// socket.close();
// } catch (IOException ignored) {
// }
// }
// }
// }
| import com.datastax.oss.driver.api.core.ConsistencyLevel;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.protocol.internal.request.Prepare;
import com.datastax.oss.simulacron.common.cluster.ClusterSpec;
import com.datastax.oss.simulacron.common.cluster.DataCenterSpec;
import com.datastax.oss.simulacron.common.cluster.QueryLog;
import com.datastax.oss.simulacron.common.codec.WriteType;
import com.datastax.oss.simulacron.server.BoundCluster;
import com.datastax.oss.simulacron.server.Server;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import org.assertj.core.api.AbstractThrowableAssert;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException;
import uk.sky.cqlmigrate.util.PortScavenger;
import java.net.Inet4Address;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.UUID;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import static com.datastax.oss.simulacron.common.stubbing.PrimeDsl.*;
import static java.lang.String.valueOf;
import static org.assertj.core.api.Assertions.*; | .collect(Collectors.toList());
assertThat(queryLogs.size()).isEqualTo(1);
}
@Test
public void shouldSuccessfullyReleaseLockWhenNoLockFound() {
cluster.prime(primeDeleteQuery(LOCK_KEYSPACE, CLIENT_ID, false));
lockingMechanism.init();
//when
AbstractThrowableAssert<?, ? extends Throwable> execution = assertThatCode(
() -> lockingMechanism.release(CLIENT_ID)
);
// then
execution.doesNotThrowAnyException();
}
@Test
public void shouldThrowExceptionIfQueryFailsToExecuteWhenReleasingLock() {
//given
cluster.prime(primeDeleteQuery(LOCK_KEYSPACE, CLIENT_ID, true).
then(unavailable(com.datastax.oss.simulacron.common.codec.ConsistencyLevel.ALL, 1, 1)));
lockingMechanism.init();
//when
Throwable throwable = catchThrowable(() -> lockingMechanism.release(CLIENT_ID));
//then
assertThat(throwable)
.isNotNull() | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
//
// Path: src/test/java/uk/sky/cqlmigrate/util/PortScavenger.java
// public class PortScavenger {
//
// public static int getFreePort() {
// ServerSocket socket = null;
// try {
// socket = new ServerSocket(0);
// socket.setReuseAddress(true);
// int port = socket.getLocalPort();
// closeSocket(socket);
// return port;
// } catch (IOException ignored) {
// } finally {
// closeSocket(socket);
// }
// throw new IllegalStateException("Could not find a free TCP/IP port to start embedded Jetty HTTP Server on");
//
// }
//
// private static void closeSocket(ServerSocket socket) {
// if (socket != null) {
// try {
// socket.close();
// } catch (IOException ignored) {
// }
// }
// }
// }
// Path: src/test/java/uk/sky/cqlmigrate/CassandraLockingMechanismTest.java
import com.datastax.oss.driver.api.core.ConsistencyLevel;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.DriverException;
import com.datastax.oss.protocol.internal.request.Prepare;
import com.datastax.oss.simulacron.common.cluster.ClusterSpec;
import com.datastax.oss.simulacron.common.cluster.DataCenterSpec;
import com.datastax.oss.simulacron.common.cluster.QueryLog;
import com.datastax.oss.simulacron.common.codec.WriteType;
import com.datastax.oss.simulacron.server.BoundCluster;
import com.datastax.oss.simulacron.server.Server;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import org.assertj.core.api.AbstractThrowableAssert;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException;
import uk.sky.cqlmigrate.util.PortScavenger;
import java.net.Inet4Address;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.UUID;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import static com.datastax.oss.simulacron.common.stubbing.PrimeDsl.*;
import static java.lang.String.valueOf;
import static org.assertj.core.api.Assertions.*;
.collect(Collectors.toList());
assertThat(queryLogs.size()).isEqualTo(1);
}
@Test
public void shouldSuccessfullyReleaseLockWhenNoLockFound() {
cluster.prime(primeDeleteQuery(LOCK_KEYSPACE, CLIENT_ID, false));
lockingMechanism.init();
//when
AbstractThrowableAssert<?, ? extends Throwable> execution = assertThatCode(
() -> lockingMechanism.release(CLIENT_ID)
);
// then
execution.doesNotThrowAnyException();
}
@Test
public void shouldThrowExceptionIfQueryFailsToExecuteWhenReleasingLock() {
//given
cluster.prime(primeDeleteQuery(LOCK_KEYSPACE, CLIENT_ID, true).
then(unavailable(com.datastax.oss.simulacron.common.codec.ConsistencyLevel.ALL, 1, 1)));
lockingMechanism.init();
//when
Throwable throwable = catchThrowable(() -> lockingMechanism.release(CLIENT_ID));
//then
assertThat(throwable)
.isNotNull() | .isInstanceOf(CannotReleaseLockException.class) |
sky-uk/cqlmigrate | src/main/java/uk/sky/cqlmigrate/PreMigrationChecker.java | // Path: src/main/java/uk/sky/cqlmigrate/SchemaUpdates.java
// public static final String SCHEMA_UPDATES_TABLE = "schema_updates";
| import com.datastax.oss.driver.api.core.CqlIdentifier;
import com.datastax.oss.driver.api.core.metadata.schema.RelationMetadata;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import static uk.sky.cqlmigrate.SchemaUpdates.SCHEMA_UPDATES_TABLE; | package uk.sky.cqlmigrate;
public class PreMigrationChecker {
private static final Logger LOGGER = LoggerFactory.getLogger(PreMigrationChecker.class);
private final SessionContext sessionContext;
private final String keyspace;
private final SchemaChecker schemaChecker;
private final CqlPaths paths;
public PreMigrationChecker(SessionContext sessionContext, String keyspace, SchemaChecker schemaChecker, CqlPaths paths) {
this.sessionContext = sessionContext;
this.keyspace = keyspace;
this.schemaChecker = schemaChecker;
this.paths = paths;
}
boolean migrationIsNeeded() {
return !keyspaceExists() || !schemaUpdatesTableExists() || !allMigrationFilesApplied();
}
private boolean keyspaceExists() {
return sessionContext.getSession().getMetadata().getKeyspace(keyspace).isPresent();
}
private boolean schemaUpdatesTableExists() {
if(keyspaceExists()){
return sessionContext.getSession().getMetadata().getKeyspace(keyspace) | // Path: src/main/java/uk/sky/cqlmigrate/SchemaUpdates.java
// public static final String SCHEMA_UPDATES_TABLE = "schema_updates";
// Path: src/main/java/uk/sky/cqlmigrate/PreMigrationChecker.java
import com.datastax.oss.driver.api.core.CqlIdentifier;
import com.datastax.oss.driver.api.core.metadata.schema.RelationMetadata;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import static uk.sky.cqlmigrate.SchemaUpdates.SCHEMA_UPDATES_TABLE;
package uk.sky.cqlmigrate;
public class PreMigrationChecker {
private static final Logger LOGGER = LoggerFactory.getLogger(PreMigrationChecker.class);
private final SessionContext sessionContext;
private final String keyspace;
private final SchemaChecker schemaChecker;
private final CqlPaths paths;
public PreMigrationChecker(SessionContext sessionContext, String keyspace, SchemaChecker schemaChecker, CqlPaths paths) {
this.sessionContext = sessionContext;
this.keyspace = keyspace;
this.schemaChecker = schemaChecker;
this.paths = paths;
}
boolean migrationIsNeeded() {
return !keyspaceExists() || !schemaUpdatesTableExists() || !allMigrationFilesApplied();
}
private boolean keyspaceExists() {
return sessionContext.getSession().getMetadata().getKeyspace(keyspace).isPresent();
}
private boolean schemaUpdatesTableExists() {
if(keyspaceExists()){
return sessionContext.getSession().getMetadata().getKeyspace(keyspace) | .flatMap(keyspaceMetadata -> keyspaceMetadata.getTable(SCHEMA_UPDATES_TABLE)).isPresent(); |
sky-uk/cqlmigrate | src/test/java/uk/sky/cqlmigrate/ClusterHealthTest.java | // Path: src/main/java/uk/sky/cqlmigrate/exception/ClusterUnhealthyException.java
// public class ClusterUnhealthyException extends RuntimeException {
// public ClusterUnhealthyException(String message) {
// super(message);
// }
// }
//
// Path: src/test/java/uk/sky/cqlmigrate/util/PortScavenger.java
// public class PortScavenger {
//
// public static int getFreePort() {
// ServerSocket socket = null;
// try {
// socket = new ServerSocket(0);
// socket.setReuseAddress(true);
// int port = socket.getLocalPort();
// closeSocket(socket);
// return port;
// } catch (IOException ignored) {
// } finally {
// closeSocket(socket);
// }
// throw new IllegalStateException("Could not find a free TCP/IP port to start embedded Jetty HTTP Server on");
//
// }
//
// private static void closeSocket(ServerSocket socket) {
// if (socket != null) {
// try {
// socket.close();
// } catch (IOException ignored) {
// }
// }
// }
// }
| import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.simulacron.common.cluster.ClusterSpec;
import com.datastax.oss.simulacron.common.cluster.DataCenterSpec;
import com.datastax.oss.simulacron.server.BoundCluster;
import com.datastax.oss.simulacron.server.RejectScope;
import com.datastax.oss.simulacron.server.Server;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import uk.sky.cqlmigrate.exception.ClusterUnhealthyException;
import uk.sky.cqlmigrate.util.PortScavenger;
import java.net.Inet4Address;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.UUID;
import static com.datastax.oss.simulacron.common.stubbing.CloseType.DISCONNECT;
import static com.datastax.oss.simulacron.common.stubbing.PrimeDsl.rows;
import static com.datastax.oss.simulacron.common.stubbing.PrimeDsl.when;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;
import static org.awaitility.Awaitility.await; |
bCluster.prime(when("select cluster_name from system.local where key = 'local'")
.then(rows().row("cluster_name", "0").build()));
realCluster = CqlSession.builder()
.addContactPoint(new InetSocketAddress(Inet4Address.getByAddress(new byte[]{127, 0, 0, 1}), defaultStartingPort))
.withLocalDatacenter(dc.getName())
.build();
clusterHealth = new ClusterHealth(realCluster);
}
@After
public void tearDown() {
realCluster.close();
}
@Test
public void shouldThrowExceptionIfHostIsDown() {
//given
bCluster.node(0).closeConnections(DISCONNECT);
bCluster.node(0).rejectConnections(0, RejectScope.UNBIND);
await().pollInterval(500, MILLISECONDS)
.atMost(5, SECONDS)
.untilAsserted(() -> {
//when
Throwable throwable = catchThrowable(clusterHealth::check);
//then
assertThat(throwable).isNotNull(); | // Path: src/main/java/uk/sky/cqlmigrate/exception/ClusterUnhealthyException.java
// public class ClusterUnhealthyException extends RuntimeException {
// public ClusterUnhealthyException(String message) {
// super(message);
// }
// }
//
// Path: src/test/java/uk/sky/cqlmigrate/util/PortScavenger.java
// public class PortScavenger {
//
// public static int getFreePort() {
// ServerSocket socket = null;
// try {
// socket = new ServerSocket(0);
// socket.setReuseAddress(true);
// int port = socket.getLocalPort();
// closeSocket(socket);
// return port;
// } catch (IOException ignored) {
// } finally {
// closeSocket(socket);
// }
// throw new IllegalStateException("Could not find a free TCP/IP port to start embedded Jetty HTTP Server on");
//
// }
//
// private static void closeSocket(ServerSocket socket) {
// if (socket != null) {
// try {
// socket.close();
// } catch (IOException ignored) {
// }
// }
// }
// }
// Path: src/test/java/uk/sky/cqlmigrate/ClusterHealthTest.java
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.simulacron.common.cluster.ClusterSpec;
import com.datastax.oss.simulacron.common.cluster.DataCenterSpec;
import com.datastax.oss.simulacron.server.BoundCluster;
import com.datastax.oss.simulacron.server.RejectScope;
import com.datastax.oss.simulacron.server.Server;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import uk.sky.cqlmigrate.exception.ClusterUnhealthyException;
import uk.sky.cqlmigrate.util.PortScavenger;
import java.net.Inet4Address;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.UUID;
import static com.datastax.oss.simulacron.common.stubbing.CloseType.DISCONNECT;
import static com.datastax.oss.simulacron.common.stubbing.PrimeDsl.rows;
import static com.datastax.oss.simulacron.common.stubbing.PrimeDsl.when;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;
import static org.awaitility.Awaitility.await;
bCluster.prime(when("select cluster_name from system.local where key = 'local'")
.then(rows().row("cluster_name", "0").build()));
realCluster = CqlSession.builder()
.addContactPoint(new InetSocketAddress(Inet4Address.getByAddress(new byte[]{127, 0, 0, 1}), defaultStartingPort))
.withLocalDatacenter(dc.getName())
.build();
clusterHealth = new ClusterHealth(realCluster);
}
@After
public void tearDown() {
realCluster.close();
}
@Test
public void shouldThrowExceptionIfHostIsDown() {
//given
bCluster.node(0).closeConnections(DISCONNECT);
bCluster.node(0).rejectConnections(0, RejectScope.UNBIND);
await().pollInterval(500, MILLISECONDS)
.atMost(5, SECONDS)
.untilAsserted(() -> {
//when
Throwable throwable = catchThrowable(clusterHealth::check);
//then
assertThat(throwable).isNotNull(); | assertThat(throwable).isInstanceOf(ClusterUnhealthyException.class); |
sky-uk/cqlmigrate | src/main/java/uk/sky/cqlmigrate/CassandraNoOpLockingMechanism.java | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
| import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException; | package uk.sky.cqlmigrate;
class CassandraNoOpLockingMechanism extends LockingMechanism {
public CassandraNoOpLockingMechanism() {
super("NoOp");
}
/**
* Nothing to prepare.
*/
@Override | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
// Path: src/main/java/uk/sky/cqlmigrate/CassandraNoOpLockingMechanism.java
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException;
package uk.sky.cqlmigrate;
class CassandraNoOpLockingMechanism extends LockingMechanism {
public CassandraNoOpLockingMechanism() {
super("NoOp");
}
/**
* Nothing to prepare.
*/
@Override | public void init() throws CannotAcquireLockException { |
sky-uk/cqlmigrate | src/main/java/uk/sky/cqlmigrate/CassandraNoOpLockingMechanism.java | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
| import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException; | package uk.sky.cqlmigrate;
class CassandraNoOpLockingMechanism extends LockingMechanism {
public CassandraNoOpLockingMechanism() {
super("NoOp");
}
/**
* Nothing to prepare.
*/
@Override
public void init() throws CannotAcquireLockException {
}
/**
* {@inheritDoc}
* <p>
* Always a success, no lock to acquire.
*/
@Override
public boolean acquire(String clientId) throws CannotAcquireLockException {
return true;
}
/**
* {@inheritDoc}
* <p>
* Always a success, no lock to release.
*/
@Override | // Path: src/main/java/uk/sky/cqlmigrate/exception/CannotAcquireLockException.java
// public class CannotAcquireLockException extends LockException {
//
// public CannotAcquireLockException(String message) {
// super(message);
// }
//
// public CannotAcquireLockException(String message, Throwable cause) {
// super(message, cause);
// }
// }
//
// Path: src/main/java/uk/sky/cqlmigrate/exception/CannotReleaseLockException.java
// public class CannotReleaseLockException extends LockException {
//
// public CannotReleaseLockException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public CannotReleaseLockException(String message) {
// super(message);
// }
// }
// Path: src/main/java/uk/sky/cqlmigrate/CassandraNoOpLockingMechanism.java
import uk.sky.cqlmigrate.exception.CannotAcquireLockException;
import uk.sky.cqlmigrate.exception.CannotReleaseLockException;
package uk.sky.cqlmigrate;
class CassandraNoOpLockingMechanism extends LockingMechanism {
public CassandraNoOpLockingMechanism() {
super("NoOp");
}
/**
* Nothing to prepare.
*/
@Override
public void init() throws CannotAcquireLockException {
}
/**
* {@inheritDoc}
* <p>
* Always a success, no lock to acquire.
*/
@Override
public boolean acquire(String clientId) throws CannotAcquireLockException {
return true;
}
/**
* {@inheritDoc}
* <p>
* Always a success, no lock to release.
*/
@Override | public boolean release(String clientId) throws CannotReleaseLockException { |
sky-uk/cqlmigrate | src/test/java/uk/sky/cqlmigrate/CqlMigratorConsistencyLevelIntegrationTest.java | // Path: src/test/java/uk/sky/cqlmigrate/util/PortScavenger.java
// public class PortScavenger {
//
// public static int getFreePort() {
// ServerSocket socket = null;
// try {
// socket = new ServerSocket(0);
// socket.setReuseAddress(true);
// int port = socket.getLocalPort();
// closeSocket(socket);
// return port;
// } catch (IOException ignored) {
// } finally {
// closeSocket(socket);
// }
// throw new IllegalStateException("Could not find a free TCP/IP port to start embedded Jetty HTTP Server on");
//
// }
//
// private static void closeSocket(ServerSocket socket) {
// if (socket != null) {
// try {
// socket.close();
// } catch (IOException ignored) {
// }
// }
// }
// }
| import com.datastax.oss.driver.api.core.ConsistencyLevel;
import com.datastax.oss.simulacron.common.cluster.ClusterSpec;
import com.datastax.oss.simulacron.common.cluster.DataCenterSpec;
import com.datastax.oss.simulacron.common.cluster.QueryLog;
import com.datastax.oss.simulacron.common.cluster.RequestPrime;
import com.datastax.oss.simulacron.common.request.Query;
import com.datastax.oss.simulacron.common.result.SuccessResult;
import com.datastax.oss.simulacron.common.stubbing.Prime;
import com.datastax.oss.simulacron.common.stubbing.PrimeDsl;
import com.datastax.oss.simulacron.server.BoundCluster;
import com.datastax.oss.simulacron.server.Server;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import org.apache.cassandra.exceptions.ConfigurationException;
import org.junit.*;
import uk.sky.cqlmigrate.util.PortScavenger;
import java.net.Inet4Address;
import java.net.InetSocketAddress;
import java.net.URISyntaxException;
import java.net.UnknownHostException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import java.util.stream.Collectors;
import static com.datastax.oss.simulacron.common.stubbing.PrimeDsl.*;
import static java.lang.String.valueOf;
import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat; | package uk.sky.cqlmigrate;
public class CqlMigratorConsistencyLevelIntegrationTest {
private static final String CLIENT_ID = UUID.randomUUID().toString(); | // Path: src/test/java/uk/sky/cqlmigrate/util/PortScavenger.java
// public class PortScavenger {
//
// public static int getFreePort() {
// ServerSocket socket = null;
// try {
// socket = new ServerSocket(0);
// socket.setReuseAddress(true);
// int port = socket.getLocalPort();
// closeSocket(socket);
// return port;
// } catch (IOException ignored) {
// } finally {
// closeSocket(socket);
// }
// throw new IllegalStateException("Could not find a free TCP/IP port to start embedded Jetty HTTP Server on");
//
// }
//
// private static void closeSocket(ServerSocket socket) {
// if (socket != null) {
// try {
// socket.close();
// } catch (IOException ignored) {
// }
// }
// }
// }
// Path: src/test/java/uk/sky/cqlmigrate/CqlMigratorConsistencyLevelIntegrationTest.java
import com.datastax.oss.driver.api.core.ConsistencyLevel;
import com.datastax.oss.simulacron.common.cluster.ClusterSpec;
import com.datastax.oss.simulacron.common.cluster.DataCenterSpec;
import com.datastax.oss.simulacron.common.cluster.QueryLog;
import com.datastax.oss.simulacron.common.cluster.RequestPrime;
import com.datastax.oss.simulacron.common.request.Query;
import com.datastax.oss.simulacron.common.result.SuccessResult;
import com.datastax.oss.simulacron.common.stubbing.Prime;
import com.datastax.oss.simulacron.common.stubbing.PrimeDsl;
import com.datastax.oss.simulacron.server.BoundCluster;
import com.datastax.oss.simulacron.server.Server;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import org.apache.cassandra.exceptions.ConfigurationException;
import org.junit.*;
import uk.sky.cqlmigrate.util.PortScavenger;
import java.net.Inet4Address;
import java.net.InetSocketAddress;
import java.net.URISyntaxException;
import java.net.UnknownHostException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import java.util.stream.Collectors;
import static com.datastax.oss.simulacron.common.stubbing.PrimeDsl.*;
import static java.lang.String.valueOf;
import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;
package uk.sky.cqlmigrate;
public class CqlMigratorConsistencyLevelIntegrationTest {
private static final String CLIENT_ID = UUID.randomUUID().toString(); | private static final int defaultStartingPort = PortScavenger.getFreePort(); |
ryanramage/couch-audio-recorder | src/main/java/com/googlecode/eckoit/audio/ContinousAudioConvereter.java | // Path: src/main/java/com/googlecode/eckoit/events/ConversionFinishedEvent.java
// public class ConversionFinishedEvent {
// private File finishedFile;
// private File availableToStream;
// private int streamDuration;
// private String segmentCount;
//
//
// public ConversionFinishedEvent(File finishedFile) {
// this.finishedFile = finishedFile;
// }
//
// public File getFinishedFile() {
// return finishedFile;
// }
//
// /**
// * @return the availableToStream
// */
// public File getAvailableToStream() {
// return availableToStream;
// }
//
// /**
// * @param availableToStream the availableToStream to set
// */
// public void setAvailableToStream(File availableToStream) {
// this.availableToStream = availableToStream;
// }
//
// /**
// * @return the streamDuration
// */
// public int getStreamDuration() {
// return streamDuration;
// }
//
// /**
// * @param streamDuration the streamDuration to set
// */
// public void setStreamDuration(int streamDuration) {
// this.streamDuration = streamDuration;
// }
//
// /**
// * @return the segmentCount
// */
// public String getSegmentCount() {
// return segmentCount;
// }
//
// /**
// * @param segmentCount the segmentCount to set
// */
// public void setSegmentCount(String segmentCount) {
// this.segmentCount = segmentCount;
// }
//
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/RecordingSplitEvent.java
// public class RecordingSplitEvent {
// private File finishedFile;
// private boolean isFinal = false;
// private String recordingID;
// private long startTime;
//
// public RecordingSplitEvent(File finishedFile, String recordingID, long startTime) {
// this.recordingID = recordingID;
// this.finishedFile = finishedFile;
// this.startTime = startTime;
// }
//
// public File getFinishedFile() {
// return finishedFile;
// }
//
// /**
// * @param finishedFile the finishedFile to set
// */
// public void setFinishedFile(File finishedFile) {
// this.finishedFile = finishedFile;
// }
//
// /**
// * @return the isFinal
// */
// public boolean isIsFinal() {
// return isFinal;
// }
//
// /**
// * @param isFinal the isFinal to set
// */
// public void setIsFinal(boolean isFinal) {
// this.isFinal = isFinal;
// }
//
// /**
// * @return the recordingID
// */
// public String getRecordingID() {
// return recordingID;
// }
//
// /**
// * @param recordingID the recordingID to set
// */
// public void setRecordingID(String recordingID) {
// this.recordingID = recordingID;
// }
//
// /**
// * @return the startTime
// */
// public long getStartTime() {
// return startTime;
// }
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/StreamReadyEvent.java
// public class StreamReadyEvent extends ConversionFinishedEvent {
//
//
// private String contentType;
// private long startTime;
//
//
// public StreamReadyEvent(File finishedFile, String contentType, long startTime) {
// super(finishedFile);
// this.contentType = contentType;
// this.startTime = startTime;
// }
//
// /**
// * @return the contentType
// */
// public String getContentType() {
// return contentType;
// }
//
// /**
// * @return the startTime
// */
// public long getStartTime() {
// return startTime;
// }
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/util/Slugger.java
// public class Slugger {
//
// public static String generateSlug(String text) {
// return text.replaceAll("[^a-zA-Z0-9]", "_");
// }
//
// }
| import com.github.couchapptakeout.events.ExitApplicationMessage;
import com.googlecode.eckoit.events.ConversionFinishedEvent;
import com.googlecode.eckoit.events.RecordingSplitEvent;
import com.googlecode.eckoit.events.StreamReadyEvent;
import com.googlecode.eckoit.util.Slugger;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bushe.swing.event.EventBus;
import org.bushe.swing.event.EventSubscriber; | try {
RecordingSplitEvent recordingFinished = completedRecordings.take();
File wav = recordingFinished.getFinishedFile();
if (wav != null) {
if (tooFresh(wav)) {
completedRecordings.add(recordingFinished);
} else {
Logger.getLogger(ContinousAudioConvereter.class.getName()).log(Level.INFO, "converting wav: " + wav.getAbsolutePath());
doConversion(recordingFinished.getRecordingID(), wav, recordingFinished.getStartTime());
}
}
} catch (InterruptedException ex) {
Logger.getLogger(ContinousAudioConvereter.class.getName()).log(Level.SEVERE, null, ex);
}
sleep();
}
System.out.println("Continous Audio Converter Shutdown");
}
protected void doConversion(String recordingID, File wav, long sectionStartTime) {
File mp3 = null;
File ogg = null;
try {
mp3 = convertToMP3(recordingID, wav);
if (config.isStream()) {
File ts = convertToTs(recordingID, mp3);
| // Path: src/main/java/com/googlecode/eckoit/events/ConversionFinishedEvent.java
// public class ConversionFinishedEvent {
// private File finishedFile;
// private File availableToStream;
// private int streamDuration;
// private String segmentCount;
//
//
// public ConversionFinishedEvent(File finishedFile) {
// this.finishedFile = finishedFile;
// }
//
// public File getFinishedFile() {
// return finishedFile;
// }
//
// /**
// * @return the availableToStream
// */
// public File getAvailableToStream() {
// return availableToStream;
// }
//
// /**
// * @param availableToStream the availableToStream to set
// */
// public void setAvailableToStream(File availableToStream) {
// this.availableToStream = availableToStream;
// }
//
// /**
// * @return the streamDuration
// */
// public int getStreamDuration() {
// return streamDuration;
// }
//
// /**
// * @param streamDuration the streamDuration to set
// */
// public void setStreamDuration(int streamDuration) {
// this.streamDuration = streamDuration;
// }
//
// /**
// * @return the segmentCount
// */
// public String getSegmentCount() {
// return segmentCount;
// }
//
// /**
// * @param segmentCount the segmentCount to set
// */
// public void setSegmentCount(String segmentCount) {
// this.segmentCount = segmentCount;
// }
//
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/RecordingSplitEvent.java
// public class RecordingSplitEvent {
// private File finishedFile;
// private boolean isFinal = false;
// private String recordingID;
// private long startTime;
//
// public RecordingSplitEvent(File finishedFile, String recordingID, long startTime) {
// this.recordingID = recordingID;
// this.finishedFile = finishedFile;
// this.startTime = startTime;
// }
//
// public File getFinishedFile() {
// return finishedFile;
// }
//
// /**
// * @param finishedFile the finishedFile to set
// */
// public void setFinishedFile(File finishedFile) {
// this.finishedFile = finishedFile;
// }
//
// /**
// * @return the isFinal
// */
// public boolean isIsFinal() {
// return isFinal;
// }
//
// /**
// * @param isFinal the isFinal to set
// */
// public void setIsFinal(boolean isFinal) {
// this.isFinal = isFinal;
// }
//
// /**
// * @return the recordingID
// */
// public String getRecordingID() {
// return recordingID;
// }
//
// /**
// * @param recordingID the recordingID to set
// */
// public void setRecordingID(String recordingID) {
// this.recordingID = recordingID;
// }
//
// /**
// * @return the startTime
// */
// public long getStartTime() {
// return startTime;
// }
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/StreamReadyEvent.java
// public class StreamReadyEvent extends ConversionFinishedEvent {
//
//
// private String contentType;
// private long startTime;
//
//
// public StreamReadyEvent(File finishedFile, String contentType, long startTime) {
// super(finishedFile);
// this.contentType = contentType;
// this.startTime = startTime;
// }
//
// /**
// * @return the contentType
// */
// public String getContentType() {
// return contentType;
// }
//
// /**
// * @return the startTime
// */
// public long getStartTime() {
// return startTime;
// }
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/util/Slugger.java
// public class Slugger {
//
// public static String generateSlug(String text) {
// return text.replaceAll("[^a-zA-Z0-9]", "_");
// }
//
// }
// Path: src/main/java/com/googlecode/eckoit/audio/ContinousAudioConvereter.java
import com.github.couchapptakeout.events.ExitApplicationMessage;
import com.googlecode.eckoit.events.ConversionFinishedEvent;
import com.googlecode.eckoit.events.RecordingSplitEvent;
import com.googlecode.eckoit.events.StreamReadyEvent;
import com.googlecode.eckoit.util.Slugger;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bushe.swing.event.EventBus;
import org.bushe.swing.event.EventSubscriber;
try {
RecordingSplitEvent recordingFinished = completedRecordings.take();
File wav = recordingFinished.getFinishedFile();
if (wav != null) {
if (tooFresh(wav)) {
completedRecordings.add(recordingFinished);
} else {
Logger.getLogger(ContinousAudioConvereter.class.getName()).log(Level.INFO, "converting wav: " + wav.getAbsolutePath());
doConversion(recordingFinished.getRecordingID(), wav, recordingFinished.getStartTime());
}
}
} catch (InterruptedException ex) {
Logger.getLogger(ContinousAudioConvereter.class.getName()).log(Level.SEVERE, null, ex);
}
sleep();
}
System.out.println("Continous Audio Converter Shutdown");
}
protected void doConversion(String recordingID, File wav, long sectionStartTime) {
File mp3 = null;
File ogg = null;
try {
mp3 = convertToMP3(recordingID, wav);
if (config.isStream()) {
File ts = convertToTs(recordingID, mp3);
| StreamReadyEvent sre = new StreamReadyEvent(mp3, "video/MP2T", sectionStartTime); |
ryanramage/couch-audio-recorder | src/main/java/com/googlecode/eckoit/audio/ContinousAudioConvereter.java | // Path: src/main/java/com/googlecode/eckoit/events/ConversionFinishedEvent.java
// public class ConversionFinishedEvent {
// private File finishedFile;
// private File availableToStream;
// private int streamDuration;
// private String segmentCount;
//
//
// public ConversionFinishedEvent(File finishedFile) {
// this.finishedFile = finishedFile;
// }
//
// public File getFinishedFile() {
// return finishedFile;
// }
//
// /**
// * @return the availableToStream
// */
// public File getAvailableToStream() {
// return availableToStream;
// }
//
// /**
// * @param availableToStream the availableToStream to set
// */
// public void setAvailableToStream(File availableToStream) {
// this.availableToStream = availableToStream;
// }
//
// /**
// * @return the streamDuration
// */
// public int getStreamDuration() {
// return streamDuration;
// }
//
// /**
// * @param streamDuration the streamDuration to set
// */
// public void setStreamDuration(int streamDuration) {
// this.streamDuration = streamDuration;
// }
//
// /**
// * @return the segmentCount
// */
// public String getSegmentCount() {
// return segmentCount;
// }
//
// /**
// * @param segmentCount the segmentCount to set
// */
// public void setSegmentCount(String segmentCount) {
// this.segmentCount = segmentCount;
// }
//
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/RecordingSplitEvent.java
// public class RecordingSplitEvent {
// private File finishedFile;
// private boolean isFinal = false;
// private String recordingID;
// private long startTime;
//
// public RecordingSplitEvent(File finishedFile, String recordingID, long startTime) {
// this.recordingID = recordingID;
// this.finishedFile = finishedFile;
// this.startTime = startTime;
// }
//
// public File getFinishedFile() {
// return finishedFile;
// }
//
// /**
// * @param finishedFile the finishedFile to set
// */
// public void setFinishedFile(File finishedFile) {
// this.finishedFile = finishedFile;
// }
//
// /**
// * @return the isFinal
// */
// public boolean isIsFinal() {
// return isFinal;
// }
//
// /**
// * @param isFinal the isFinal to set
// */
// public void setIsFinal(boolean isFinal) {
// this.isFinal = isFinal;
// }
//
// /**
// * @return the recordingID
// */
// public String getRecordingID() {
// return recordingID;
// }
//
// /**
// * @param recordingID the recordingID to set
// */
// public void setRecordingID(String recordingID) {
// this.recordingID = recordingID;
// }
//
// /**
// * @return the startTime
// */
// public long getStartTime() {
// return startTime;
// }
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/StreamReadyEvent.java
// public class StreamReadyEvent extends ConversionFinishedEvent {
//
//
// private String contentType;
// private long startTime;
//
//
// public StreamReadyEvent(File finishedFile, String contentType, long startTime) {
// super(finishedFile);
// this.contentType = contentType;
// this.startTime = startTime;
// }
//
// /**
// * @return the contentType
// */
// public String getContentType() {
// return contentType;
// }
//
// /**
// * @return the startTime
// */
// public long getStartTime() {
// return startTime;
// }
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/util/Slugger.java
// public class Slugger {
//
// public static String generateSlug(String text) {
// return text.replaceAll("[^a-zA-Z0-9]", "_");
// }
//
// }
| import com.github.couchapptakeout.events.ExitApplicationMessage;
import com.googlecode.eckoit.events.ConversionFinishedEvent;
import com.googlecode.eckoit.events.RecordingSplitEvent;
import com.googlecode.eckoit.events.StreamReadyEvent;
import com.googlecode.eckoit.util.Slugger;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bushe.swing.event.EventBus;
import org.bushe.swing.event.EventSubscriber; | } catch (InterruptedException ex) {
Logger.getLogger(ContinousAudioConvereter.class.getName()).log(Level.SEVERE, null, ex);
}
sleep();
}
System.out.println("Continous Audio Converter Shutdown");
}
protected void doConversion(String recordingID, File wav, long sectionStartTime) {
File mp3 = null;
File ogg = null;
try {
mp3 = convertToMP3(recordingID, wav);
if (config.isStream()) {
File ts = convertToTs(recordingID, mp3);
StreamReadyEvent sre = new StreamReadyEvent(mp3, "video/MP2T", sectionStartTime);
sre.setAvailableToStream(ts);
sre.setStreamDuration((int) (SplitAudioRecorder.getSplitTime() / 1000));
sre.setSegmentCount(getSegmentCount(wav));
EventBus.publish(sre);
}
ogg = convertToOGG(recordingID, wav);
} catch (Exception ex) {
Logger.getLogger(ContinousAudioConvereter.class.getName()).log(Level.SEVERE, null, ex);
}
if (ogg != null && ogg.exists() && mp3 != null && mp3.exists()) {
| // Path: src/main/java/com/googlecode/eckoit/events/ConversionFinishedEvent.java
// public class ConversionFinishedEvent {
// private File finishedFile;
// private File availableToStream;
// private int streamDuration;
// private String segmentCount;
//
//
// public ConversionFinishedEvent(File finishedFile) {
// this.finishedFile = finishedFile;
// }
//
// public File getFinishedFile() {
// return finishedFile;
// }
//
// /**
// * @return the availableToStream
// */
// public File getAvailableToStream() {
// return availableToStream;
// }
//
// /**
// * @param availableToStream the availableToStream to set
// */
// public void setAvailableToStream(File availableToStream) {
// this.availableToStream = availableToStream;
// }
//
// /**
// * @return the streamDuration
// */
// public int getStreamDuration() {
// return streamDuration;
// }
//
// /**
// * @param streamDuration the streamDuration to set
// */
// public void setStreamDuration(int streamDuration) {
// this.streamDuration = streamDuration;
// }
//
// /**
// * @return the segmentCount
// */
// public String getSegmentCount() {
// return segmentCount;
// }
//
// /**
// * @param segmentCount the segmentCount to set
// */
// public void setSegmentCount(String segmentCount) {
// this.segmentCount = segmentCount;
// }
//
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/RecordingSplitEvent.java
// public class RecordingSplitEvent {
// private File finishedFile;
// private boolean isFinal = false;
// private String recordingID;
// private long startTime;
//
// public RecordingSplitEvent(File finishedFile, String recordingID, long startTime) {
// this.recordingID = recordingID;
// this.finishedFile = finishedFile;
// this.startTime = startTime;
// }
//
// public File getFinishedFile() {
// return finishedFile;
// }
//
// /**
// * @param finishedFile the finishedFile to set
// */
// public void setFinishedFile(File finishedFile) {
// this.finishedFile = finishedFile;
// }
//
// /**
// * @return the isFinal
// */
// public boolean isIsFinal() {
// return isFinal;
// }
//
// /**
// * @param isFinal the isFinal to set
// */
// public void setIsFinal(boolean isFinal) {
// this.isFinal = isFinal;
// }
//
// /**
// * @return the recordingID
// */
// public String getRecordingID() {
// return recordingID;
// }
//
// /**
// * @param recordingID the recordingID to set
// */
// public void setRecordingID(String recordingID) {
// this.recordingID = recordingID;
// }
//
// /**
// * @return the startTime
// */
// public long getStartTime() {
// return startTime;
// }
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/StreamReadyEvent.java
// public class StreamReadyEvent extends ConversionFinishedEvent {
//
//
// private String contentType;
// private long startTime;
//
//
// public StreamReadyEvent(File finishedFile, String contentType, long startTime) {
// super(finishedFile);
// this.contentType = contentType;
// this.startTime = startTime;
// }
//
// /**
// * @return the contentType
// */
// public String getContentType() {
// return contentType;
// }
//
// /**
// * @return the startTime
// */
// public long getStartTime() {
// return startTime;
// }
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/util/Slugger.java
// public class Slugger {
//
// public static String generateSlug(String text) {
// return text.replaceAll("[^a-zA-Z0-9]", "_");
// }
//
// }
// Path: src/main/java/com/googlecode/eckoit/audio/ContinousAudioConvereter.java
import com.github.couchapptakeout.events.ExitApplicationMessage;
import com.googlecode.eckoit.events.ConversionFinishedEvent;
import com.googlecode.eckoit.events.RecordingSplitEvent;
import com.googlecode.eckoit.events.StreamReadyEvent;
import com.googlecode.eckoit.util.Slugger;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bushe.swing.event.EventBus;
import org.bushe.swing.event.EventSubscriber;
} catch (InterruptedException ex) {
Logger.getLogger(ContinousAudioConvereter.class.getName()).log(Level.SEVERE, null, ex);
}
sleep();
}
System.out.println("Continous Audio Converter Shutdown");
}
protected void doConversion(String recordingID, File wav, long sectionStartTime) {
File mp3 = null;
File ogg = null;
try {
mp3 = convertToMP3(recordingID, wav);
if (config.isStream()) {
File ts = convertToTs(recordingID, mp3);
StreamReadyEvent sre = new StreamReadyEvent(mp3, "video/MP2T", sectionStartTime);
sre.setAvailableToStream(ts);
sre.setStreamDuration((int) (SplitAudioRecorder.getSplitTime() / 1000));
sre.setSegmentCount(getSegmentCount(wav));
EventBus.publish(sre);
}
ogg = convertToOGG(recordingID, wav);
} catch (Exception ex) {
Logger.getLogger(ContinousAudioConvereter.class.getName()).log(Level.SEVERE, null, ex);
}
if (ogg != null && ogg.exists() && mp3 != null && mp3.exists()) {
| ConversionFinishedEvent finished = new ConversionFinishedEvent(wav); |
ryanramage/couch-audio-recorder | src/main/java/com/googlecode/eckoit/audio/ContinousAudioConvereter.java | // Path: src/main/java/com/googlecode/eckoit/events/ConversionFinishedEvent.java
// public class ConversionFinishedEvent {
// private File finishedFile;
// private File availableToStream;
// private int streamDuration;
// private String segmentCount;
//
//
// public ConversionFinishedEvent(File finishedFile) {
// this.finishedFile = finishedFile;
// }
//
// public File getFinishedFile() {
// return finishedFile;
// }
//
// /**
// * @return the availableToStream
// */
// public File getAvailableToStream() {
// return availableToStream;
// }
//
// /**
// * @param availableToStream the availableToStream to set
// */
// public void setAvailableToStream(File availableToStream) {
// this.availableToStream = availableToStream;
// }
//
// /**
// * @return the streamDuration
// */
// public int getStreamDuration() {
// return streamDuration;
// }
//
// /**
// * @param streamDuration the streamDuration to set
// */
// public void setStreamDuration(int streamDuration) {
// this.streamDuration = streamDuration;
// }
//
// /**
// * @return the segmentCount
// */
// public String getSegmentCount() {
// return segmentCount;
// }
//
// /**
// * @param segmentCount the segmentCount to set
// */
// public void setSegmentCount(String segmentCount) {
// this.segmentCount = segmentCount;
// }
//
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/RecordingSplitEvent.java
// public class RecordingSplitEvent {
// private File finishedFile;
// private boolean isFinal = false;
// private String recordingID;
// private long startTime;
//
// public RecordingSplitEvent(File finishedFile, String recordingID, long startTime) {
// this.recordingID = recordingID;
// this.finishedFile = finishedFile;
// this.startTime = startTime;
// }
//
// public File getFinishedFile() {
// return finishedFile;
// }
//
// /**
// * @param finishedFile the finishedFile to set
// */
// public void setFinishedFile(File finishedFile) {
// this.finishedFile = finishedFile;
// }
//
// /**
// * @return the isFinal
// */
// public boolean isIsFinal() {
// return isFinal;
// }
//
// /**
// * @param isFinal the isFinal to set
// */
// public void setIsFinal(boolean isFinal) {
// this.isFinal = isFinal;
// }
//
// /**
// * @return the recordingID
// */
// public String getRecordingID() {
// return recordingID;
// }
//
// /**
// * @param recordingID the recordingID to set
// */
// public void setRecordingID(String recordingID) {
// this.recordingID = recordingID;
// }
//
// /**
// * @return the startTime
// */
// public long getStartTime() {
// return startTime;
// }
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/StreamReadyEvent.java
// public class StreamReadyEvent extends ConversionFinishedEvent {
//
//
// private String contentType;
// private long startTime;
//
//
// public StreamReadyEvent(File finishedFile, String contentType, long startTime) {
// super(finishedFile);
// this.contentType = contentType;
// this.startTime = startTime;
// }
//
// /**
// * @return the contentType
// */
// public String getContentType() {
// return contentType;
// }
//
// /**
// * @return the startTime
// */
// public long getStartTime() {
// return startTime;
// }
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/util/Slugger.java
// public class Slugger {
//
// public static String generateSlug(String text) {
// return text.replaceAll("[^a-zA-Z0-9]", "_");
// }
//
// }
| import com.github.couchapptakeout.events.ExitApplicationMessage;
import com.googlecode.eckoit.events.ConversionFinishedEvent;
import com.googlecode.eckoit.events.RecordingSplitEvent;
import com.googlecode.eckoit.events.StreamReadyEvent;
import com.googlecode.eckoit.util.Slugger;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bushe.swing.event.EventBus;
import org.bushe.swing.event.EventSubscriber; | //System.out.println("Renaming");
mp3Temp.renameTo(mp3);
return mp3;
}
private synchronized File convertToOGG(String recordingID, File wav) throws InterruptedException, IOException {
File ogg = getFileForDocument(recordingID, wav, ".ogg");
if (ogg.exists()) return ogg;
long bitrate = config.getOggBitrate();
long frequency = config.getOggFrequency();
File oggTemp = getFileForDocument(recordingID, wav, "tmp.ogg");
FFMpegConverter converter = new FFMpegConverter(getFfmpegcmd(), FFMpegConverter.ENCODER_VORBIS);
converter.convert(wav, bitrate, frequency, oggTemp, true);
oggTemp.renameTo(ogg);
return ogg;
}
private File convertToTs(String recordingID, File mp3) throws InterruptedException, IOException {
FFMpegConverter converter = new FFMpegConverter(getFfmpegcmd(), FFMpegConverter.ENCODER_MP3);
File ts = getFileForDocument(recordingID, mp3, ".ts");
converter.makeTS(mp3, ts);
return ts;
}
private File getFileForDocument(String recordingID, File wav, String suffix) {
// just do sibblings
String count = getSegmentCount(wav);
| // Path: src/main/java/com/googlecode/eckoit/events/ConversionFinishedEvent.java
// public class ConversionFinishedEvent {
// private File finishedFile;
// private File availableToStream;
// private int streamDuration;
// private String segmentCount;
//
//
// public ConversionFinishedEvent(File finishedFile) {
// this.finishedFile = finishedFile;
// }
//
// public File getFinishedFile() {
// return finishedFile;
// }
//
// /**
// * @return the availableToStream
// */
// public File getAvailableToStream() {
// return availableToStream;
// }
//
// /**
// * @param availableToStream the availableToStream to set
// */
// public void setAvailableToStream(File availableToStream) {
// this.availableToStream = availableToStream;
// }
//
// /**
// * @return the streamDuration
// */
// public int getStreamDuration() {
// return streamDuration;
// }
//
// /**
// * @param streamDuration the streamDuration to set
// */
// public void setStreamDuration(int streamDuration) {
// this.streamDuration = streamDuration;
// }
//
// /**
// * @return the segmentCount
// */
// public String getSegmentCount() {
// return segmentCount;
// }
//
// /**
// * @param segmentCount the segmentCount to set
// */
// public void setSegmentCount(String segmentCount) {
// this.segmentCount = segmentCount;
// }
//
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/RecordingSplitEvent.java
// public class RecordingSplitEvent {
// private File finishedFile;
// private boolean isFinal = false;
// private String recordingID;
// private long startTime;
//
// public RecordingSplitEvent(File finishedFile, String recordingID, long startTime) {
// this.recordingID = recordingID;
// this.finishedFile = finishedFile;
// this.startTime = startTime;
// }
//
// public File getFinishedFile() {
// return finishedFile;
// }
//
// /**
// * @param finishedFile the finishedFile to set
// */
// public void setFinishedFile(File finishedFile) {
// this.finishedFile = finishedFile;
// }
//
// /**
// * @return the isFinal
// */
// public boolean isIsFinal() {
// return isFinal;
// }
//
// /**
// * @param isFinal the isFinal to set
// */
// public void setIsFinal(boolean isFinal) {
// this.isFinal = isFinal;
// }
//
// /**
// * @return the recordingID
// */
// public String getRecordingID() {
// return recordingID;
// }
//
// /**
// * @param recordingID the recordingID to set
// */
// public void setRecordingID(String recordingID) {
// this.recordingID = recordingID;
// }
//
// /**
// * @return the startTime
// */
// public long getStartTime() {
// return startTime;
// }
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/StreamReadyEvent.java
// public class StreamReadyEvent extends ConversionFinishedEvent {
//
//
// private String contentType;
// private long startTime;
//
//
// public StreamReadyEvent(File finishedFile, String contentType, long startTime) {
// super(finishedFile);
// this.contentType = contentType;
// this.startTime = startTime;
// }
//
// /**
// * @return the contentType
// */
// public String getContentType() {
// return contentType;
// }
//
// /**
// * @return the startTime
// */
// public long getStartTime() {
// return startTime;
// }
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/util/Slugger.java
// public class Slugger {
//
// public static String generateSlug(String text) {
// return text.replaceAll("[^a-zA-Z0-9]", "_");
// }
//
// }
// Path: src/main/java/com/googlecode/eckoit/audio/ContinousAudioConvereter.java
import com.github.couchapptakeout.events.ExitApplicationMessage;
import com.googlecode.eckoit.events.ConversionFinishedEvent;
import com.googlecode.eckoit.events.RecordingSplitEvent;
import com.googlecode.eckoit.events.StreamReadyEvent;
import com.googlecode.eckoit.util.Slugger;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bushe.swing.event.EventBus;
import org.bushe.swing.event.EventSubscriber;
//System.out.println("Renaming");
mp3Temp.renameTo(mp3);
return mp3;
}
private synchronized File convertToOGG(String recordingID, File wav) throws InterruptedException, IOException {
File ogg = getFileForDocument(recordingID, wav, ".ogg");
if (ogg.exists()) return ogg;
long bitrate = config.getOggBitrate();
long frequency = config.getOggFrequency();
File oggTemp = getFileForDocument(recordingID, wav, "tmp.ogg");
FFMpegConverter converter = new FFMpegConverter(getFfmpegcmd(), FFMpegConverter.ENCODER_VORBIS);
converter.convert(wav, bitrate, frequency, oggTemp, true);
oggTemp.renameTo(ogg);
return ogg;
}
private File convertToTs(String recordingID, File mp3) throws InterruptedException, IOException {
FFMpegConverter converter = new FFMpegConverter(getFfmpegcmd(), FFMpegConverter.ENCODER_MP3);
File ts = getFileForDocument(recordingID, mp3, ".ts");
converter.makeTS(mp3, ts);
return ts;
}
private File getFileForDocument(String recordingID, File wav, String suffix) {
// just do sibblings
String count = getSegmentCount(wav);
| String safeId = Slugger.generateSlug(recordingID); |
ryanramage/couch-audio-recorder | src/main/java/com/googlecode/eckoit/audio/RecordingFinishedHelper.java | // Path: src/main/java/com/googlecode/eckoit/util/Slugger.java
// public class Slugger {
//
// public static String generateSlug(String text) {
// return text.replaceAll("[^a-zA-Z0-9]", "_");
// }
//
// }
| import com.googlecode.eckoit.util.Slugger;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.io.IOUtils; | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.googlecode.eckoit.audio;
/**
*
* @author ryan
*/
public class RecordingFinishedHelper {
File recordingInProgressDir;
File recordingCompleteDir;
String ffmpegComand;
public RecordingFinishedHelper(File recordingInProgressDir, File recordingCompleteDir, String ffmpeg) {
this.recordingInProgressDir = recordingInProgressDir;
this.recordingCompleteDir = recordingCompleteDir;
this.ffmpegComand = ffmpeg;
}
public File[] recordingFinished(String recordingId) throws FileNotFoundException, IOException {
| // Path: src/main/java/com/googlecode/eckoit/util/Slugger.java
// public class Slugger {
//
// public static String generateSlug(String text) {
// return text.replaceAll("[^a-zA-Z0-9]", "_");
// }
//
// }
// Path: src/main/java/com/googlecode/eckoit/audio/RecordingFinishedHelper.java
import com.googlecode.eckoit.util.Slugger;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.io.IOUtils;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.googlecode.eckoit.audio;
/**
*
* @author ryan
*/
public class RecordingFinishedHelper {
File recordingInProgressDir;
File recordingCompleteDir;
String ffmpegComand;
public RecordingFinishedHelper(File recordingInProgressDir, File recordingCompleteDir, String ffmpeg) {
this.recordingInProgressDir = recordingInProgressDir;
this.recordingCompleteDir = recordingCompleteDir;
this.ffmpegComand = ffmpeg;
}
public File[] recordingFinished(String recordingId) throws FileNotFoundException, IOException {
| String safeId = Slugger.generateSlug(recordingId); |
ryanramage/couch-audio-recorder | src/main/java/com/googlecode/eckoit/screengrab/ScreenGrabber.java | // Path: src/main/java/com/googlecode/eckoit/events/ScreenGrabFinishEvent.java
// public class ScreenGrabFinishEvent {
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/ScreenGrabStartEvent.java
// public class ScreenGrabStartEvent {
// private File storageDir;
// private long intervalInMilli;
// private boolean presentationMode = false;
//
// public ScreenGrabStartEvent(File storageDir) {
// this.storageDir = storageDir;
// intervalInMilli = 5000; // default to 5 seconds
// }
// public ScreenGrabStartEvent(File storageDir, long intervalInMilli) {
// this.storageDir = storageDir;
// this.intervalInMilli = intervalInMilli;
// }
// public ScreenGrabStartEvent(File storageDir, boolean presentationMode) {
// this.storageDir = storageDir;
// this.presentationMode = presentationMode;
// }
// public long getIntervalInMilli(){
// return this.intervalInMilli;
// }
//
// public File getStorageDir() {
// return storageDir;
// }
//
// public boolean getPresentationMode() {
// return presentationMode;
// }
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/TargetClickedEvent.java
// public class TargetClickedEvent {
//
// }
| import com.github.couchapptakeout.events.ExitApplicationMessage;
import com.googlecode.eckoit.events.ScreenGrabFinishEvent;
import com.googlecode.eckoit.events.ScreenGrabStartEvent;
import com.googlecode.eckoit.events.TargetClickedEvent;
import java.awt.AWTException;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.event.InputEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import org.bushe.swing.event.EventBus;
import org.bushe.swing.event.EventSubscriber; | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.googlecode.eckoit.screengrab;
/**
*
* @author ryan
*/
public class ScreenGrabber {
private File currentDir;
private Timer timer;
private boolean inPresentationMode = false;
public ScreenGrabber() {
| // Path: src/main/java/com/googlecode/eckoit/events/ScreenGrabFinishEvent.java
// public class ScreenGrabFinishEvent {
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/ScreenGrabStartEvent.java
// public class ScreenGrabStartEvent {
// private File storageDir;
// private long intervalInMilli;
// private boolean presentationMode = false;
//
// public ScreenGrabStartEvent(File storageDir) {
// this.storageDir = storageDir;
// intervalInMilli = 5000; // default to 5 seconds
// }
// public ScreenGrabStartEvent(File storageDir, long intervalInMilli) {
// this.storageDir = storageDir;
// this.intervalInMilli = intervalInMilli;
// }
// public ScreenGrabStartEvent(File storageDir, boolean presentationMode) {
// this.storageDir = storageDir;
// this.presentationMode = presentationMode;
// }
// public long getIntervalInMilli(){
// return this.intervalInMilli;
// }
//
// public File getStorageDir() {
// return storageDir;
// }
//
// public boolean getPresentationMode() {
// return presentationMode;
// }
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/TargetClickedEvent.java
// public class TargetClickedEvent {
//
// }
// Path: src/main/java/com/googlecode/eckoit/screengrab/ScreenGrabber.java
import com.github.couchapptakeout.events.ExitApplicationMessage;
import com.googlecode.eckoit.events.ScreenGrabFinishEvent;
import com.googlecode.eckoit.events.ScreenGrabStartEvent;
import com.googlecode.eckoit.events.TargetClickedEvent;
import java.awt.AWTException;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.event.InputEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import org.bushe.swing.event.EventBus;
import org.bushe.swing.event.EventSubscriber;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.googlecode.eckoit.screengrab;
/**
*
* @author ryan
*/
public class ScreenGrabber {
private File currentDir;
private Timer timer;
private boolean inPresentationMode = false;
public ScreenGrabber() {
| EventBus.subscribeStrongly(TargetClickedEvent.class, new EventSubscriber<TargetClickedEvent>() { |
ryanramage/couch-audio-recorder | src/main/java/com/googlecode/eckoit/screengrab/ScreenGrabber.java | // Path: src/main/java/com/googlecode/eckoit/events/ScreenGrabFinishEvent.java
// public class ScreenGrabFinishEvent {
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/ScreenGrabStartEvent.java
// public class ScreenGrabStartEvent {
// private File storageDir;
// private long intervalInMilli;
// private boolean presentationMode = false;
//
// public ScreenGrabStartEvent(File storageDir) {
// this.storageDir = storageDir;
// intervalInMilli = 5000; // default to 5 seconds
// }
// public ScreenGrabStartEvent(File storageDir, long intervalInMilli) {
// this.storageDir = storageDir;
// this.intervalInMilli = intervalInMilli;
// }
// public ScreenGrabStartEvent(File storageDir, boolean presentationMode) {
// this.storageDir = storageDir;
// this.presentationMode = presentationMode;
// }
// public long getIntervalInMilli(){
// return this.intervalInMilli;
// }
//
// public File getStorageDir() {
// return storageDir;
// }
//
// public boolean getPresentationMode() {
// return presentationMode;
// }
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/TargetClickedEvent.java
// public class TargetClickedEvent {
//
// }
| import com.github.couchapptakeout.events.ExitApplicationMessage;
import com.googlecode.eckoit.events.ScreenGrabFinishEvent;
import com.googlecode.eckoit.events.ScreenGrabStartEvent;
import com.googlecode.eckoit.events.TargetClickedEvent;
import java.awt.AWTException;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.event.InputEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import org.bushe.swing.event.EventBus;
import org.bushe.swing.event.EventSubscriber; | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.googlecode.eckoit.screengrab;
/**
*
* @author ryan
*/
public class ScreenGrabber {
private File currentDir;
private Timer timer;
private boolean inPresentationMode = false;
public ScreenGrabber() {
EventBus.subscribeStrongly(TargetClickedEvent.class, new EventSubscriber<TargetClickedEvent>() {
@Override
public void onEvent(TargetClickedEvent t) {
if (inPresentationMode) {
Robot robot;
try {
robot = new Robot();
Point last = MouseInfo.getPointerInfo().getLocation();
robot.mouseMove(10, 10);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
robot.mouseMove(last.x, last.y);
System.out.println("Taking picture");
// wait to take the picture
Thread.sleep(300);
capture();
} catch (Exception ex) {
Logger.getLogger(ScreenGrabber.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
});
| // Path: src/main/java/com/googlecode/eckoit/events/ScreenGrabFinishEvent.java
// public class ScreenGrabFinishEvent {
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/ScreenGrabStartEvent.java
// public class ScreenGrabStartEvent {
// private File storageDir;
// private long intervalInMilli;
// private boolean presentationMode = false;
//
// public ScreenGrabStartEvent(File storageDir) {
// this.storageDir = storageDir;
// intervalInMilli = 5000; // default to 5 seconds
// }
// public ScreenGrabStartEvent(File storageDir, long intervalInMilli) {
// this.storageDir = storageDir;
// this.intervalInMilli = intervalInMilli;
// }
// public ScreenGrabStartEvent(File storageDir, boolean presentationMode) {
// this.storageDir = storageDir;
// this.presentationMode = presentationMode;
// }
// public long getIntervalInMilli(){
// return this.intervalInMilli;
// }
//
// public File getStorageDir() {
// return storageDir;
// }
//
// public boolean getPresentationMode() {
// return presentationMode;
// }
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/TargetClickedEvent.java
// public class TargetClickedEvent {
//
// }
// Path: src/main/java/com/googlecode/eckoit/screengrab/ScreenGrabber.java
import com.github.couchapptakeout.events.ExitApplicationMessage;
import com.googlecode.eckoit.events.ScreenGrabFinishEvent;
import com.googlecode.eckoit.events.ScreenGrabStartEvent;
import com.googlecode.eckoit.events.TargetClickedEvent;
import java.awt.AWTException;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.event.InputEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import org.bushe.swing.event.EventBus;
import org.bushe.swing.event.EventSubscriber;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.googlecode.eckoit.screengrab;
/**
*
* @author ryan
*/
public class ScreenGrabber {
private File currentDir;
private Timer timer;
private boolean inPresentationMode = false;
public ScreenGrabber() {
EventBus.subscribeStrongly(TargetClickedEvent.class, new EventSubscriber<TargetClickedEvent>() {
@Override
public void onEvent(TargetClickedEvent t) {
if (inPresentationMode) {
Robot robot;
try {
robot = new Robot();
Point last = MouseInfo.getPointerInfo().getLocation();
robot.mouseMove(10, 10);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
robot.mouseMove(last.x, last.y);
System.out.println("Taking picture");
// wait to take the picture
Thread.sleep(300);
capture();
} catch (Exception ex) {
Logger.getLogger(ScreenGrabber.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
});
| EventBus.subscribeStrongly(ScreenGrabStartEvent.class, new EventSubscriber<ScreenGrabStartEvent>() { |
ryanramage/couch-audio-recorder | src/main/java/com/googlecode/eckoit/screengrab/ScreenGrabber.java | // Path: src/main/java/com/googlecode/eckoit/events/ScreenGrabFinishEvent.java
// public class ScreenGrabFinishEvent {
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/ScreenGrabStartEvent.java
// public class ScreenGrabStartEvent {
// private File storageDir;
// private long intervalInMilli;
// private boolean presentationMode = false;
//
// public ScreenGrabStartEvent(File storageDir) {
// this.storageDir = storageDir;
// intervalInMilli = 5000; // default to 5 seconds
// }
// public ScreenGrabStartEvent(File storageDir, long intervalInMilli) {
// this.storageDir = storageDir;
// this.intervalInMilli = intervalInMilli;
// }
// public ScreenGrabStartEvent(File storageDir, boolean presentationMode) {
// this.storageDir = storageDir;
// this.presentationMode = presentationMode;
// }
// public long getIntervalInMilli(){
// return this.intervalInMilli;
// }
//
// public File getStorageDir() {
// return storageDir;
// }
//
// public boolean getPresentationMode() {
// return presentationMode;
// }
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/TargetClickedEvent.java
// public class TargetClickedEvent {
//
// }
| import com.github.couchapptakeout.events.ExitApplicationMessage;
import com.googlecode.eckoit.events.ScreenGrabFinishEvent;
import com.googlecode.eckoit.events.ScreenGrabStartEvent;
import com.googlecode.eckoit.events.TargetClickedEvent;
import java.awt.AWTException;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.event.InputEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import org.bushe.swing.event.EventBus;
import org.bushe.swing.event.EventSubscriber; |
}
}
});
EventBus.subscribeStrongly(ScreenGrabStartEvent.class, new EventSubscriber<ScreenGrabStartEvent>() {
@Override
public void onEvent(ScreenGrabStartEvent t) {
currentDir = t.getStorageDir();
if (t.getPresentationMode()) {
inPresentationMode = true;
capture();
} else {
if (timer != null) {
timer.cancel();
}
timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
capture();
}
}, t.getIntervalInMilli(), t.getIntervalInMilli());
}
}
}); | // Path: src/main/java/com/googlecode/eckoit/events/ScreenGrabFinishEvent.java
// public class ScreenGrabFinishEvent {
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/ScreenGrabStartEvent.java
// public class ScreenGrabStartEvent {
// private File storageDir;
// private long intervalInMilli;
// private boolean presentationMode = false;
//
// public ScreenGrabStartEvent(File storageDir) {
// this.storageDir = storageDir;
// intervalInMilli = 5000; // default to 5 seconds
// }
// public ScreenGrabStartEvent(File storageDir, long intervalInMilli) {
// this.storageDir = storageDir;
// this.intervalInMilli = intervalInMilli;
// }
// public ScreenGrabStartEvent(File storageDir, boolean presentationMode) {
// this.storageDir = storageDir;
// this.presentationMode = presentationMode;
// }
// public long getIntervalInMilli(){
// return this.intervalInMilli;
// }
//
// public File getStorageDir() {
// return storageDir;
// }
//
// public boolean getPresentationMode() {
// return presentationMode;
// }
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/events/TargetClickedEvent.java
// public class TargetClickedEvent {
//
// }
// Path: src/main/java/com/googlecode/eckoit/screengrab/ScreenGrabber.java
import com.github.couchapptakeout.events.ExitApplicationMessage;
import com.googlecode.eckoit.events.ScreenGrabFinishEvent;
import com.googlecode.eckoit.events.ScreenGrabStartEvent;
import com.googlecode.eckoit.events.TargetClickedEvent;
import java.awt.AWTException;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.event.InputEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import org.bushe.swing.event.EventBus;
import org.bushe.swing.event.EventSubscriber;
}
}
});
EventBus.subscribeStrongly(ScreenGrabStartEvent.class, new EventSubscriber<ScreenGrabStartEvent>() {
@Override
public void onEvent(ScreenGrabStartEvent t) {
currentDir = t.getStorageDir();
if (t.getPresentationMode()) {
inPresentationMode = true;
capture();
} else {
if (timer != null) {
timer.cancel();
}
timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
capture();
}
}, t.getIntervalInMilli(), t.getIntervalInMilli());
}
}
}); | EventBus.subscribeStrongly(ScreenGrabFinishEvent.class, new EventSubscriber<ScreenGrabFinishEvent>() { |
ryanramage/couch-audio-recorder | src/main/java/com/googlecode/eckoit/audio/SplitAudioRecorder.java | // Path: src/main/java/com/googlecode/eckoit/events/RecordingSplitEvent.java
// public class RecordingSplitEvent {
// private File finishedFile;
// private boolean isFinal = false;
// private String recordingID;
// private long startTime;
//
// public RecordingSplitEvent(File finishedFile, String recordingID, long startTime) {
// this.recordingID = recordingID;
// this.finishedFile = finishedFile;
// this.startTime = startTime;
// }
//
// public File getFinishedFile() {
// return finishedFile;
// }
//
// /**
// * @param finishedFile the finishedFile to set
// */
// public void setFinishedFile(File finishedFile) {
// this.finishedFile = finishedFile;
// }
//
// /**
// * @return the isFinal
// */
// public boolean isIsFinal() {
// return isFinal;
// }
//
// /**
// * @param isFinal the isFinal to set
// */
// public void setIsFinal(boolean isFinal) {
// this.isFinal = isFinal;
// }
//
// /**
// * @return the recordingID
// */
// public String getRecordingID() {
// return recordingID;
// }
//
// /**
// * @param recordingID the recordingID to set
// */
// public void setRecordingID(String recordingID) {
// this.recordingID = recordingID;
// }
//
// /**
// * @return the startTime
// */
// public long getStartTime() {
// return startTime;
// }
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/util/Slugger.java
// public class Slugger {
//
// public static String generateSlug(String text) {
// return text.replaceAll("[^a-zA-Z0-9]", "_");
// }
//
// }
| import com.googlecode.eckoit.events.RecordingSplitEvent;
import com.googlecode.eckoit.util.Slugger;
import java.io.IOException;
import java.io.File;
import java.util.Timer;
import java.util.TimerTask;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.TargetDataLine;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.AudioFileFormat;
import javax.sound.sampled.Mixer;
import org.bushe.swing.event.EventBus; | public static void setSplitTime(long splitTime) {
SplitAudioRecorder.splitTime = splitTime;
}
public static long getSplitTime() {
return splitTime;
}
public static void setConfig(SplitAudioRecorderConfiguration configSetup) {
config = configSetup;
}
public static void setRoot(File dir) {
root = dir;
if (!root.isDirectory()) {
throw new RuntimeException("A directory is expected");
}
}
@Override
public synchronized void startRecording(String recordingID, final String mixer, float gain) throws LineUnavailableException {
if (isRecording || m_line != null || (m_line != null && m_line.isOpen())) {
throw new LineUnavailableException();
}
| // Path: src/main/java/com/googlecode/eckoit/events/RecordingSplitEvent.java
// public class RecordingSplitEvent {
// private File finishedFile;
// private boolean isFinal = false;
// private String recordingID;
// private long startTime;
//
// public RecordingSplitEvent(File finishedFile, String recordingID, long startTime) {
// this.recordingID = recordingID;
// this.finishedFile = finishedFile;
// this.startTime = startTime;
// }
//
// public File getFinishedFile() {
// return finishedFile;
// }
//
// /**
// * @param finishedFile the finishedFile to set
// */
// public void setFinishedFile(File finishedFile) {
// this.finishedFile = finishedFile;
// }
//
// /**
// * @return the isFinal
// */
// public boolean isIsFinal() {
// return isFinal;
// }
//
// /**
// * @param isFinal the isFinal to set
// */
// public void setIsFinal(boolean isFinal) {
// this.isFinal = isFinal;
// }
//
// /**
// * @return the recordingID
// */
// public String getRecordingID() {
// return recordingID;
// }
//
// /**
// * @param recordingID the recordingID to set
// */
// public void setRecordingID(String recordingID) {
// this.recordingID = recordingID;
// }
//
// /**
// * @return the startTime
// */
// public long getStartTime() {
// return startTime;
// }
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/util/Slugger.java
// public class Slugger {
//
// public static String generateSlug(String text) {
// return text.replaceAll("[^a-zA-Z0-9]", "_");
// }
//
// }
// Path: src/main/java/com/googlecode/eckoit/audio/SplitAudioRecorder.java
import com.googlecode.eckoit.events.RecordingSplitEvent;
import com.googlecode.eckoit.util.Slugger;
import java.io.IOException;
import java.io.File;
import java.util.Timer;
import java.util.TimerTask;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.TargetDataLine;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.AudioFileFormat;
import javax.sound.sampled.Mixer;
import org.bushe.swing.event.EventBus;
public static void setSplitTime(long splitTime) {
SplitAudioRecorder.splitTime = splitTime;
}
public static long getSplitTime() {
return splitTime;
}
public static void setConfig(SplitAudioRecorderConfiguration configSetup) {
config = configSetup;
}
public static void setRoot(File dir) {
root = dir;
if (!root.isDirectory()) {
throw new RuntimeException("A directory is expected");
}
}
@Override
public synchronized void startRecording(String recordingID, final String mixer, float gain) throws LineUnavailableException {
if (isRecording || m_line != null || (m_line != null && m_line.isOpen())) {
throw new LineUnavailableException();
}
| String safeFileName = Slugger.generateSlug(recordingID); |
ryanramage/couch-audio-recorder | src/main/java/com/googlecode/eckoit/audio/SplitAudioRecorder.java | // Path: src/main/java/com/googlecode/eckoit/events/RecordingSplitEvent.java
// public class RecordingSplitEvent {
// private File finishedFile;
// private boolean isFinal = false;
// private String recordingID;
// private long startTime;
//
// public RecordingSplitEvent(File finishedFile, String recordingID, long startTime) {
// this.recordingID = recordingID;
// this.finishedFile = finishedFile;
// this.startTime = startTime;
// }
//
// public File getFinishedFile() {
// return finishedFile;
// }
//
// /**
// * @param finishedFile the finishedFile to set
// */
// public void setFinishedFile(File finishedFile) {
// this.finishedFile = finishedFile;
// }
//
// /**
// * @return the isFinal
// */
// public boolean isIsFinal() {
// return isFinal;
// }
//
// /**
// * @param isFinal the isFinal to set
// */
// public void setIsFinal(boolean isFinal) {
// this.isFinal = isFinal;
// }
//
// /**
// * @return the recordingID
// */
// public String getRecordingID() {
// return recordingID;
// }
//
// /**
// * @param recordingID the recordingID to set
// */
// public void setRecordingID(String recordingID) {
// this.recordingID = recordingID;
// }
//
// /**
// * @return the startTime
// */
// public long getStartTime() {
// return startTime;
// }
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/util/Slugger.java
// public class Slugger {
//
// public static String generateSlug(String text) {
// return text.replaceAll("[^a-zA-Z0-9]", "_");
// }
//
// }
| import com.googlecode.eckoit.events.RecordingSplitEvent;
import com.googlecode.eckoit.util.Slugger;
import java.io.IOException;
import java.io.File;
import java.util.Timer;
import java.util.TimerTask;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.TargetDataLine;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.AudioFileFormat;
import javax.sound.sampled.Mixer;
import org.bushe.swing.event.EventBus; | m_targetType = targetType;
m_outputFile = section;
new Recorder().start();
timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
sectionCount++;
File oldsection = section;
section = nextSectionFile();
split(oldsection, section);
}
}, splitTime, splitTime);
}
private File nextSectionFile() {
return new File(recordingFolder, sectionCount + ".wav");
}
private void split(File oldsection, File newsectiom) {
m_outputFile = newsectiom;
m_audioInputStream = m_audioInputStream.clone();
new Recorder().start();
long splitStartTime = System.currentTimeMillis() - splitTime;
| // Path: src/main/java/com/googlecode/eckoit/events/RecordingSplitEvent.java
// public class RecordingSplitEvent {
// private File finishedFile;
// private boolean isFinal = false;
// private String recordingID;
// private long startTime;
//
// public RecordingSplitEvent(File finishedFile, String recordingID, long startTime) {
// this.recordingID = recordingID;
// this.finishedFile = finishedFile;
// this.startTime = startTime;
// }
//
// public File getFinishedFile() {
// return finishedFile;
// }
//
// /**
// * @param finishedFile the finishedFile to set
// */
// public void setFinishedFile(File finishedFile) {
// this.finishedFile = finishedFile;
// }
//
// /**
// * @return the isFinal
// */
// public boolean isIsFinal() {
// return isFinal;
// }
//
// /**
// * @param isFinal the isFinal to set
// */
// public void setIsFinal(boolean isFinal) {
// this.isFinal = isFinal;
// }
//
// /**
// * @return the recordingID
// */
// public String getRecordingID() {
// return recordingID;
// }
//
// /**
// * @param recordingID the recordingID to set
// */
// public void setRecordingID(String recordingID) {
// this.recordingID = recordingID;
// }
//
// /**
// * @return the startTime
// */
// public long getStartTime() {
// return startTime;
// }
//
// }
//
// Path: src/main/java/com/googlecode/eckoit/util/Slugger.java
// public class Slugger {
//
// public static String generateSlug(String text) {
// return text.replaceAll("[^a-zA-Z0-9]", "_");
// }
//
// }
// Path: src/main/java/com/googlecode/eckoit/audio/SplitAudioRecorder.java
import com.googlecode.eckoit.events.RecordingSplitEvent;
import com.googlecode.eckoit.util.Slugger;
import java.io.IOException;
import java.io.File;
import java.util.Timer;
import java.util.TimerTask;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.TargetDataLine;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.AudioFileFormat;
import javax.sound.sampled.Mixer;
import org.bushe.swing.event.EventBus;
m_targetType = targetType;
m_outputFile = section;
new Recorder().start();
timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
sectionCount++;
File oldsection = section;
section = nextSectionFile();
split(oldsection, section);
}
}, splitTime, splitTime);
}
private File nextSectionFile() {
return new File(recordingFolder, sectionCount + ".wav");
}
private void split(File oldsection, File newsectiom) {
m_outputFile = newsectiom;
m_audioInputStream = m_audioInputStream.clone();
new Recorder().start();
long splitStartTime = System.currentTimeMillis() - splitTime;
| EventBus.publish(new RecordingSplitEvent(oldsection, recordingID, splitStartTime)); |
ryanramage/couch-audio-recorder | src/main/java/com/googlecode/eckoit/events/RecordingStartClickedEvent.java | // Path: src/main/java/com/googlecode/eckoit/audio/SplitAudioRecorderConfiguration.java
// public class SplitAudioRecorderConfiguration {
//
//
// private boolean stream = false;
//
// private float wavSampleRate = 16000.0F;
// private int wavSampleSize = 16;
//
// private long mp3Bitrate = 24000L;
// private long mp3Frequency = 16000L;
//
// private long oggBitrate = 24000L;
// private long oggFrequency = 22050L;
//
// /**
// * @return the wavSampleRate
// */
// public float getWavSampleRate() {
// return wavSampleRate;
// }
//
// /**
// * @param wavSampleRate the wavSampleRate to set
// */
// public void setWavSampleRate(float wavSampleRate) {
// this.wavSampleRate = wavSampleRate;
// }
//
// /**
// * @return the wavSampleSize
// */
// public int getWavSampleSize() {
// return wavSampleSize;
// }
//
// /**
// * @param wavSampleSize the wavSampleSize to set
// */
// public void setWavSampleSize(int wavSampleSize) {
// this.wavSampleSize = wavSampleSize;
// }
//
// /**
// * @return the mp3Bitrate
// */
// public long getMp3Bitrate() {
// return mp3Bitrate;
// }
//
// /**
// * @param mp3Bitrate the mp3Bitrate to set
// */
// public void setMp3Bitrate(long mp3Bitrate) {
// this.mp3Bitrate = mp3Bitrate;
// }
//
// /**
// * @return the mp3Frequency
// */
// public long getMp3Frequency() {
// return mp3Frequency;
// }
//
// /**
// * @param mp3Frequency the mp3Frequency to set
// */
// public void setMp3Frequency(long mp3Frequency) {
// this.mp3Frequency = mp3Frequency;
// }
//
// /**
// * @return the oggBitrate
// */
// public long getOggBitrate() {
// return oggBitrate;
// }
//
// /**
// * @param oggBitrate the oggBitrate to set
// */
// public void setOggBitrate(long oggBitrate) {
// this.oggBitrate = oggBitrate;
// }
//
// /**
// * @return the offFrequency
// */
// public long getOggFrequency() {
// return oggFrequency;
// }
//
// /**
// * @param offFrequency the offFrequency to set
// */
// public void setOggFrequency(long oggFrequency) {
// this.oggFrequency = oggFrequency;
// }
//
// /**
// * @return the stream
// */
// public boolean isStream() {
// return stream;
// }
//
// /**
// * @param stream the stream to set
// */
// public void setStream(boolean stream) {
// this.stream = stream;
// }
//
//
//
// }
| import com.googlecode.eckoit.audio.SplitAudioRecorderConfiguration; | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.googlecode.eckoit.events;
/**
*
* @author ryan
*/
public class RecordingStartClickedEvent {
private String recordingID; | // Path: src/main/java/com/googlecode/eckoit/audio/SplitAudioRecorderConfiguration.java
// public class SplitAudioRecorderConfiguration {
//
//
// private boolean stream = false;
//
// private float wavSampleRate = 16000.0F;
// private int wavSampleSize = 16;
//
// private long mp3Bitrate = 24000L;
// private long mp3Frequency = 16000L;
//
// private long oggBitrate = 24000L;
// private long oggFrequency = 22050L;
//
// /**
// * @return the wavSampleRate
// */
// public float getWavSampleRate() {
// return wavSampleRate;
// }
//
// /**
// * @param wavSampleRate the wavSampleRate to set
// */
// public void setWavSampleRate(float wavSampleRate) {
// this.wavSampleRate = wavSampleRate;
// }
//
// /**
// * @return the wavSampleSize
// */
// public int getWavSampleSize() {
// return wavSampleSize;
// }
//
// /**
// * @param wavSampleSize the wavSampleSize to set
// */
// public void setWavSampleSize(int wavSampleSize) {
// this.wavSampleSize = wavSampleSize;
// }
//
// /**
// * @return the mp3Bitrate
// */
// public long getMp3Bitrate() {
// return mp3Bitrate;
// }
//
// /**
// * @param mp3Bitrate the mp3Bitrate to set
// */
// public void setMp3Bitrate(long mp3Bitrate) {
// this.mp3Bitrate = mp3Bitrate;
// }
//
// /**
// * @return the mp3Frequency
// */
// public long getMp3Frequency() {
// return mp3Frequency;
// }
//
// /**
// * @param mp3Frequency the mp3Frequency to set
// */
// public void setMp3Frequency(long mp3Frequency) {
// this.mp3Frequency = mp3Frequency;
// }
//
// /**
// * @return the oggBitrate
// */
// public long getOggBitrate() {
// return oggBitrate;
// }
//
// /**
// * @param oggBitrate the oggBitrate to set
// */
// public void setOggBitrate(long oggBitrate) {
// this.oggBitrate = oggBitrate;
// }
//
// /**
// * @return the offFrequency
// */
// public long getOggFrequency() {
// return oggFrequency;
// }
//
// /**
// * @param offFrequency the offFrequency to set
// */
// public void setOggFrequency(long oggFrequency) {
// this.oggFrequency = oggFrequency;
// }
//
// /**
// * @return the stream
// */
// public boolean isStream() {
// return stream;
// }
//
// /**
// * @param stream the stream to set
// */
// public void setStream(boolean stream) {
// this.stream = stream;
// }
//
//
//
// }
// Path: src/main/java/com/googlecode/eckoit/events/RecordingStartClickedEvent.java
import com.googlecode.eckoit.audio.SplitAudioRecorderConfiguration;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.googlecode.eckoit.events;
/**
*
* @author ryan
*/
public class RecordingStartClickedEvent {
private String recordingID; | private SplitAudioRecorderConfiguration config; |
sprintwind/PacketCaptureTool | src/com/sprintwind/packetcapturetool/CaptureActivity.java | // Path: src/com/sprintwind/packetcapturetool/ShellUtils.java
// public static class CommandResult {
//
//
// /** result of command **/
// public int result;
// /** success message of command result **/
// public String successMsg;
// /** error message of command result **/
// public String errorMsg;
//
//
// public CommandResult(int result) {
// this.result = result;
// }
//
//
// public CommandResult(int result, String successMsg, String errorMsg) {
// this.result = result;
// this.successMsg = successMsg;
// this.errorMsg = errorMsg;
// }
// }
| import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import com.sprintwind.packetcapturetool.ShellUtils.CommandResult;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.BackgroundColorSpan;
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.Fragment;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Color;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener; |
private enum CaptureStatus{
STATUS_IDLE,
STATUS_STARTING,
STATUS_CAPTURING,
STATUS_STOPPING
};
private ArrayAdapter<String> arradpInterface;
private ArrayAdapter<CharSequence> arradpProtocol;
private ConnectionChangeReceiver broadcastReceiver;
private Button btnStartCapture;
private EditText etFileName;
private Button btnReGenerateFileName;
private ListView lvSettings;
private Dialog dlgCapturing;
private TextView txtvwCaptureAmount;
private Button btnStopCapture;
private ArrayList<HashMap<String, Object>> lstItems;
private Handler handler;
private Process process;
private String captoolDir;
private String sdcardDir;
private String saveFilePath;
private String[] strArrIfName;
| // Path: src/com/sprintwind/packetcapturetool/ShellUtils.java
// public static class CommandResult {
//
//
// /** result of command **/
// public int result;
// /** success message of command result **/
// public String successMsg;
// /** error message of command result **/
// public String errorMsg;
//
//
// public CommandResult(int result) {
// this.result = result;
// }
//
//
// public CommandResult(int result, String successMsg, String errorMsg) {
// this.result = result;
// this.successMsg = successMsg;
// this.errorMsg = errorMsg;
// }
// }
// Path: src/com/sprintwind/packetcapturetool/CaptureActivity.java
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import com.sprintwind.packetcapturetool.ShellUtils.CommandResult;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.BackgroundColorSpan;
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.Fragment;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Color;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;
private enum CaptureStatus{
STATUS_IDLE,
STATUS_STARTING,
STATUS_CAPTURING,
STATUS_STOPPING
};
private ArrayAdapter<String> arradpInterface;
private ArrayAdapter<CharSequence> arradpProtocol;
private ConnectionChangeReceiver broadcastReceiver;
private Button btnStartCapture;
private EditText etFileName;
private Button btnReGenerateFileName;
private ListView lvSettings;
private Dialog dlgCapturing;
private TextView txtvwCaptureAmount;
private Button btnStopCapture;
private ArrayList<HashMap<String, Object>> lstItems;
private Handler handler;
private Process process;
private String captoolDir;
private String sdcardDir;
private String saveFilePath;
private String[] strArrIfName;
| private CommandResult cmdResult; |
tobiasheine/Movies | app/src/main/java/com/tobi/movies/popularstream/PopularMoviesActivity.java | // Path: app/src/main/java/com/tobi/movies/ImageLoader.java
// public class ImageLoader {
//
// public void loadWebImageInto(Uri imageUrl, ImageView imageView) {
// Glide
// .with(imageView.getContext())
// .load(imageUrl)
// .crossFade()
// .into(imageView);
// }
// }
//
// Path: app/src/main/java/com/tobi/movies/MovieApplication.java
// public class MovieApplication extends Application {
//
// private PopularMoviesComponent popularMoviesComponent;
// private MovieDetailsComponent movieDetailsComponent;
//
// @Override
// public void onCreate() {
// super.onCreate();
// ApplicationComponent applicationComponent = applicationComponent();
// popularMoviesComponent = popularMoviesComponent(applicationComponent);
// movieDetailsComponent = movieDetailsComponent(applicationComponent);
// }
//
// protected ApplicationComponent applicationComponent() {
// return DaggerApplicationComponent.create();
// }
//
// protected MovieDetailsComponent movieDetailsComponent(ApplicationComponent applicationComponent) {
// return DaggerMovieDetailsComponent.builder()
// .applicationComponent(applicationComponent)
// .build();
// }
//
// protected PopularMoviesComponent popularMoviesComponent(ApplicationComponent applicationComponent) {
// return DaggerPopularMoviesComponent.builder()
// .applicationComponent(applicationComponent)
// .build();
// }
//
// public PopularMoviesComponent getPopularMoviesComponent() {
// return popularMoviesComponent;
// }
//
// public MovieDetailsComponent getMovieDetailsComponent() {
// return movieDetailsComponent;
// }
// }
//
// Path: app/src/main/java/com/tobi/movies/misc/AbstractObserver.java
// public abstract class AbstractObserver<T> implements Observer<T> {
// @Override
// public void onCompleted() {
// //no-op
// }
//
// @Override
// public void onError(Throwable e) {
// //no-op
// }
//
// @Override
// public void onNext(T t) {
// //no-op
// }
// }
| import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import com.tobi.movies.ImageLoader;
import com.tobi.movies.MovieApplication;
import com.tobi.movies.R;
import com.tobi.movies.backend.Backend;
import com.tobi.movies.misc.AbstractObserver;
import javax.inject.Inject;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife; | package com.tobi.movies.popularstream;
public class PopularMoviesActivity extends AppCompatActivity {
private static final String TAG = PopularMoviesActivity.class.getSimpleName();
private static final int POSTER_COL_COUNT = 3;
@BindView(R.id.popularMovies_recycler)
RecyclerView popularMoviesRecycler;
@Inject
Backend backend;
@Inject | // Path: app/src/main/java/com/tobi/movies/ImageLoader.java
// public class ImageLoader {
//
// public void loadWebImageInto(Uri imageUrl, ImageView imageView) {
// Glide
// .with(imageView.getContext())
// .load(imageUrl)
// .crossFade()
// .into(imageView);
// }
// }
//
// Path: app/src/main/java/com/tobi/movies/MovieApplication.java
// public class MovieApplication extends Application {
//
// private PopularMoviesComponent popularMoviesComponent;
// private MovieDetailsComponent movieDetailsComponent;
//
// @Override
// public void onCreate() {
// super.onCreate();
// ApplicationComponent applicationComponent = applicationComponent();
// popularMoviesComponent = popularMoviesComponent(applicationComponent);
// movieDetailsComponent = movieDetailsComponent(applicationComponent);
// }
//
// protected ApplicationComponent applicationComponent() {
// return DaggerApplicationComponent.create();
// }
//
// protected MovieDetailsComponent movieDetailsComponent(ApplicationComponent applicationComponent) {
// return DaggerMovieDetailsComponent.builder()
// .applicationComponent(applicationComponent)
// .build();
// }
//
// protected PopularMoviesComponent popularMoviesComponent(ApplicationComponent applicationComponent) {
// return DaggerPopularMoviesComponent.builder()
// .applicationComponent(applicationComponent)
// .build();
// }
//
// public PopularMoviesComponent getPopularMoviesComponent() {
// return popularMoviesComponent;
// }
//
// public MovieDetailsComponent getMovieDetailsComponent() {
// return movieDetailsComponent;
// }
// }
//
// Path: app/src/main/java/com/tobi/movies/misc/AbstractObserver.java
// public abstract class AbstractObserver<T> implements Observer<T> {
// @Override
// public void onCompleted() {
// //no-op
// }
//
// @Override
// public void onError(Throwable e) {
// //no-op
// }
//
// @Override
// public void onNext(T t) {
// //no-op
// }
// }
// Path: app/src/main/java/com/tobi/movies/popularstream/PopularMoviesActivity.java
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import com.tobi.movies.ImageLoader;
import com.tobi.movies.MovieApplication;
import com.tobi.movies.R;
import com.tobi.movies.backend.Backend;
import com.tobi.movies.misc.AbstractObserver;
import javax.inject.Inject;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
package com.tobi.movies.popularstream;
public class PopularMoviesActivity extends AppCompatActivity {
private static final String TAG = PopularMoviesActivity.class.getSimpleName();
private static final int POSTER_COL_COUNT = 3;
@BindView(R.id.popularMovies_recycler)
RecyclerView popularMoviesRecycler;
@Inject
Backend backend;
@Inject | ImageLoader imageLoader; |
tobiasheine/Movies | app/src/main/java/com/tobi/movies/popularstream/PopularMoviesActivity.java | // Path: app/src/main/java/com/tobi/movies/ImageLoader.java
// public class ImageLoader {
//
// public void loadWebImageInto(Uri imageUrl, ImageView imageView) {
// Glide
// .with(imageView.getContext())
// .load(imageUrl)
// .crossFade()
// .into(imageView);
// }
// }
//
// Path: app/src/main/java/com/tobi/movies/MovieApplication.java
// public class MovieApplication extends Application {
//
// private PopularMoviesComponent popularMoviesComponent;
// private MovieDetailsComponent movieDetailsComponent;
//
// @Override
// public void onCreate() {
// super.onCreate();
// ApplicationComponent applicationComponent = applicationComponent();
// popularMoviesComponent = popularMoviesComponent(applicationComponent);
// movieDetailsComponent = movieDetailsComponent(applicationComponent);
// }
//
// protected ApplicationComponent applicationComponent() {
// return DaggerApplicationComponent.create();
// }
//
// protected MovieDetailsComponent movieDetailsComponent(ApplicationComponent applicationComponent) {
// return DaggerMovieDetailsComponent.builder()
// .applicationComponent(applicationComponent)
// .build();
// }
//
// protected PopularMoviesComponent popularMoviesComponent(ApplicationComponent applicationComponent) {
// return DaggerPopularMoviesComponent.builder()
// .applicationComponent(applicationComponent)
// .build();
// }
//
// public PopularMoviesComponent getPopularMoviesComponent() {
// return popularMoviesComponent;
// }
//
// public MovieDetailsComponent getMovieDetailsComponent() {
// return movieDetailsComponent;
// }
// }
//
// Path: app/src/main/java/com/tobi/movies/misc/AbstractObserver.java
// public abstract class AbstractObserver<T> implements Observer<T> {
// @Override
// public void onCompleted() {
// //no-op
// }
//
// @Override
// public void onError(Throwable e) {
// //no-op
// }
//
// @Override
// public void onNext(T t) {
// //no-op
// }
// }
| import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import com.tobi.movies.ImageLoader;
import com.tobi.movies.MovieApplication;
import com.tobi.movies.R;
import com.tobi.movies.backend.Backend;
import com.tobi.movies.misc.AbstractObserver;
import javax.inject.Inject;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife; | package com.tobi.movies.popularstream;
public class PopularMoviesActivity extends AppCompatActivity {
private static final String TAG = PopularMoviesActivity.class.getSimpleName();
private static final int POSTER_COL_COUNT = 3;
@BindView(R.id.popularMovies_recycler)
RecyclerView popularMoviesRecycler;
@Inject
Backend backend;
@Inject
ImageLoader imageLoader;
@Inject
PopularStreamRepository streamRepository;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_popular_movies);
ButterKnife.bind(this); | // Path: app/src/main/java/com/tobi/movies/ImageLoader.java
// public class ImageLoader {
//
// public void loadWebImageInto(Uri imageUrl, ImageView imageView) {
// Glide
// .with(imageView.getContext())
// .load(imageUrl)
// .crossFade()
// .into(imageView);
// }
// }
//
// Path: app/src/main/java/com/tobi/movies/MovieApplication.java
// public class MovieApplication extends Application {
//
// private PopularMoviesComponent popularMoviesComponent;
// private MovieDetailsComponent movieDetailsComponent;
//
// @Override
// public void onCreate() {
// super.onCreate();
// ApplicationComponent applicationComponent = applicationComponent();
// popularMoviesComponent = popularMoviesComponent(applicationComponent);
// movieDetailsComponent = movieDetailsComponent(applicationComponent);
// }
//
// protected ApplicationComponent applicationComponent() {
// return DaggerApplicationComponent.create();
// }
//
// protected MovieDetailsComponent movieDetailsComponent(ApplicationComponent applicationComponent) {
// return DaggerMovieDetailsComponent.builder()
// .applicationComponent(applicationComponent)
// .build();
// }
//
// protected PopularMoviesComponent popularMoviesComponent(ApplicationComponent applicationComponent) {
// return DaggerPopularMoviesComponent.builder()
// .applicationComponent(applicationComponent)
// .build();
// }
//
// public PopularMoviesComponent getPopularMoviesComponent() {
// return popularMoviesComponent;
// }
//
// public MovieDetailsComponent getMovieDetailsComponent() {
// return movieDetailsComponent;
// }
// }
//
// Path: app/src/main/java/com/tobi/movies/misc/AbstractObserver.java
// public abstract class AbstractObserver<T> implements Observer<T> {
// @Override
// public void onCompleted() {
// //no-op
// }
//
// @Override
// public void onError(Throwable e) {
// //no-op
// }
//
// @Override
// public void onNext(T t) {
// //no-op
// }
// }
// Path: app/src/main/java/com/tobi/movies/popularstream/PopularMoviesActivity.java
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import com.tobi.movies.ImageLoader;
import com.tobi.movies.MovieApplication;
import com.tobi.movies.R;
import com.tobi.movies.backend.Backend;
import com.tobi.movies.misc.AbstractObserver;
import javax.inject.Inject;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
package com.tobi.movies.popularstream;
public class PopularMoviesActivity extends AppCompatActivity {
private static final String TAG = PopularMoviesActivity.class.getSimpleName();
private static final int POSTER_COL_COUNT = 3;
@BindView(R.id.popularMovies_recycler)
RecyclerView popularMoviesRecycler;
@Inject
Backend backend;
@Inject
ImageLoader imageLoader;
@Inject
PopularStreamRepository streamRepository;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_popular_movies);
ButterKnife.bind(this); | final MovieApplication movieApplication = (MovieApplication) getApplicationContext(); |
tobiasheine/Movies | app/src/main/java/com/tobi/movies/popularstream/PopularMoviesActivity.java | // Path: app/src/main/java/com/tobi/movies/ImageLoader.java
// public class ImageLoader {
//
// public void loadWebImageInto(Uri imageUrl, ImageView imageView) {
// Glide
// .with(imageView.getContext())
// .load(imageUrl)
// .crossFade()
// .into(imageView);
// }
// }
//
// Path: app/src/main/java/com/tobi/movies/MovieApplication.java
// public class MovieApplication extends Application {
//
// private PopularMoviesComponent popularMoviesComponent;
// private MovieDetailsComponent movieDetailsComponent;
//
// @Override
// public void onCreate() {
// super.onCreate();
// ApplicationComponent applicationComponent = applicationComponent();
// popularMoviesComponent = popularMoviesComponent(applicationComponent);
// movieDetailsComponent = movieDetailsComponent(applicationComponent);
// }
//
// protected ApplicationComponent applicationComponent() {
// return DaggerApplicationComponent.create();
// }
//
// protected MovieDetailsComponent movieDetailsComponent(ApplicationComponent applicationComponent) {
// return DaggerMovieDetailsComponent.builder()
// .applicationComponent(applicationComponent)
// .build();
// }
//
// protected PopularMoviesComponent popularMoviesComponent(ApplicationComponent applicationComponent) {
// return DaggerPopularMoviesComponent.builder()
// .applicationComponent(applicationComponent)
// .build();
// }
//
// public PopularMoviesComponent getPopularMoviesComponent() {
// return popularMoviesComponent;
// }
//
// public MovieDetailsComponent getMovieDetailsComponent() {
// return movieDetailsComponent;
// }
// }
//
// Path: app/src/main/java/com/tobi/movies/misc/AbstractObserver.java
// public abstract class AbstractObserver<T> implements Observer<T> {
// @Override
// public void onCompleted() {
// //no-op
// }
//
// @Override
// public void onError(Throwable e) {
// //no-op
// }
//
// @Override
// public void onNext(T t) {
// //no-op
// }
// }
| import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import com.tobi.movies.ImageLoader;
import com.tobi.movies.MovieApplication;
import com.tobi.movies.R;
import com.tobi.movies.backend.Backend;
import com.tobi.movies.misc.AbstractObserver;
import javax.inject.Inject;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife; | package com.tobi.movies.popularstream;
public class PopularMoviesActivity extends AppCompatActivity {
private static final String TAG = PopularMoviesActivity.class.getSimpleName();
private static final int POSTER_COL_COUNT = 3;
@BindView(R.id.popularMovies_recycler)
RecyclerView popularMoviesRecycler;
@Inject
Backend backend;
@Inject
ImageLoader imageLoader;
@Inject
PopularStreamRepository streamRepository;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_popular_movies);
ButterKnife.bind(this);
final MovieApplication movieApplication = (MovieApplication) getApplicationContext();
movieApplication.getPopularMoviesComponent().inject(this);
popularMoviesRecycler.setLayoutManager(new GridLayoutManager(this, POSTER_COL_COUNT));
popularMoviesRecycler.setHasFixedSize(true);
final Navigator navigator = new Navigator(this);
| // Path: app/src/main/java/com/tobi/movies/ImageLoader.java
// public class ImageLoader {
//
// public void loadWebImageInto(Uri imageUrl, ImageView imageView) {
// Glide
// .with(imageView.getContext())
// .load(imageUrl)
// .crossFade()
// .into(imageView);
// }
// }
//
// Path: app/src/main/java/com/tobi/movies/MovieApplication.java
// public class MovieApplication extends Application {
//
// private PopularMoviesComponent popularMoviesComponent;
// private MovieDetailsComponent movieDetailsComponent;
//
// @Override
// public void onCreate() {
// super.onCreate();
// ApplicationComponent applicationComponent = applicationComponent();
// popularMoviesComponent = popularMoviesComponent(applicationComponent);
// movieDetailsComponent = movieDetailsComponent(applicationComponent);
// }
//
// protected ApplicationComponent applicationComponent() {
// return DaggerApplicationComponent.create();
// }
//
// protected MovieDetailsComponent movieDetailsComponent(ApplicationComponent applicationComponent) {
// return DaggerMovieDetailsComponent.builder()
// .applicationComponent(applicationComponent)
// .build();
// }
//
// protected PopularMoviesComponent popularMoviesComponent(ApplicationComponent applicationComponent) {
// return DaggerPopularMoviesComponent.builder()
// .applicationComponent(applicationComponent)
// .build();
// }
//
// public PopularMoviesComponent getPopularMoviesComponent() {
// return popularMoviesComponent;
// }
//
// public MovieDetailsComponent getMovieDetailsComponent() {
// return movieDetailsComponent;
// }
// }
//
// Path: app/src/main/java/com/tobi/movies/misc/AbstractObserver.java
// public abstract class AbstractObserver<T> implements Observer<T> {
// @Override
// public void onCompleted() {
// //no-op
// }
//
// @Override
// public void onError(Throwable e) {
// //no-op
// }
//
// @Override
// public void onNext(T t) {
// //no-op
// }
// }
// Path: app/src/main/java/com/tobi/movies/popularstream/PopularMoviesActivity.java
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import com.tobi.movies.ImageLoader;
import com.tobi.movies.MovieApplication;
import com.tobi.movies.R;
import com.tobi.movies.backend.Backend;
import com.tobi.movies.misc.AbstractObserver;
import javax.inject.Inject;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
package com.tobi.movies.popularstream;
public class PopularMoviesActivity extends AppCompatActivity {
private static final String TAG = PopularMoviesActivity.class.getSimpleName();
private static final int POSTER_COL_COUNT = 3;
@BindView(R.id.popularMovies_recycler)
RecyclerView popularMoviesRecycler;
@Inject
Backend backend;
@Inject
ImageLoader imageLoader;
@Inject
PopularStreamRepository streamRepository;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_popular_movies);
ButterKnife.bind(this);
final MovieApplication movieApplication = (MovieApplication) getApplicationContext();
movieApplication.getPopularMoviesComponent().inject(this);
popularMoviesRecycler.setLayoutManager(new GridLayoutManager(this, POSTER_COL_COUNT));
popularMoviesRecycler.setHasFixedSize(true);
final Navigator navigator = new Navigator(this);
| streamRepository.getPopularPosters().subscribe(new AbstractObserver<List<MoviePoster>>() { |
tobiasheine/Movies | base/src/main/java/com/tobi/movies/posterdetails/MovieDetailsRepository.java | // Path: base/src/main/java/com/tobi/movies/Converter.java
// public interface Converter<T, R> {
//
// R convert(T input);
// }
| import com.tobi.movies.Converter;
import rx.Observable;
import rx.functions.Func1; | package com.tobi.movies.posterdetails;
public class MovieDetailsRepository {
private final MovieDetailsApiDatasource apiDatasource; | // Path: base/src/main/java/com/tobi/movies/Converter.java
// public interface Converter<T, R> {
//
// R convert(T input);
// }
// Path: base/src/main/java/com/tobi/movies/posterdetails/MovieDetailsRepository.java
import com.tobi.movies.Converter;
import rx.Observable;
import rx.functions.Func1;
package com.tobi.movies.posterdetails;
public class MovieDetailsRepository {
private final MovieDetailsApiDatasource apiDatasource; | private final Converter<ApiMovieDetails, MovieDetails> converter; |
tobiasheine/Movies | app/src/androidTest/java/com/tobi/movies/posterdetails/TestDetailsApiModule.java | // Path: base/src/main/java/com/tobi/movies/Converter.java
// public interface Converter<T, R> {
//
// R convert(T input);
// }
| import com.tobi.movies.Converter;
import com.tobi.movies.backend.Backend;
import dagger.Module;
import dagger.Provides; | package com.tobi.movies.posterdetails;
@Module()
class TestDetailsApiModule {
@Provides
MovieDetailsApiDatasource provideDetailsApiSource(Backend backend) {
return new MovieDetailsApiDatasource(backend);
}
@Provides
MovieDetailsRepository providesDetailsRepository(MovieDetailsApiDatasource apiDatasource, | // Path: base/src/main/java/com/tobi/movies/Converter.java
// public interface Converter<T, R> {
//
// R convert(T input);
// }
// Path: app/src/androidTest/java/com/tobi/movies/posterdetails/TestDetailsApiModule.java
import com.tobi.movies.Converter;
import com.tobi.movies.backend.Backend;
import dagger.Module;
import dagger.Provides;
package com.tobi.movies.posterdetails;
@Module()
class TestDetailsApiModule {
@Provides
MovieDetailsApiDatasource provideDetailsApiSource(Backend backend) {
return new MovieDetailsApiDatasource(backend);
}
@Provides
MovieDetailsRepository providesDetailsRepository(MovieDetailsApiDatasource apiDatasource, | Converter<ApiMovieDetails, MovieDetails> converter) { |
tobiasheine/Movies | app/src/main/java/com/tobi/movies/popularstream/Navigator.java | // Path: app/src/main/java/com/tobi/movies/posterdetails/MovieDetailsActivity.java
// public class MovieDetailsActivity extends Activity implements MovieDetailsMVP.View {
//
// private static final String EXTRA_MOVIE_ID = "extra_movie_id";
// private MovieDetailsUseCase movieDetailsUseCase;
//
// public static Intent createIntentFor(long movieId, Context activity) {
// Intent intent = new Intent(activity, MovieDetailsActivity.class);
// intent.putExtra(EXTRA_MOVIE_ID, movieId);
//
// return intent;
// }
//
// @BindView(R.id.movieTitle)
// TextView movieTitle;
//
// @BindView(R.id.posterImage)
// ImageView moviePoster;
//
// @BindView(R.id.movieOverview)
// TextView movieOverview;
//
// @Inject
// ImageLoader imageLoader;
//
// @Inject
// Map<Threading, Scheduler> schedulerMap;
//
// @Inject
// MovieDetailsRepository movieDetailsRepository;
//
// private MovieDetailsPresenter presenter;
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_movie_details);
// ButterKnife.bind(this);
// MovieApplication application = (MovieApplication) getApplication();
// application.getMovieDetailsComponent().inject(this);
//
// movieDetailsUseCase = provideMovieDetailsUseCase();
// presenter = new MovieDetailsPresenter(movieDetailsUseCase);
// }
//
// private MovieDetailsUseCase provideMovieDetailsUseCase() {
// Object lastNonConfigurationInstance = getLastNonConfigurationInstance();
// if (lastNonConfigurationInstance == null) {
// return new MovieDetailsUseCase(movieDetailsRepository, schedulerMap.get(Threading.SUBSCRIBER), schedulerMap.get(Threading.OBSERVER));
// }
// return ((MovieDetailsUseCase) lastNonConfigurationInstance);
// }
//
// @Override
// public Object onRetainNonConfigurationInstance() {
// return movieDetailsUseCase;
// }
//
// @Override
// public void display(MovieDetails movieDetails) {
// movieTitle.setText(movieDetails.getOriginalTitle());
// movieOverview.setText(movieDetails.getOverview());
// imageLoader.loadWebImageInto(Uri.parse(movieDetails.getPosterPath()), moviePoster);
// }
//
// @Override
// protected void onStart() {
// super.onStart();
// presenter.startPresenting(this, getMovieId());
// }
//
// @Override
// protected void onStop() {
// presenter.stopPresenting();
// super.onStop();
// }
//
// @Override
// public void showError() {
// Toast.makeText(this, "Cannot load movie details for id:" + getMovieId(), Toast.LENGTH_LONG).show();
// }
//
// private long getMovieId() {
// return getIntent().getLongExtra(EXTRA_MOVIE_ID, -1L);
// }
// }
| import android.app.Activity;
import android.content.Intent;
import com.tobi.movies.posterdetails.MovieDetailsActivity; | package com.tobi.movies.popularstream;
class Navigator {
private final Activity activity;
Navigator(Activity activity) {
this.activity = activity;
}
void toMovieDetails(long movieId) { | // Path: app/src/main/java/com/tobi/movies/posterdetails/MovieDetailsActivity.java
// public class MovieDetailsActivity extends Activity implements MovieDetailsMVP.View {
//
// private static final String EXTRA_MOVIE_ID = "extra_movie_id";
// private MovieDetailsUseCase movieDetailsUseCase;
//
// public static Intent createIntentFor(long movieId, Context activity) {
// Intent intent = new Intent(activity, MovieDetailsActivity.class);
// intent.putExtra(EXTRA_MOVIE_ID, movieId);
//
// return intent;
// }
//
// @BindView(R.id.movieTitle)
// TextView movieTitle;
//
// @BindView(R.id.posterImage)
// ImageView moviePoster;
//
// @BindView(R.id.movieOverview)
// TextView movieOverview;
//
// @Inject
// ImageLoader imageLoader;
//
// @Inject
// Map<Threading, Scheduler> schedulerMap;
//
// @Inject
// MovieDetailsRepository movieDetailsRepository;
//
// private MovieDetailsPresenter presenter;
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_movie_details);
// ButterKnife.bind(this);
// MovieApplication application = (MovieApplication) getApplication();
// application.getMovieDetailsComponent().inject(this);
//
// movieDetailsUseCase = provideMovieDetailsUseCase();
// presenter = new MovieDetailsPresenter(movieDetailsUseCase);
// }
//
// private MovieDetailsUseCase provideMovieDetailsUseCase() {
// Object lastNonConfigurationInstance = getLastNonConfigurationInstance();
// if (lastNonConfigurationInstance == null) {
// return new MovieDetailsUseCase(movieDetailsRepository, schedulerMap.get(Threading.SUBSCRIBER), schedulerMap.get(Threading.OBSERVER));
// }
// return ((MovieDetailsUseCase) lastNonConfigurationInstance);
// }
//
// @Override
// public Object onRetainNonConfigurationInstance() {
// return movieDetailsUseCase;
// }
//
// @Override
// public void display(MovieDetails movieDetails) {
// movieTitle.setText(movieDetails.getOriginalTitle());
// movieOverview.setText(movieDetails.getOverview());
// imageLoader.loadWebImageInto(Uri.parse(movieDetails.getPosterPath()), moviePoster);
// }
//
// @Override
// protected void onStart() {
// super.onStart();
// presenter.startPresenting(this, getMovieId());
// }
//
// @Override
// protected void onStop() {
// presenter.stopPresenting();
// super.onStop();
// }
//
// @Override
// public void showError() {
// Toast.makeText(this, "Cannot load movie details for id:" + getMovieId(), Toast.LENGTH_LONG).show();
// }
//
// private long getMovieId() {
// return getIntent().getLongExtra(EXTRA_MOVIE_ID, -1L);
// }
// }
// Path: app/src/main/java/com/tobi/movies/popularstream/Navigator.java
import android.app.Activity;
import android.content.Intent;
import com.tobi.movies.posterdetails.MovieDetailsActivity;
package com.tobi.movies.popularstream;
class Navigator {
private final Activity activity;
Navigator(Activity activity) {
this.activity = activity;
}
void toMovieDetails(long movieId) { | Intent intent = MovieDetailsActivity.createIntentFor(movieId, activity); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.