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


Java Introspector.decapitalize方法代码示例

本文整理汇总了Java中java.beans.Introspector.decapitalize方法的典型用法代码示例。如果您正苦于以下问题:Java Introspector.decapitalize方法的具体用法?Java Introspector.decapitalize怎么用?Java Introspector.decapitalize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.beans.Introspector的用法示例。


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

示例1: findIndexedPropertyName

import java.beans.Introspector; //导入方法依赖的package包/类
/** Based on names of indexedGetter and indexedSetter resolves the name
 * of the indexed property.
 * @return Name of the indexed property
 */ 
String findIndexedPropertyName() {
    String superName = findPropertyName();

    if ( superName == null ) {
        String methodName = null;

        if ( indexedGetterMethod != null )
            methodName = nameAsString(indexedGetterMethod);
        else if ( indexedSetterMethod != null )
            methodName = nameAsString(indexedSetterMethod);
        else
            throw new InternalError( "Indexed property with all methods == null" ); // NOI18N

        return methodName.startsWith( IS_PREFIX ) ? // NOI18N
               Introspector.decapitalize( methodName.substring(2) ) :
               Introspector.decapitalize( methodName.substring(3) );
    }
    else
        return superName;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:TmpPattern.java

示例2: setterMethod

import java.beans.Introspector; //导入方法依赖的package包/类
private static Method setterMethod(Class theClass, String propertyName) {
	BasicGetter getter = getGetterOrNull(theClass, propertyName);
	Class returnType = (getter==null) ? null : getter.getReturnType();

	Method[] methods = theClass.getDeclaredMethods();
	Method potentialSetter = null;
	for ( Method method : methods ) {
		final String methodName = method.getName();

		if ( method.getParameterTypes().length == 1 && methodName.startsWith( "set" ) ) {
			String testStdMethod = Introspector.decapitalize( methodName.substring( 3 ) );
			String testOldMethod = methodName.substring( 3 );
			if ( testStdMethod.equals( propertyName ) || testOldMethod.equals( propertyName ) ) {
				potentialSetter = method;
				if ( returnType == null || method.getParameterTypes()[0].equals( returnType ) ) {
					return potentialSetter;
				}
			}
		}
	}
	return potentialSetter;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:BasicPropertyAccessor.java

示例3: getBeanName

import java.beans.Introspector; //导入方法依赖的package包/类
/**
 * get name of Bean by getter function.
 *
 * @param clazz  Class type
 * @param getter Function
 * @param <T>    Class type
 * @param <R>    Return type
 * @return Bean name
 */
public static <T, R> String getBeanName(Class<?> clazz, Function<T, R> getter) {
    final Method method = getMethod(clazz, getter);
    final String methodName = method.getName();

    if (methodName.startsWith("get") || methodName.startsWith("set")) {
        return Introspector.decapitalize(methodName.substring(3));
    }
    if (methodName.startsWith("is")) {
        return Introspector.decapitalize(methodName.substring(2));
    }

    throw new BlackReflectionException("Method is not bean style: " + methodName);
}
 
开发者ID:lubang,项目名称:black-reflection,代码行数:23,代码来源:BlackReflectionUtil.java

示例4: getPropertyName

import java.beans.Introspector; //导入方法依赖的package包/类
private static String getPropertyName(Method method) {
    String methodName = method.getName();
    if (methodName.matches("^(get).*") && method.getParameterTypes().length == 0) {
        return Introspector.decapitalize(methodName.substring(3));
    } else if (methodName.matches("^(is).*") && method.getParameterTypes().length == 0) {
        return Introspector.decapitalize(methodName.substring(2));
    } else {
        return null;
    }

}
 
开发者ID:weld,项目名称:weld-junit,代码行数:12,代码来源:MockResourceInjectionServices.java

示例5: ResourceElement

import java.beans.Introspector; //导入方法依赖的package包/类
public ResourceElement(Member member, PropertyDescriptor pd) {
	super(member, pd);
	AnnotatedElement ae = (AnnotatedElement) member;
	Resource resource = ae.getAnnotation(Resource.class);
	String resourceName = resource.name();
	Class<?> resourceType = resource.type();
	this.isDefaultName = !StringUtils.hasLength(resourceName);
	if (this.isDefaultName) {
		resourceName = this.member.getName();
		if (this.member instanceof Method && resourceName.startsWith("set") && resourceName.length() > 3) {
			resourceName = Introspector.decapitalize(resourceName.substring(3));
		}
	}
	else if (beanFactory instanceof ConfigurableBeanFactory){
		resourceName = ((ConfigurableBeanFactory) beanFactory).resolveEmbeddedValue(resourceName);
	}
	if (resourceType != null && !Object.class.equals(resourceType)) {
		checkResourceType(resourceType);
	}
	else {
		// No resource type specified... check field/method.
		resourceType = getResourceType();
	}
	this.name = resourceName;
	this.lookupType = resourceType;
	this.mappedName = resource.mappedName();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:28,代码来源:CommonAnnotationBeanPostProcessor.java

示例6: getPropertyName

import java.beans.Introspector; //导入方法依赖的package包/类
/**
 * Expects a method or field annotation target and returns the property name for this target
 *
 * @param target the annotation target
 *
 * @return the property name of the target. For a field it is the field name and for a method name it is
 *         the method name stripped of 'is', 'has' or 'get'
 */
public static String getPropertyName(AnnotationTarget target) {
	if ( !( target instanceof MethodInfo || target instanceof FieldInfo ) ) {
		throw new AssertionFailure( "Unexpected annotation target " + target.toString() );
	}

	if ( target instanceof FieldInfo ) {
		return ( (FieldInfo) target ).name();
	}
	else {
		final String methodName = ( (MethodInfo) target ).name();
		String propertyName;
		if ( methodName.startsWith( "is" ) ) {
			propertyName = Introspector.decapitalize( methodName.substring( 2 ) );
		}
		else if ( methodName.startsWith( "has" ) ) {
			propertyName = Introspector.decapitalize( methodName.substring( 3 ) );
		}
		else if ( methodName.startsWith( "get" ) ) {
			propertyName = Introspector.decapitalize( methodName.substring( 3 ) );
		}
		else {
			throw new AssertionFailure( "Expected a method following the Java Bean notation" );
		}
		return propertyName;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:35,代码来源:JandexHelper.java

示例7: propertyName

import java.beans.Introspector; //导入方法依赖的package包/类
static String propertyName(String method) {
	if (method.startsWith("get") || method.startsWith("set")) {
		method = method.substring(3);
	} else if (method.startsWith("is")) {
		method = method.substring(2);
	}
	return Introspector.decapitalize(method);
}
 
开发者ID:FermioCloud,项目名称:java-code-templates,代码行数:9,代码来源:BeanProperty.java

示例8: camelize

import java.beans.Introspector; //导入方法依赖的package包/类
private static String camelize(String s) {
    return Introspector.decapitalize(s);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:GetterSetterPropertySeed.java

示例9: findEventSetName

import java.beans.Introspector; //导入方法依赖的package包/类
/** Decides about the name of the event set from names of the methods */
private String findEventSetName() {
    String compound = nameAsString(addListenerMethod).substring(3);
    return name = Introspector.decapitalize( compound );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:TmpPattern.java

示例10: makeNameId

import java.beans.Introspector; //导入方法依赖的package包/类
private static String makeNameId(Class<?> clazz) {
    String name = clazz.getSimpleName();
    return Introspector.decapitalize(name) + (!name.contains("Id") ? "Id" : "");
}
 
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:5,代码来源:DataManager.java

示例11: getName

import java.beans.Introspector; //导入方法依赖的package包/类
@Deprecated
public static String getName(Method setter) {
    // Note: method signature has already been checked for correctness.
    // The method name always starts with "set".
    return Introspector.decapitalize(setter.getName().substring(3));
}
 
开发者ID:sunmingshuai,项目名称:apache-tomcat-7.0.73-with-comment,代码行数:7,代码来源:DefaultInstanceManager.java

示例12: inferName

import java.beans.Introspector; //导入方法依赖的package包/类
private static String inferName(Class clazz) {
    return Introspector.decapitalize(clazz.getSimpleName());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:JAXB.java

示例13: getPropertyName

import java.beans.Introspector; //导入方法依赖的package包/类
private String getPropertyName(Method method) {
    SpreadsheetColumnName spreadsheetColumnName = method.getAnnotation(SpreadsheetColumnName.class);
    final String methodName = method.getName();
    return spreadsheetColumnName == null ? Introspector.decapitalize(methodName.substring(methodName.startsWith("is") ? 2 : 3)) : spreadsheetColumnName.name();
}
 
开发者ID:Dactilo,项目名称:spring-spreadsheet,代码行数:6,代码来源:ObjectToSpreadsheetConverter.java

示例14: getTail

import java.beans.Introspector; //导入方法依赖的package包/类
public String getTail(String input)
{
    return Introspector.decapitalize(input.substring(_len));
}
 
开发者ID:JetBrains,项目名称:intellij-deps-ini4j,代码行数:5,代码来源:AbstractBeanInvocationHandler.java

示例15: getShortNameAsProperty

import java.beans.Introspector; //导入方法依赖的package包/类
/**
 * Return the short string name of a Java class in uncapitalized JavaBeans property format. Strips the outer class name in case of an inner class.
 * 
 * @param clazz
 *            the class
 * @return the short name rendered in a standard JavaBeans property format
 * @see java.beans.Introspector#decapitalize(String)
 */
public static String getShortNameAsProperty(Class<?> clazz) {
	String shortName = ClassUtils.getShortName(clazz);
	int dotIndex = shortName.lastIndexOf(PACKAGE_SEPARATOR);
	shortName = (dotIndex != -1 ? shortName.substring(dotIndex + 1) : shortName);
	return Introspector.decapitalize(shortName);
}
 
开发者ID:xsonorg,项目名称:tangyuan2,代码行数:15,代码来源:ClassUtils.java


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