public static Matcher enumDefinitionOfType ( final String type ) { return new Matcher ( ) { @ Override public boolean matches ( Node node , NodeMetadata metadata ) { JSType providedJsType = getJsType ( metadata , type ) ; if ( providedJsType == null ) { return false ; } providedJsType = providedJsType . restrictByNotNullOrUndefined ( ) ; JSType jsType = node . getJSType ( ) ; return jsType != null && jsType . isEnumType ( ) && providedJsType . isEquivalentTo ( jsType . toMaybeEnumType ( ) . getElementsType ( ) . getPrimitiveType ( ) ) ; } } ; }
Returns a Matcher that matches definitions of an enum of the given type .