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

org.exparity.beans.naming.ForceRootNameNamingStrategy 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
package org.exparity.beans.naming;

import java.lang.reflect.Method;
import org.exparity.beans.BeanNamingStrategy;

/**
 * Implementation of a {@link BeanNamingStrategy} which decorates an existing naming strategy but forces the return of {@link #describeRoot(Class)}
 * 
 * @author Stewart Bissett
 */
public class ForceRootNameNamingStrategy implements BeanNamingStrategy {

	private final BeanNamingStrategy delegate;
	private final String rootName;

	public ForceRootNameNamingStrategy(final BeanNamingStrategy delegate, final String rootName) {
		this.delegate = delegate;
		this.rootName = rootName;
	}

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

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

	public String describeProperty(final Method method, final String prefix) {
		return delegate.describeProperty(method, prefix);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy