@Documented @Retention(value=RUNTIME) @Target(value=METHOD) public static @interface CssResource.Import
CssResource.ImportedWithPrefix
value.
This is an example of creating a descendant selector with two unrelated types:
@ImportedWithPrefix("some-prefix") interface ToImport extends CssResource { String widget(); } @ImportedWithPrefix("other-import") interface OtherImport extends CssResource { String widget(); } interface Resources extends ClientBundle { @Import(value = {ToImport.class, OtherImport.class}) @Source("my.css") CssResource usesImports(); } my.css: // Now I can refer to these classes defined elsewhere with no // fear of name collisions .some-prefix-widget .other-import-widget {...}If the imported CssResource type is lacking an
CssResource.ImportedWithPrefix
annotation, the simple name of the type will be used instead. In the above
example, without the annotation on ToImport
, the class
selector would have been .ToImport-widget
. Notice also that
both interfaces defined a method called widget()
, which would
prevent meaningful composition of the original interfaces.
It is an error to import multiple classes with the same prefix into one CssResource.
Modifier and Type | Required Element and Description |
---|---|
Class<? extends CssResource>[] |
value |
public abstract Class<? extends CssResource>[] value
Copyright © 2018. All rights reserved.