flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "frank wang (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (FLINK-12031) the registerFactory method of TypeExtractor Should not be private
Date Wed, 27 Mar 2019 12:58:00 GMT

     [ https://issues.apache.org/jira/browse/FLINK-12031?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

frank wang updated FLINK-12031:
-------------------------------
    Description: 
[https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java]
{code:java}
/**
 * Registers a type information factory globally for a certain type. Every following type
extraction
 * operation will use the provided factory for this type. The factory will have highest precedence
 * for this type. In a hierarchy of types the registered factory has higher precedence than
annotations
 * at the same level but lower precedence than factories defined down the hierarchy.
 *
 * @param t type for which a new factory is registered
 * @param factory type information factory that will produce {@link TypeInformation}
 */
private static void registerFactory(Type t, Class<? extends TypeInfoFactory> factory)
{
   Preconditions.checkNotNull(t, "Type parameter must not be null.");
   Preconditions.checkNotNull(factory, "Factory parameter must not be null.");

   if (!TypeInfoFactory.class.isAssignableFrom(factory)) {
      throw new IllegalArgumentException("Class is not a TypeInfoFactory.");
   }
   if (registeredTypeInfoFactories.containsKey(t)) {
      throw new InvalidTypesException("A TypeInfoFactory for type '" + t + "' is already registered.");
   }
   registeredTypeInfoFactories.put(t, factory);
}
{code}
 

  was:
https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java

/**
 * Registers a type information factory globally for a certain type. Every following type
extraction
 * operation will use the provided factory for this type. The factory will have highest precedence
 * for this type. In a hierarchy of types the registered factory has higher precedence than
annotations
 * at the same level but lower precedence than factories defined down the hierarchy.
 *
 * @param t type for which a new factory is registered
 * @param factory type information factory that will produce \{@link TypeInformation}
 */
private static void registerFactory(Type t, Class<? extends TypeInfoFactory> factory)
{
 Preconditions.checkNotNull(t, "Type parameter must not be null.");
 Preconditions.checkNotNull(factory, "Factory parameter must not be null.");

 if (!TypeInfoFactory.class.isAssignableFrom(factory)) {
 throw new IllegalArgumentException("Class is not a TypeInfoFactory.");
 }
 if (registeredTypeInfoFactories.containsKey(t)) {
 throw new InvalidTypesException("A TypeInfoFactory for type '" + t + "' is already registered.");
 }
 registeredTypeInfoFactories.put(t, factory);
}


> the registerFactory method of TypeExtractor  Should not be private
> ------------------------------------------------------------------
>
>                 Key: FLINK-12031
>                 URL: https://issues.apache.org/jira/browse/FLINK-12031
>             Project: Flink
>          Issue Type: Bug
>            Reporter: frank wang
>            Priority: Minor
>
> [https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java]
> {code:java}
> /**
>  * Registers a type information factory globally for a certain type. Every following
type extraction
>  * operation will use the provided factory for this type. The factory will have highest
precedence
>  * for this type. In a hierarchy of types the registered factory has higher precedence
than annotations
>  * at the same level but lower precedence than factories defined down the hierarchy.
>  *
>  * @param t type for which a new factory is registered
>  * @param factory type information factory that will produce {@link TypeInformation}
>  */
> private static void registerFactory(Type t, Class<? extends TypeInfoFactory> factory)
{
>    Preconditions.checkNotNull(t, "Type parameter must not be null.");
>    Preconditions.checkNotNull(factory, "Factory parameter must not be null.");
>    if (!TypeInfoFactory.class.isAssignableFrom(factory)) {
>       throw new IllegalArgumentException("Class is not a TypeInfoFactory.");
>    }
>    if (registeredTypeInfoFactories.containsKey(t)) {
>       throw new InvalidTypesException("A TypeInfoFactory for type '" + t + "' is already
registered.");
>    }
>    registeredTypeInfoFactories.put(t, factory);
> }
> {code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message