All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.leeonky.util.AbstractPropertyAccessor Maven / Gradle / Ivy

The newest version!
package com.github.leeonky.util;

import java.lang.reflect.Type;

abstract class AbstractPropertyAccessor implements PropertyAccessor {
    private final BeanClass beanClass;

    AbstractPropertyAccessor(BeanClass beanClass) {
        this.beanClass = beanClass;
    }

    @Override
    public Object tryConvert(Object value) {
        return BeanClass.getConverter().tryConvert(getTypeClass(), value);
    }

    @Override
    public BeanClass getBeanType() {
        return beanClass;
    }

    protected abstract Type provideGenericType();

    @Override
    public BeanClass getType() {
        return BeanClass.create(GenericType.createGenericType(provideGenericType()));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy