Last active
December 28, 2015 15:39
-
-
Save kyberorg/7522959 to your computer and use it in GitHub Desktop.
Generics and interfaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public String talk(Result<String> result) { | |
PingReply pingReply = new PingReply(); | |
pingReply.setReply((String) result.getResult()); | |
return Parser.toJson(pingReply, PingReply.class); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.virtalab.jsonio.api; | |
/** | |
* Result container | |
*/ | |
public class Result<T> { | |
private T result; | |
public T getResult(){ | |
return result; | |
} | |
public void setResult(T result){ | |
this.result = result; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.virtalab.jsonio.api; | |
import net.virtalab.jsonio.exceptions.DataValidationException; | |
/** | |
* Class description. | |
*/ | |
public interface SubApp { | |
public Input read(String incomingJson) throws DataValidationException; | |
public Result execute(Input<?> input); | |
public String talk(Result<? extends Object> result); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment