当前位置: 首页>>代码示例>>Java>>正文


Java PojoClass类代码示例

本文整理汇总了Java中com.openpojo.reflection.PojoClass的典型用法代码示例。如果您正苦于以下问题:Java PojoClass类的具体用法?Java PojoClass怎么用?Java PojoClass使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PojoClass类属于com.openpojo.reflection包,在下文中一共展示了PojoClass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testPojoStructureAndBehavior

import com.openpojo.reflection.PojoClass; //导入依赖的package包/类
@Test
    public void testPojoStructureAndBehavior() {
        final Validator validator = ValidatorBuilder.create()
                // Add Rules to validate structure for POJO_PACKAGE
                // See com.openpojo.validation.rule.impl for more ...
//                .with(new GetterMustExistRule())
//                .with(new SetterMustExistRule())
                .with(new NoFieldShadowingRule())
                // Add Testers to validate behaviour for POJO_PACKAGE
                // See com.openpojo.validation.test.impl for more ...
//                .with(new SetterTester())
//                .with(new GetterTester())
                .build();

        final List<PojoClass> pojoClasses = new ArrayList<>();
        pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core",
                new FilterClassName("\\w*PaymentRequest\\w*$")));
        validator.validate(pojoClasses);    }
 
开发者ID:Adyen,项目名称:adyen-android,代码行数:19,代码来源:PaymentRequestUnitTest.java

示例2: test_pojo_structure_and_behavior

import com.openpojo.reflection.PojoClass; //导入依赖的package包/类
@Test
public void test_pojo_structure_and_behavior() {

    List<Class> classes = Lists.newArrayList(
            AuthData.class,
            AuthMfaDevice.class,
            AuthResponse.class
    );

    List<PojoClass> pojoClasses = classes.stream().map(PojoClassFactory::getPojoClass).collect(Collectors.toList());

    Validator validator = ValidatorBuilder.create()
            .with(new GetterMustExistRule())
            .with(new SetterMustExistRule())
            .with(new SetterTester())
            .with(new GetterTester())
            .build();

    validator.validate(pojoClasses);
}
 
开发者ID:Nike-Inc,项目名称:cerberus-management-service,代码行数:21,代码来源:AuthConnectorPojoTest.java

示例3: test_pojo_structure_and_behavior

import com.openpojo.reflection.PojoClass; //导入依赖的package包/类
@Test
public void test_pojo_structure_and_behavior() {

    List<Class> classes = Lists.newArrayList(
            CreateSessionLoginTokenRequest.class,
            CreateSessionLoginTokenResponse.class,
            GenerateTokenRequest.class,
            GenerateTokenResponse.class,
            GenerateTokenResponseData.class,
            GetUserResponse.class,
            MfaDevice.class,
            ResponseStatus.class,
            SessionLoginTokenData.class,
            SessionUser.class,
            UserData.class,
            VerifyFactorRequest.class,
            VerifyFactorResponse.class
    );

    List<PojoClass> pojoClasses = classes.stream().map(PojoClassFactory::getPojoClass).collect(Collectors.toList());

    Validator validator = ValidatorBuilder.create()
            .with(new GetterMustExistRule())
            .with(new SetterMustExistRule())
            .with(new SetterTester())
            .with(new GetterTester())
            .build();

    validator.validate(pojoClasses);
}
 
开发者ID:Nike-Inc,项目名称:cerberus-management-service,代码行数:31,代码来源:OneLoginPojoTest.java

示例4: test_pojo_structure_and_behavior

import com.openpojo.reflection.PojoClass; //导入依赖的package包/类
@Test
public void test_pojo_structure_and_behavior() {

    List<PojoClass> pojoClasses = PojoClassFactory.getPojoClasses("com.nike.cerberus.record");

    Assert.assertEquals(10, pojoClasses.size());

    Validator validator = ValidatorBuilder.create()
            .with(new GetterMustExistRule())
            .with(new SetterMustExistRule())
            .with(new SetterTester())
            .with(new GetterTester())
            .build();

    validator.validate(pojoClasses);
}
 
开发者ID:Nike-Inc,项目名称:cerberus-management-service,代码行数:17,代码来源:RecordPojoTest.java

示例5: test_pojo_structure_and_behavior

