Java Code Examples for javax.lang.model.element.Modifier#STATIC
The following examples show how to use
javax.lang.model.element.Modifier#STATIC .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Initializer.java From vavr-jackson with Apache License 2.0 | 6 votes |
public static void initMapper(TypeSpec.Builder builder, String name, VavrModule.Settings settings) { Modifier[] mods = new Modifier[] { Modifier.PRIVATE, Modifier.STATIC, Modifier.FINAL }; if (settings != null) { builder.addField(FieldSpec.builder(ClassName.get(VavrModule.Settings.class), name + "_SETTINGS", mods) .initializer("new $T()\n .useOptionInPlainFormat($L).deserializeNullAsEmptyCollection($L)", ClassName.get(VavrModule.Settings.class), settings.useOptionInPlainFormat(), settings.deserializeNullAsEmptyCollection()) .build()); builder.addField(FieldSpec.builder(ClassName.get(VavrModule.class), name + "_MODULE", mods) .initializer("new $T($L)", ClassName.get(VavrModule.class), name + "_SETTINGS") .build()); } else { builder.addField(FieldSpec.builder(ClassName.get(VavrModule.class), name + "_MODULE", mods) .initializer("new $T()", ClassName.get(VavrModule.class)) .build()); } builder.addField(FieldSpec.builder(ClassName.get(ObjectMapper.class), name, mods) .initializer("new $T().registerModule($L)", ClassName.get(ObjectMapper.class), name + "_MODULE") .build()); }
Example 2
Source File: ModifierOrderer.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
/** * Returns the {@link Modifier} for the given token kind, or {@code * null}. */ private static Modifier getModifier(TokenKind kind) { if (kind == null) { return null; } switch (kind) { case PUBLIC: return Modifier.PUBLIC; case PROTECTED: return Modifier.PROTECTED; case PRIVATE: return Modifier.PRIVATE; case ABSTRACT: return Modifier.ABSTRACT; case STATIC: return Modifier.STATIC; // TODO: 22-Jul-17 unsupported lambdas expr // case DEFAULT: // return Modifier.DEFAULT; case FINAL: return Modifier.FINAL; case TRANSIENT: return Modifier.TRANSIENT; case VOLATILE: return Modifier.VOLATILE; case SYNCHRONIZED: return Modifier.SYNCHRONIZED; case NATIVE: return Modifier.NATIVE; case STRICTFP: return Modifier.STRICTFP; default: return null; } }
Example 3
Source File: PsiModifierExtractor.java From litho with Apache License 2.0 | 5 votes |
private static Modifier psiModifierToModifier(PsiElement psiModifier) { switch (psiModifier.getText()) { case PsiModifier.ABSTRACT: return Modifier.ABSTRACT; case PsiModifier.FINAL: return Modifier.FINAL; case PsiModifier.NATIVE: return Modifier.NATIVE; case PsiModifier.PRIVATE: return Modifier.PRIVATE; case PsiModifier.PROTECTED: return Modifier.PROTECTED; case PsiModifier.PUBLIC: return Modifier.PUBLIC; case PsiModifier.STATIC: return Modifier.STATIC; case PsiModifier.STRICTFP: return Modifier.STRICTFP; case PsiModifier.SYNCHRONIZED: return Modifier.SYNCHRONIZED; case PsiModifier.TRANSIENT: return Modifier.TRANSIENT; case PsiModifier.VOLATILE: return Modifier.VOLATILE; default: // TODO better error message, ideally w/ line number throw new ComponentsProcessingException( "Unexpected Modifier, modifier is: " + psiModifier.getText()); } }
Example 4
Source File: ModifierOrderer.java From javaide with GNU General Public License v3.0 | 5 votes |
/** * Returns the {@link Modifier} for the given token kind, or {@code * null}. */ private static Modifier getModifier(TokenKind kind) { if (kind == null) { return null; } switch (kind) { case PUBLIC: return Modifier.PUBLIC; case PROTECTED: return Modifier.PROTECTED; case PRIVATE: return Modifier.PRIVATE; case ABSTRACT: return Modifier.ABSTRACT; case STATIC: return Modifier.STATIC; // TODO: 22-Jul-17 unsupported lambdas expr // case DEFAULT: // return Modifier.DEFAULT; case FINAL: return Modifier.FINAL; case TRANSIENT: return Modifier.TRANSIENT; case VOLATILE: return Modifier.VOLATILE; case SYNCHRONIZED: return Modifier.SYNCHRONIZED; case NATIVE: return Modifier.NATIVE; case STRICTFP: return Modifier.STRICTFP; default: return null; } }
Example 5
Source File: PropertyUtility.java From kripton with Apache License 2.0 | 5 votes |
/** * Modifier is acceptable. * * @param item * the item * @return true, if successful */ static boolean modifierIsAcceptable(Element item) { // kotlin define properties as final Object[] values = { Modifier.NATIVE, Modifier.STATIC, /* Modifier.FINAL, */ Modifier.ABSTRACT }; for (Object i : values) { if (item.getModifiers().contains(i)) return false; } return true; }
Example 6
Source File: ModifierOrderer.java From google-java-format with Apache License 2.0 | 5 votes |
/** * Returns the {@link javax.lang.model.element.Modifier} for the given token kind, or {@code * null}. */ private static Modifier getModifier(TokenKind kind) { if (kind == null) { return null; } switch (kind) { case PUBLIC: return Modifier.PUBLIC; case PROTECTED: return Modifier.PROTECTED; case PRIVATE: return Modifier.PRIVATE; case ABSTRACT: return Modifier.ABSTRACT; case STATIC: return Modifier.STATIC; case DEFAULT: return Modifier.DEFAULT; case FINAL: return Modifier.FINAL; case TRANSIENT: return Modifier.TRANSIENT; case VOLATILE: return Modifier.VOLATILE; case SYNCHRONIZED: return Modifier.SYNCHRONIZED; case NATIVE: return Modifier.NATIVE; case STRICTFP: return Modifier.STRICTFP; default: return null; } }
Example 7
Source File: NodeFactoryGenerator.java From caffeine with Apache License 2.0 | 5 votes |
private void addConstants() { Modifier[] modifiers = {Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL}; nodeFactory.addField(FieldSpec.builder(Object.class, RETIRED_STRONG_KEY, modifiers) .initializer("new Object()") .build()); nodeFactory.addField(FieldSpec.builder(Object.class, DEAD_STRONG_KEY, modifiers) .initializer("new Object()") .build()); nodeFactory.addField(FieldSpec.builder(rawReferenceKeyType, RETIRED_WEAK_KEY, modifiers) .initializer("new $T(null, null)", rawReferenceKeyType) .build()); nodeFactory.addField(FieldSpec.builder(rawReferenceKeyType, DEAD_WEAK_KEY, modifiers) .initializer("new $T(null, null)", rawReferenceKeyType) .build()); }
Example 8
Source File: NoLongerStatic.java From revapi with Apache License 2.0 | 4 votes |
public NoLongerStatic() { super(false, Code.METHOD_NO_LONGER_STATIC, Modifier.STATIC); }
Example 9
Source File: NowStatic.java From revapi with Apache License 2.0 | 4 votes |
public NowStatic() { super(true, Code.METHOD_NOW_STATIC, Modifier.STATIC); }
Example 10
Source File: NoLongerStatic.java From revapi with Apache License 2.0 | 4 votes |
public NoLongerStatic() { super(false, Code.FIELD_NO_LONGER_STATIC, Modifier.STATIC); }
Example 11
Source File: NowStatic.java From revapi with Apache License 2.0 | 4 votes |
public NowStatic() { super(true, Code.FIELD_NOW_STATIC, Modifier.STATIC); }