本文整理汇总了Java中org.springframework.security.util.FieldUtils类的典型用法代码示例。如果您正苦于以下问题:Java FieldUtils类的具体用法?Java FieldUtils怎么用?Java FieldUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FieldUtils类属于org.springframework.security.util包,在下文中一共展示了FieldUtils类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: RepoIndexer
import org.springframework.security.util.FieldUtils; //导入依赖的package包/类
public RepoIndexer(StoringRepo repo) {
if (repo == null) {
throw new IllegalArgumentException("Repo cannot be null");
}
this.repo = repo;
//Unplexus
defaultIndexerEngine = new DefaultIndexerEngine();
FieldUtils.setProtectedFieldValue("indexerEngine", this, defaultIndexerEngine);
DefaultQueryCreator queryCreator = new DefaultQueryCreator();
FieldUtils.setProtectedFieldValue("logger", queryCreator,
new ConsoleLogger(org.codehaus.plexus.logging.Logger.LEVEL_INFO, "console"));
FieldUtils.setProtectedFieldValue("queryCreator", this, queryCreator);
FieldUtils.setProtectedFieldValue("searcher", this, new DefaultSearchEngine());
//packer
IncrementalHandler incrementalHandler = new DefaultIncrementalHandler();
FieldUtils.setProtectedFieldValue("logger", incrementalHandler,
new ConsoleLogger(org.codehaus.plexus.logging.Logger.LEVEL_INFO, "console"));
packer = new DefaultIndexPacker();
FieldUtils.setProtectedFieldValue("incrementalHandler", packer, incrementalHandler);
FieldUtils.setProtectedFieldValue("logger", packer,
new ConsoleLogger(org.codehaus.plexus.logging.Logger.LEVEL_WARN, "console"));
ArtifactoryArtifactContextProducer artifactContextProducer = new ArtifactoryArtifactContextProducer();
scanner = new ArtifactoryContentScanner(artifactContextProducer);
}
开发者ID:alancnet,项目名称:artifactory,代码行数:26,代码来源:RepoIndexer.java
示例2: getObjectClassId_NewObjectClassName_ShouldRetrieveFromDataStoreAndPutIntoCache
import org.springframework.security.util.FieldUtils; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void getObjectClassId_NewObjectClassName_ShouldRetrieveFromDataStoreAndPutIntoCache() throws Exception {
// arrange
final String STUBBED_ACL_CLASS_ID = "fake-id";
final String STUBBED_ACL_CLASS_NAME = "com.example.model.StubbedClass";
AclClass stubbedAclClass = new AclClass();
stubbedAclClass.setId(STUBBED_ACL_CLASS_ID);
stubbedAclClass.setClassName(STUBBED_ACL_CLASS_NAME);
QAclClass aclClass = QAclClass.aclClass;
when(mockRepository.findOne(aclClass.className.eq(STUBBED_ACL_CLASS_NAME))).thenReturn(stubbedAclClass);
SimpleCacheAclClassService cacheAclClassService = new SimpleCacheAclClassService(mockRepository);
// action
String objectClassId = cacheAclClassService.getObjectClassId(STUBBED_ACL_CLASS_NAME);
// verify
assertEquals("", STUBBED_ACL_CLASS_ID, objectClassId);
Map<String, String> cache = (Map<String, String>) FieldUtils.getFieldValue(cacheAclClassService, "classNameToIdMap");
assertTrue(cache.containsKey(STUBBED_ACL_CLASS_NAME));
assertTrue(cache.containsValue(STUBBED_ACL_CLASS_ID));
verify(mockRepository).findOne(eq(aclClass.className.eq(STUBBED_ACL_CLASS_NAME)));
}
开发者ID:AlexCzar,项目名称:spring-security-acl-mongodb,代码行数:25,代码来源:SimpleCacheAclClassServiceTest.java
示例3: getObjectClassName_ValidObjectClassId_ReturnDataFromDatastore
import org.springframework.security.util.FieldUtils; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void getObjectClassName_ValidObjectClassId_ReturnDataFromDatastore() throws Exception {
// arrange
String objectClassId = "1";
AclClass stubClass = new AclClass();
stubClass.setClassName("SampleClass");
stubClass.setId(objectClassId);
when(mockRepository.findOne(objectClassId)).thenReturn(stubClass);
SimpleCacheAclClassService cacheAclClassService = new SimpleCacheAclClassService(mockRepository);
// action
String objectClassName = cacheAclClassService.getObjectClassName(objectClassId);
// verify
assertNotNull(objectClassName);
assertEquals("SampleClass", objectClassName);
Map<String, String> classNameToIdMap = (Map<String, String>)FieldUtils.getFieldValue(cacheAclClassService, "classNameToIdMap");
assertTrue(classNameToIdMap.containsKey("SampleClass"));
assertEquals(classNameToIdMap.get("SampleClass"), "1");
}
开发者ID:AlexCzar,项目名称:spring-security-acl-mongodb,代码行数:22,代码来源:SimpleCacheAclClassServiceTest.java
示例4: getReader
import org.springframework.security.util.FieldUtils; //导入依赖的package包/类
/**
* @return The shell's {@link ConsoleReader}.
*/
public ConsoleReader getReader() {
// XXX Spring Shell doesn't expose the reader that we need to use to
// read values from a terminal, so use reflection to pull it out.
return (ConsoleReader) FieldUtils.getProtectedFieldValue("reader", shell);
}
开发者ID:apache,项目名称:incubator-rya,代码行数:9,代码来源:JLinePrompt.java
注:本文中的org.springframework.security.util.FieldUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论