To create a DataMask, the users should come through this API. It supports extension via additional DataMask.Provider implementations that are accessed through Java's ServiceLoader API.
| 115 | * that are accessed through Java's ServiceLoader API. |
| 116 | */ |
| 117 | class Factory { |
| 118 | |
| 119 | /** |
| 120 | * Build a new DataMask instance. |
| 121 | * @param mask the description of the data mask |
| 122 | * @param schema the type of the field |
| 123 | * @param overrides sub-columns where the mask is overridden |
| 124 | * @return a new DataMask |
| 125 | * @throws IllegalArgumentException if no such kind of data mask was found |
| 126 | * |
| 127 | * @see org.apache.orc.impl.mask.MaskProvider for the standard provider |
| 128 | */ |
| 129 | public static DataMask build(DataMaskDescription mask, |
| 130 | TypeDescription schema, |
| 131 | MaskOverrides overrides) { |
| 132 | for(Provider provider: ServiceLoader.load(Provider.class)) { |
| 133 | DataMask result = provider.build(mask, schema, overrides); |
| 134 | if (result != null) { |
| 135 | return result; |
| 136 | } |
| 137 | } |
| 138 | throw new IllegalArgumentException("Can't find data mask - " + mask); |
| 139 | } |
| 140 | } |
| 141 | } |
nothing calls this directly
no outgoing calls
no test coverage detected