Created
April 15, 2011 21:53
-
-
Save pierre/922541 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SubscriberConfig { | |
@JsonValue | |
public String name; | |
@JsonValue | |
public String type; | |
@JsonMagicThisIsHowYouShouldResolveMyType | |
public Class getClassForJsonNode(HashMap<Object, Object> rawJson) { | |
return Class.forName(((String) rawJson).get("type") + "Config"); | |
} | |
} | |
public class AMQSubscriberConfig extends SubscriberConfig { | |
@JsonValue | |
public String host; | |
} | |
public class FileSubscriberConfig extends SubscriberConfig { | |
@JsonValue | |
public String fileName; | |
} | |
{ | |
"subscribers": [ | |
{ | |
"name": "AMQ" | |
"type": "com.ning.metrics.AMQSubscriber", // The actual class dealing with AMQ connection | |
"host": "127.0.0.1" | |
}, | |
{ | |
"name": "File" | |
"type": "com.ning.metrics.FileSubscriber", // The actual class dealing with File stuff | |
"fileName": "/tmp/bleh.dat" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment