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

org.exparity.beans.naming.CamelCaseNamingStrategy Maven / Gradle / Ivy

Go to download

A Java library of bean utilities for manipulating and inspecting Java classes implementing the Java Beans standard

There is a newer version: 1.0.3
Show newest version
/*
 * Copyright (c) Modular IT Limited.
 */

package org.exparity.beans.naming;

import java.lang.reflect.Method;

import org.exparity.beans.BeanNamingStrategy;

import static org.apache.commons.lang.StringUtils.lowerCase;
import static org.apache.commons.lang.StringUtils.uncapitalize;

/**
 * @author Stewart Bissett
 */
public class CamelCaseNamingStrategy extends AbstractNamingStrategy implements BeanNamingStrategy {

	public String describeRoot(final Class type) {
		return describeType(type);
	}

	public String describeType(final Class type) {
		return uncapitalize(typeName(type));
	}

	public String describeProperty(final Method method, final String prefix) {
		int startPos = prefix.length();
		String methodName = method.getName();
		return lowerCase(methodName.charAt(startPos) + "") + methodName.substring(startPos + 1);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy