private MethodSpec . Builder buildSkeletonType ( Set < String > dateSkeletons , Set < String > timeSkeletons ) { MethodSpec . Builder method = MethodSpec . methodBuilder ( "skeletonType" ) . addJavadoc ( "Indicates whether a given skeleton pattern is a DATE or TIME.\n" ) . addModifiers ( PUBLIC , STATIC ) . addParameter ( String . class , "skeleton" ) . returns ( SKELETON ) ; method . beginControlFlow ( "switch (skeleton)" ) ; for ( String skel : dateSkeletons ) { method . addCode ( "case $S:\n" , skel ) ; } method . addStatement ( " return $T.DATE" , SKELETON ) ; for ( String skel : timeSkeletons ) { method . addCode ( "case $S:\n" , skel ) ; } method . addStatement ( " return $T.TIME" , SKELETON ) ; method . addCode ( "default:\n" ) ; method . addStatement ( " return null" ) ; method . endControlFlow ( ) ; return method ; }
Constructs a method to indicate if the skeleton is a DATE or TIME or null if unsupported .