public static String componentToTagName ( Element componentElement ) throws MissingComponentAnnotationException { Component componentAnnotation = componentElement . getAnnotation ( Component . class ) ; JsComponent jsComponentAnnotation = componentElement . getAnnotation ( JsComponent . class ) ; String annotationNameValue ; if ( componentAnnotation != null ) { annotationNameValue = componentAnnotation . name ( ) ; } else if ( jsComponentAnnotation != null ) { annotationNameValue = jsComponentAnnotation . value ( ) ; } else { throw new MissingComponentAnnotationException ( ) ; } if ( ! "" . equals ( annotationNameValue ) ) { return annotationNameValue ; } // Drop "Component" at the end of the class name String componentClassName = componentElement . getSimpleName ( ) . toString ( ) . replaceAll ( "Component$" , "" ) ; // Convert from CamelCase to kebab-case return CaseFormat . UPPER_CAMEL . to ( CaseFormat . LOWER_HYPHEN , componentClassName ) . toLowerCase ( ) ; }
Return the default name to register a component based on it s class name . The name of the tag is the name of the component converted to kebab - case . If the component class ends with Component this part is ignored .