1+ /**
2+ * Copyright 2016 InscopeMetrics, Inc
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
116package com .arpnetworking .configuration .jackson .akka ;
217
318import akka .actor .Props ;
419import com .arpnetworking .commons .builder .Builder ;
520import com .fasterxml .jackson .core .JsonParser ;
6- import com .fasterxml .jackson .core .JsonProcessingException ;
721import com .fasterxml .jackson .core .TreeNode ;
822import com .fasterxml .jackson .databind .DeserializationContext ;
923import com .fasterxml .jackson .databind .JsonDeserializer ;
1428import java .io .IOException ;
1529
1630/**
17- * Deserializer that will create an ActorBuilder for the given actor, then create the Actor from Guice
31+ * Deserializer that will create an ActorBuilder for the given actor, then create a Props from Guice.
32+ *
1833 * @author Brandon Arp (brandon dot arp at inscopemetrics dot com)
1934 */
2035public class ActorBuilderDeserializer extends JsonDeserializer <Props > {
@@ -28,15 +43,15 @@ public ActorBuilderDeserializer(final ObjectMapper mapper) {
2843 }
2944
3045 @ Override
31- public Props deserialize (final JsonParser p , final DeserializationContext ctxt ) throws IOException , JsonProcessingException {
46+ public Props deserialize (final JsonParser p , final DeserializationContext ctxt ) throws IOException {
3247 final TreeNode treeNode = p .readValueAsTree ();
3348 final String type = ((TextNode ) treeNode .get ("type" )).textValue ();
3449 try {
3550 final Class <?> clazz = Class .forName (type );
3651 final Class <? extends Builder <? extends Props >> builder = getBuilderForClass (clazz );
3752 final Builder <? extends Props > value = _mapper .readValue (treeNode .toString (), builder );
3853 return value .build ();
39- } catch (ClassNotFoundException e ) {
54+ } catch (final ClassNotFoundException e ) {
4055 throw new JsonMappingException (p , String .format ("Unable to find class %s referenced by Props type" , type ));
4156 }
4257 }
0 commit comments