import com.openpojo.reflection.PojoClass; //导入依赖的package包/类
@Test
public void test_pojo_structure_and_behavior() {

    List<PojoClass> pojoClasses = PojoClassFactory.getPojoClasses("com.nike.cerberus.domain");

    // exclude this class because it does not need getters and setters for every constructor parameter
    pojoClasses.remove(PojoClassFactory.getPojoClass(AssetResourceFile.class));

    Assert.assertEquals(19, pojoClasses.size());

    Validator validator = ValidatorBuilder.create()
            .with(new GetterMustExistRule())
            .with(new SetterMustExistRule())
            .with(new SetterTester())
            .with(new GetterTester())
            .build();

    validator.validate(pojoClasses);
}
 
开发者ID:Nike-Inc,项目名称:cerberus-management-service,代码行数:20,代码来源:DomainPojoTest.java

示例6: loggersMustBeDeclaredPrivateStaticFinalAndUseEnclosingClassName

import com.openpojo.reflection.PojoClass; //导入依赖的package包/类
@Test
public void loggersMustBeDeclaredPrivateStaticFinalAndUseEnclosingClassName() {
    final List<PojoClass> pojoClasses = PojoClassFactory.getPojoClassesRecursively("com.github.tcurrie", null);

    final AtomicInteger foundLoggers = new AtomicInteger(0);
    pojoClasses.stream().forEach(pojoClass-> pojoClass.getPojoFields().stream().filter(field -> field.getType().equals(Logger.class)).forEach(
            field -> {
                foundLoggers.incrementAndGet();
                assertEquals("Field name should be LOGGER", "LOGGER", field.getName());
                assertTrue("Logger must be private", field.isPrivate());
                assertTrue("Logger must be static " + pojoClass, field.isStatic());
                assertTrue("Logger must be final", field.isFinal());
                final Logger instance = (Logger) field.get(null);
                assertEquals("Logger must be for enclosing class", pojoClass.getName(), instance.getName());
            }));
    assertEquals("Added / removed Loggers?", EXPECTED_LOGGERS_DECLARED, foundLoggers.get());
}
 
开发者ID:tcurrie,项目名称:rest-factory,代码行数:18,代码来源:LoggerStructuralTest.java

示例7: factoriesMustNotBeConstructable

import com.openpojo.reflection.PojoClass; //导入依赖的package包/类
@Test
public void factoriesMustNotBeConstructable() {
    final List<PojoClass> pojoClasses = PojoClassFactory.getPojoClassesRecursively("com.github.tcurrie", null);

    final AtomicInteger foundFactories = new AtomicInteger(0);
    pojoClasses.stream()
            .filter(IS_NOT_INTERFACE)
            .filter(IS_NOT_ENUM)
            .filter(IS_NOT_THROWABLE)
            .filter(HAS_NO_INSTANCE_METHODS)
            .forEach(p->p.getPojoConstructors().forEach(c->{
                Assert.assertThat("Expected [" + p + "] to be a factory with a private constuctor.", c.isPrivate(), is(true));
                if (!(hasInstanceField(p) && hasGetInstanceMethod(p)))
                    assertConstructionFails(p, c);
                foundFactories.incrementAndGet();
            }));
    assertEquals("Added / removed Loggers?", EXPECTED_FACTORIES_DECLARED, foundFactories.get());
}
 
开发者ID:tcurrie,项目名称:rest-factory,代码行数:19,代码来源:FactoryStructuralTest.java

示例8: getHandlerNames

import com.openpojo.reflection.PojoClass; //导入依赖的package包/类
public static Set<String> getHandlerNames(String handlerType) {
	Set<String> handlerClassNames = new TreeSet<String>();
	for (PojoClass extendClass : _extendClasses) {
		Class<?> clazz = extendClass.getClazz();

		Handler handlerAnnotation = clazz.getAnnotation(Handler.class); 

		if ((handlerAnnotation != null) &&
			handlerType.equals(handlerAnnotation.type().toString())) {

			handlerClassNames.add(clazz.getSimpleName());
		}
	}

	return handlerClassNames;
}
 
开发者ID:sorin-pop,项目名称:data-manipulator,代码行数:17,代码来源:HandlerUtil.java

示例9: setup

