List of usage examples for java.lang.reflect Modifier PRIVATE
int PRIVATE
To view the source code for java.lang.reflect Modifier PRIVATE.
Click Source Link
From source file:Main.java
public static void main(String... args) throws Exception { Class<?> c = Class.forName("java.lang.String"); Constructor[] allConstructors = c.getDeclaredConstructors(); for (Constructor ctor : allConstructors) { int searchMod = Modifier.PRIVATE; int mods = accessModifiers(ctor.getModifiers()); if (searchMod == mods) { System.out.println(ctor); }/*from ww w .j a v a 2 s . co m*/ } }
From source file:Main.java
private static int accessModifiers(int m) { return m & Modifier.PRIVATE; }
From source file:Main.java
private static int accessModifiers(int m) { return m & (Modifier.PUBLIC | Modifier.PRIVATE | Modifier.PROTECTED); }
From source file:Main.java
private static int modifierFromString(String s) { if ("public".equals(s)) return Modifier.PUBLIC; else if ("protected".equals(s)) return Modifier.PROTECTED; else if ("private".equals(s)) return Modifier.PRIVATE; else if ("package-private".equals(s)) return 0; else//from w w w . j a va 2s . c o m return -1; }
From source file:com.adaptc.mws.plugins.testing.transformations.LoggingTransformer.java
public static void addLogField(ClassNode classNode, String logName) { FieldNode logVariable = new FieldNode(LOG_PROPERTY, Modifier.STATIC | Modifier.PRIVATE, new ClassNode(Log.class), classNode, new MethodCallExpression(new ClassExpression(new ClassNode(LogFactory.class)), "getLog", new ArgumentListExpression(new ConstantExpression(logName)))); classNode.addField(logVariable);//from w w w . ja v a2 s. com }
From source file:com.hihframework.core.utils.ReflectUtil.java
public static final String[] getPrivateFieldsName(Object obj) { return getFieldsName(obj, Modifier.PRIVATE); }
From source file:org.jsonschema2pojo.integration.config.IncludeAccessorsIT.java
@Test public void beansIncludeGettersAndSettersByDefault() throws ClassNotFoundException, SecurityException, NoSuchMethodException, NoSuchFieldException { ClassLoader resultsClassLoader = schemaRule .generateAndCompile("/schema/properties/primitiveProperties.json", "com.example"); Class generatedType = resultsClassLoader.loadClass("com.example.PrimitiveProperties"); // throws NoSuchMethodException if method is not found generatedType.getDeclaredMethod("getA"); generatedType.getDeclaredMethod("setA", Integer.class); assertThat(generatedType.getDeclaredField("a").getModifiers(), is(Modifier.PRIVATE)); }
From source file:Spy.java
private static int modifierFromString(String s) { int m = 0x0;//from w w w . j a va 2s .c o m if ("public".equals(s)) m |= Modifier.PUBLIC; else if ("protected".equals(s)) m |= Modifier.PROTECTED; else if ("private".equals(s)) m |= Modifier.PRIVATE; else if ("static".equals(s)) m |= Modifier.STATIC; else if ("final".equals(s)) m |= Modifier.FINAL; else if ("transient".equals(s)) m |= Modifier.TRANSIENT; else if ("volatile".equals(s)) m |= Modifier.VOLATILE; return m; }
From source file:mitm.djigzo.web.services.security.SpringSecurityWorker.java
private void transformMethod(ClassTransformation transformation, TransformMethodSignature method) { /* /*from w w w . j a v a 2 s .c om*/ * inject Security checker */ final String interField = transformation.addInjectedField(SecurityChecker.class, "_$checker", securityChecker); /* * Interceptor status token */ final String statusToken = transformation.addField(Modifier.PRIVATE, "org.springframework.security.intercept.InterceptorStatusToken", "_$token"); /* * Attribute definition */ final Secured annotation = transformation.getMethodAnnotation(method, Secured.class); final String configField = createConfigAttributeDefinitionField(transformation, annotation); /* * Prefix and extend method */ transformation.prefixMethod(method, statusToken + " = " + interField + ".checkBefore(" + configField + ");"); transformation.extendExistingMethod(method, interField + ".checkAfter(" + statusToken + ", null);"); }
From source file:pl.burningice.plugins.image.ast.FileImageContainerTransformation.java
private void transform(ClassNode node, String fieldName) { log("start transforming: " + node + " with field " + fieldName); // implements interface node.addInterface(new ClassNode(FileImageContainer.class)); // imageExtension field FieldNode imageExtension = new FieldNode("imageExtension", Modifier.PRIVATE, new ClassNode(String.class), new ClassNode(node.getClass()), null); node.addField(imageExtension);// ww w .j av a 2 s.c o m addGetter(imageExtension, node); addSetter(imageExtension, node); addNullableConstraint(node, "imageExtension"); // field where image will be binded FieldNode imageBindField = new FieldNode(fieldName, Modifier.PRIVATE, new ClassNode(MultipartFile.class), new ClassNode(node.getClass()), null); node.addField(imageBindField); addGetter(imageBindField, node); addSetter(imageBindField, node); addTransientValue(node, fieldName); addImageValidator(node, fieldName); if (fieldName.equals(DEFAULT_FIELD_NAME)) { return; } // additional fields/methods in case when field name is different than default // we want to have possibility to get binded image addTransientValue(node, DEFAULT_FIELD_NAME); addGetter(DEFAULT_FIELD_NAME, imageBindField, node); }