cameronlee314 commented on a change in pull request #1038: SAMZA-2196: [Scala 
cleanup] Convert SerializerConfig to Java 
URL: https://github.com/apache/samza/pull/1038#discussion_r290510192
 
 

 ##########
 File path: 
samza-core/src/main/java/org/apache/samza/config/SerializerConfig.java
 ##########
 @@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.samza.config;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import org.apache.samza.SamzaException;
+import org.apache.samza.serializers.ByteBufferSerdeFactory;
+import org.apache.samza.serializers.ByteSerdeFactory;
+import org.apache.samza.serializers.DoubleSerdeFactory;
+import org.apache.samza.serializers.IntegerSerdeFactory;
+import org.apache.samza.serializers.JsonSerdeFactory;
+import org.apache.samza.serializers.LongSerdeFactory;
+import org.apache.samza.serializers.SerializableSerdeFactory;
+import org.apache.samza.serializers.StringSerdeFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Provides helpers for accessing configs related to serialization and 
deserialization.
+ */
+public class SerializerConfig extends MapConfig {
+  public static final Logger LOGGER = 
LoggerFactory.getLogger(SerializerConfig.class);
+
+  public static final String SERIALIZER_PREFIX = "serializers.registry.%s";
+  public static final String SERDE_FACTORY_CLASS = SERIALIZER_PREFIX + 
".class";
+  public static final String SERIALIZED_INSTANCE_SUFFIX = 
".samza.serialized.instance";
+  public static final String SERDE_SERIALIZED_INSTANCE = SERIALIZER_PREFIX + 
SERIALIZED_INSTANCE_SUFFIX;
+
+  public SerializerConfig(Config config) {
+    super(config);
+  }
+
+  /**
+   * Returns the pre-defined serde factory class name for the provided serde 
name. If no pre-defined factory exists,
+   * throws an exception.
+   */
+  public static String getSerdeFactoryName(String serdeName) {
+    String serdeFactoryName = doGetSerdeFactoryName(serdeName);
 
 Review comment:
   I was just migrating existing method names. `getSerdeClass` does get the 
non-default factory names. I'll try to think of some better method names.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to