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

com.flextrade.builder.model.CodeModelProperty Maven / Gradle / Ivy

There is a newer version: 1.0.1
Show newest version
package com.flextrade.builder.model;

import java.lang.reflect.Method;

import com.sun.codemodel.JType;

public class CodeModelProperty {

    private final String fieldName;
    private final JType type;
    private final Property property;

    public CodeModelProperty(Property property, PropertyTranslator propertyTranslator) {
        this.property = property;
        this.fieldName = property.getFieldName();
        this.type = propertyTranslator.getJType(property.getType());
    }

    public String getFieldName() {
        return fieldName;
    }

    public String getFieldNameCamelCase() {
        return convertFirstCharToLowercase(getFieldName());
    }

    private String convertFirstCharToLowercase(String string) {
        return string.isEmpty() ? string : string.substring(0, 1).toLowerCase() + string.substring(1);
    }

    public Method getSetter() {
        return property.setter.method;
    }

    public Method getGetter() {
        return property.getter.method;
    }

    public JType getJType() {
        return type;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy