2323import  java .util .concurrent .TimeUnit ;
2424
2525/** 
26-  * Optional settings that can be associated with {@link Token}s. 
26+  * Optional encoding  settings that can be associated with {@link Token}s. 
2727 */ 
2828public  class  Encoding 
2929{
@@ -52,6 +52,7 @@ public static enum Presence
5252 private  final  String  characterEncoding ;
5353 private  final  String  epoch ;
5454 private  final  TimeUnit  timeUnit ;
55+  private  final  String  semanticType ;
5556
5657 public  Encoding ()
5758 {
@@ -65,6 +66,7 @@ public Encoding()
6566 characterEncoding  = "" ;
6667 epoch  = null ;
6768 timeUnit  = null ;
69+  semanticType  = null ;
6870 }
6971
7072 public  Encoding (final  PrimitiveType  primitiveType ,
@@ -76,7 +78,8 @@ public Encoding(final PrimitiveType primitiveType,
7678 final  PrimitiveValue  constVal ,
7779 final  String  characterEncoding ,
7880 final  String  epoch ,
79-  final  TimeUnit  timeUnit )
81+  final  TimeUnit  timeUnit ,
82+  final  String  semanticType )
8083 {
8184 Verify .notNull (presence , "presence" );
8285 Verify .notNull (byteOrder , "byteOrder" );
@@ -91,6 +94,7 @@ public Encoding(final PrimitiveType primitiveType,
9194 this .characterEncoding  = characterEncoding ;
9295 this .epoch  = epoch ;
9396 this .timeUnit  = timeUnit ;
97+  this .semanticType  = semanticType ;
9498 }
9599
96100 /** 
@@ -239,6 +243,16 @@ public TimeUnit timeUnit()
239243 return  timeUnit ;
240244 }
241245
246+  /** 
247+  * The semantic type of an encoding which can have relevance to the application layer. 
248+  * 
249+  * @return semantic type of an encoding which can have relevance to the application layer. 
250+  */ 
251+  public  String  semanticType ()
252+  {
253+  return  semanticType ;
254+  }
255+ 
242256 public  String  toString ()
243257 {
244258 return  "Encoding{"  +
@@ -252,6 +266,7 @@ public String toString()
252266 ", characterEncoding='"  + characterEncoding  + '\''  +
253267 ", epoch='"  + epoch  + '\''  +
254268 ", timeUnit="  + timeUnit  +
269+  ", semanticType='"  + semanticType  + '\''  +
255270 '}' ;
256271 }
257272
@@ -270,6 +285,7 @@ public static class Builder
270285 private  String  characterEncoding  = "" ;
271286 private  String  epoch  = null ;
272287 private  TimeUnit  timeUnit  = null ;
288+  private  String  semanticType  = null ;
273289
274290 public  Builder  primitiveType (final  PrimitiveType  primitiveType )
275291 {
@@ -331,9 +347,25 @@ public Builder timeUnit(final TimeUnit timeUnit)
331347 return  this ;
332348 }
333349
350+  public  Builder  semanticType (final  String  semanticType )
351+  {
352+  this .semanticType  = semanticType ;
353+  return  this ;
354+  }
355+ 
334356 public  Encoding  build ()
335357 {
336-  return  new  Encoding (primitiveType , presence , byteOrder , minVal , maxVal , nullVal , constVal , characterEncoding , epoch , timeUnit );
358+  return  new  Encoding (primitiveType ,
359+  presence ,
360+  byteOrder ,
361+  minVal ,
362+  maxVal ,
363+  nullVal ,
364+  constVal ,
365+  characterEncoding ,
366+  epoch ,
367+  timeUnit ,
368+  semanticType );
337369 }
338370 }
339371}
0 commit comments