import com.openpojo.reflection.PojoClass; //导入依赖的package包/类
@Before
public void setup() {
    pojoClasses = PojoClassFactory.getPojoClassesRecursively(POJO_PACKAGE, new PojoClassFilter() {

        @Override
        public boolean include(PojoClass pojoClass) {
            if(pojoClass.getName().contains("abstract")) {
                return false;
            }

            if(!pojoClass.getName().contains("pocketmedia")) {
                return false;
            }

            return true;
        }
    });

    pojoValidator = new PojoValidator();

    // Create Testers to validate behavior for POJO_PACKAGE
    pojoValidator.addTester(new SetterTester());
    pojoValidator.addTester(new GetterTester());
}
 
开发者ID:Pocketbrain,项目名称:androidnativeadslib,代码行数:25,代码来源:PojosTest.java

示例10: setup

import com.openpojo.reflection.PojoClass; //导入依赖的package包/类
@BeforeTest
public void setup() {
    this.pojoClasses = PojoClassFactory.getPojoClasses(POJO_PACKAGE, new PojoClassFilter() {

        @Override
        public boolean include(final PojoClass pojoClass) {
            System.out.println(pojoClass.getName());
            return pojoClass.getName().endsWith("Style");
        }
    });

    this.pojoValidator = new PojoValidator();

    // Create Testers to validate behavior for POJO_PACKAGE
    this.pojoValidator.addTester(new SetterTester());
    this.pojoValidator.addTester(new GetterTester());
}
 
开发者ID:eFaps,项目名称:Data-Exporter,代码行数:18,代码来源:TestPojos.java

示例11: testPojoStructureAndBehavior

import com.openpojo.reflection.PojoClass; //导入依赖的package包/类
/**
 * Unit Test the POJO classes.
 *
 * @throws ClassNotFoundException
 *             the class not found exception
 * @throws InstantiationException
 *             the instantiation exception
 * @throws IllegalAccessException
 *             the illegal access exception
 */

@Test
public void testPojoStructureAndBehavior() throws ClassNotFoundException,
        InstantiationException, IllegalAccessException {
    final PojoValidator pojoValidator = new PojoValidator();
    for (final Class<? extends Rule> ruleClass : getValidationRules()) {
        final Rule rule = ruleClass.newInstance();
        pojoValidator.addRule(rule);
    }

    // Load tester classes
    for (Class<? extends Tester> testerClass : getTesters()) {
        final Tester testerInstance = testerClass.newInstance();
        pojoValidator.addTester(testerInstance);
    }

    for (final Class<?> c : getPOJOClasses()) {
        final PojoClass pojoClass = PojoClassFactory.getPojoClass(c);

        pojoValidator.runValidation(pojoClass);
    }
}
 
开发者ID:eBay,项目名称:parallec,代码行数:33,代码来源:ParallecPojoClassTest.java

示例12: testPojoStructureAndBehavior

import com.openpojo.reflection.PojoClass; //导入依赖的package包/类
@Test
@Category(UnitTest.class)
@SuppressWarnings("unchecked")
public void testPojoStructureAndBehavior() {
    if (this.getClass() == PojoTest.class) {
        return;
    }
    Class<T> typeParameterClass = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
    
    PojoValidator pojoValidator = new PojoValidator();

    // Create Rules to validate structure for POJO_PACKAGE
    pojoValidator.addRule(new NoPublicFieldsRule());
    pojoValidator.addRule(new NoPrimitivesRule());
    pojoValidator.addRule(new NoStaticExceptFinalRule());
    pojoValidator.addRule(new GetterMustExistRule());
    pojoValidator.addRule(new SetterMustExistRule());
    pojoValidator.addRule(new NoNestedClassRule());

    // Create Testers to validate behaviour for POJO_PACKAGE
    pojoValidator.addTester(new SetterTester());
    pojoValidator.addTester(new GetterTester());
    
    PojoClass pojoClass = PojoClassFactory.getPojoClass(typeParameterClass);
    pojoValidator.runValidation(pojoClass);
}
 
开发者ID:Livefyre,项目名称:livefyre-java-utils,代码行数:27,代码来源:PojoTest.java

示例13: testPojo

import com.openpojo.reflection.PojoClass; //导入依赖的package包/类
@Test
public void testPojo() {
	PojoValidator pojoValidator = new PojoValidator();

	// Create Rules to validate structure for POJO_PACKAGE
	pojoValidator.addRule(new NoPublicFieldsRule());
	pojoValidator.addRule(new NoPrimitivesRule());
	pojoValidator.addRule(new NoStaticExceptFinalRule());
	pojoValidator.addRule(new GetterMustExistRule());
	pojoValidator.addRule(new SetterMustExistRule());
	pojoValidator.addRule(new NoNestedClassRule());
	pojoValidator.addRule(new NoPublicFieldsExceptStaticFinalRule());
	pojoValidator.addRule(new NoStaticExceptFinalRule());
	pojoValidator.addRule(new SerializableMustHaveSerialVersionUIDRule());

	// Create Testers to validate behaviour for POJO_PACKAGE
	pojoValidator.addTester(new SetterTester());
	pojoValidator.addTester(new GetterTester());
	PojoClass pojoClass = PojoClassFactory.getPojoClass(getPojoClass());
	pojoValidator.runValidation(pojoClass);
}
 
开发者ID:aracrown,项目名称:ara-commons,代码行数:22,代码来源:AbstractSinglePojoClassTest.java

示例14: testPojoStructureAndBehavior

import com.openpojo.reflection.PojoClass; //导入依赖的package包/类
@Test
    public void testPojoStructureAndBehavior() {
        final Validator validator = ValidatorBuilder.create()
                // Add Rules to validate structure for POJO_PACKAGE
                // See com.openpojo.validation.rule.impl for more ...
//                .with(new GetterMustExistRule())
//                .with(new SetterMustExistRule())
                .with(new NoFieldShadowingRule())

                // Add Testers to validate behaviour for POJO_PACKAGE
                // See com.openpojo.validation.test.impl for more ...
                .with(new SetterTester())
                .with(new GetterTester())
                .build();


        final List<PojoClass> pojoClasses = new ArrayList<>();
        pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.internals",
                new FilterClassName("\\w*HttpClient\\w*$")));
        pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.internals",
                new FilterClassName("\\w*PaymentTrigger\\w*$")));
        pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.internals",
                new FilterClassName("\\w*TokenHttpClient\\w*$")));
        pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.internals",
                new FilterClassName("\\w*ModularPaymentMethods\\w*$")));
        pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.internals",
                new FilterClassName("\\w*ModuleAvailabilityUtil\\w*$")));
        pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.internals",
                new FilterClassName("\\w*PaymentMethodServiceFactory\\w*$")));
        pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.internals",
                new FilterClassName("\\w*InputFieldsServiceFactory\\w*$")));


        validator.validate(pojoClasses);
    }
 
开发者ID:Adyen,项目名称:adyen-android,代码行数:36,代码来源:InternalsUnitTest.java

示例15: testPojoStructureAndBehavior

import com.openpojo.reflection.PojoClass; //导入依赖的package包/类
@Test
    public void testPojoStructureAndBehavior() {
        Validator validator = ValidatorBuilder.create()
                // Add Rules to validate structure for POJO_PACKAGE
                // See com.openpojo.validation.rule.impl for more ...
//                .with(new GetterMustExistRule())
//                .with(new SetterMustExistRule())
                // Add Testers to validate behaviour for POJO_PACKAGE
                // See com.openpojo.validation.test.impl for more ...
                .with(new SetterTester())
                .with(new GetterTester())
                .build();

        final List<PojoClass> pojoClasses = new ArrayList<>();
        pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.utils",
                new FilterClassName("\\w*AdyenRedirectHandlerActivity\\w*$")));
        pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.utils",
                new FilterClassName("\\w*AmountUtil\\w*$")));
        pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.utils",
                new FilterClassName("\\w*AsyncHttpClient\\w*$")));
        pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.utils",
                new FilterClassName("\\w*AsyncImageDownloader\\w*$")));
        pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.utils",
                new FilterClassName("\\w*PaymentResponse\\w*$")));
        pojoClasses.addAll(PojoClassFactory.getPojoClassesRecursively("com.adyen.core.utils",
                new FilterClassName("\\w*ValidatorUtil\\w*$")));


        validator.validate(pojoClasses);
    }
 
开发者ID:Adyen,项目名称:adyen-android,代码行数:31,代码来源:UtilsUnitTest.java


注:本文中的com.openpojo.reflection.PojoClass类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。