本文整理汇总了Java中org.apache.commons.lang.ClassUtils.getShortClassName方法的典型用法代码示例。如果您正苦于以下问题:Java ClassUtils.getShortClassName方法的具体用法?Java ClassUtils.getShortClassName怎么用?Java ClassUtils.getShortClassName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang.ClassUtils
的用法示例。
在下文中一共展示了ClassUtils.getShortClassName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dump
import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
/**
* 记录请求信息
*
* @param methodInvocation
* @param take
*/
private void dump(MethodInvocation methodInvocation, Object result, long take) {
// 取得日志打印对象
Logger log = getLogger(methodInvocation.getMethod().getDeclaringClass());
Object[] args = methodInvocation.getArguments();
StringBuffer buffer = getArgsString(args);
if (log.isInfoEnabled()) {
String className = ClassUtils.getShortClassName(methodInvocation.getMethod().getDeclaringClass());
String methodName = methodInvocation.getMethod().getName();
String resultStr = getResultString(result);
String now = new SimpleDateFormat(DATA_FORMAT).format(new Date());
log.info(MessageFormat.format(MESSAGE, new Object[] { className, methodName, now, take, buffer.toString(),
resultStr }));
}
}
示例2: findAnnotation
import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
private AnnotationExpr findAnnotation(final BodyDeclaration n, String fullyQualifiedName, boolean foundAnnImport) {
final String simpleName = ClassUtils.getShortClassName(fullyQualifiedName);
final List<AnnotationExpr> annotations = n.getAnnotations() != null ? n.getAnnotations() : new ArrayList<AnnotationExpr>();
for (AnnotationExpr ae : annotations) {
final String name = ae.getName().toString();
if ((simpleName.equals(name) && foundAnnImport)) {
LOG.info("found " + ae + " on " + getTypeOrFieldNameForMsg(n) + ".");
return ae;
}
if (fullyQualifiedName.equals(name)) {
LOG.info("found " + ae + " on " + getTypeOrFieldNameForMsg(n) + ".");
return ae;
}
}
return null;
}
示例3: getInvoker
import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
/**
* Get the method invoker's class name
*
* @param depth
* @return
*/
private String getInvoker(int depth) {
Exception e = new Exception();
StackTraceElement[] stes = e.getStackTrace();
if (stes.length > depth) {
return ClassUtils.getShortClassName(stes[depth].getClassName());
}
return getClass().getSimpleName();
}
示例4: toString
import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
/**
* <p>Human readable description of this <code>Enum</code> item.</p>
*
* @return String in the form <code>type[name=value]</code>, for example:
* <code>JavaVersion[Java 1.0=100]</code>. Note that the package name is
* stripped from the type name.
*/
public String toString() {
if (iToString == null) {
String shortName = ClassUtils.getShortClassName(getEnumClass());
iToString = shortName + "[" + getName() + "=" + getValue() + "]";
}
return iToString;
}
示例5: toString
import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
/**
* <p>Human readable description of this Enum item.</p>
*
* @return String in the form <code>type[name]</code>, for example:
* <code>Color[Red]</code>. Note that the package name is stripped from
* the type name.
*/
public String toString() {
if (iToString == null) {
String shortName = ClassUtils.getShortClassName(getEnumClass());
iToString = shortName + "[" + getName() + "]";
}
return iToString;
}
示例6: getMessage
import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
public static String getMessage(Throwable th)
{
if (th == null) {
return "";
}
String clsName = ClassUtils.getShortClassName(th, null);
String msg = th.getMessage();
return clsName + ": " + StringUtils.defaultString(msg);
}
示例7: endWindow
import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void endWindow()
{
super.endWindow();
tuplesInCurrentStreamWindow = new LinkedList<T>();
if (lastExpiredWindowState == null) {
// not ready to emit value or empty in a certain window
return;
}
// Assumption: the expiring tuple and any tuple before are already sorted. So it's safe to emit tuples from sortedListInSlidingWin till the expiring tuple
for (T expiredTuple : lastExpiredWindowState) {
// Find sorted list for the given key
PriorityQueue<T> sortedListForE = sortedListInSlidingWin.get(function.apply(expiredTuple));
for (Iterator<T> iterator = sortedListForE.iterator(); iterator.hasNext();) {
T minElemInSortedList = iterator.next();
int k = 0;
if (comparator == null) {
if (expiredTuple instanceof Comparable) {
k = ((Comparable<T>)expiredTuple).compareTo(minElemInSortedList);
} else {
errorOutput.emit(expiredTuple);
throw new IllegalArgumentException("Operator \"" + ClassUtils.getShortClassName(this.getClass()) + "\" encounters an invalid tuple " + expiredTuple + "\nNeither the tuple is comparable Nor Comparator is specified!");
}
} else {
k = comparator.compare(expiredTuple, minElemInSortedList);
}
if (k < 0) {
// If the expiring tuple is less than the first element of the sorted list. No more tuples to emit
break;
} else {
// Emit the element in sorted list if it's less than the expiring tuple
outputPort.emit(minElemInSortedList);
// remove the element from the sorted list
iterator.remove();
}
}
}
}
示例8: getAnnotationNodes
import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
/** gets the annotation but also adds an import in the process if a Convert annotation is required. */
@Override
protected NodeData getAnnotationNodes(String enclosingClass, String fieldName, String mappedClass) {
final FieldDescriptor fd = OjbUtil.findFieldDescriptor(mappedClass, fieldName, descriptorRepositories);
if (fd != null) {
final FieldConversion fc = fd.getFieldConversion();
//in ojb all columns have at least the default field conversion
if (fc != null && FieldConversionDefaultImpl.class != fc.getClass()) {
LOG.info(enclosingClass + "." + fieldName + " for the mapped class " + mappedClass + " field has a converter " + fc.getClass().getName());
final String jpaConverter = getJpaConverterForOjbClass(fc.getClass().getName());
if (jpaConverter == null) {
LOG.error(ResolverUtil.logMsgForField(enclosingClass, fieldName, mappedClass) + " field has a converter " + fc.getClass().getName()
+ " but a replacement converter was not configured, unable to set Convert class");
return new NodeData(new NormalAnnotationExpr(new NameExpr(SIMPLE_NAME), Collections.singletonList(new MemberValuePair("converter", new NameExpr(null)))),
new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), SIMPLE_NAME), false, false));
} else if ( StringUtils.isBlank(jpaConverter) ) {
LOG.info(ResolverUtil.logMsgForField(enclosingClass, fieldName, mappedClass) + " field has a converter " + fc.getClass().getName()
+ " But no converter definition is needed due to default converter configuration." );
} else {
final String shortClassName = ClassUtils.getShortClassName(jpaConverter);
final String packageName = ClassUtils.getPackageName(jpaConverter);
return new NodeData(new NormalAnnotationExpr(new NameExpr(SIMPLE_NAME), Collections.singletonList(new MemberValuePair("converter", new NameExpr(shortClassName + ".class")))),
new ImportDeclaration(new QualifiedNameExpr(new NameExpr(PACKAGE), SIMPLE_NAME), false, false),
Collections.singletonList(new ImportDeclaration(new QualifiedNameExpr(new NameExpr(packageName), shortClassName), false, false)));
}
}
}
return null;
}
示例9: generateColumnSpec
import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
private ColumnSpec generateColumnSpec(FieldMapping fieldMapping) {
ColumnSpec columnSpec = new AffiliatesImportSpec.ColumnSpec();
columnSpec.attributeClass = ClassUtils.getShortClassName(fieldMapping.accessor.getAttributeClass());
columnSpec.columnName = fieldMapping.columnName;
columnSpec.required = fieldMapping.required;
columnSpec.example = getExampleValue(fieldMapping);
columnSpec.options = fieldMapping.getOptions();
return columnSpec;
}
示例10: assertAuthenticationClassIs
import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
@Then("authentication failure is <failure>")
@Alias("authentication failure is $failure")
public void assertAuthenticationClassIs(@Named("failure") String failure) {
assertNotNull(authException);
String expectedClassName = failure + "Exception";
String actualClassName = ClassUtils.getShortClassName(authException.getClass());
assertEquals(expectedClassName, actualClassName);
}
示例11: exceptionToErrorCode
import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
public static String exceptionToErrorCode( Throwable e ) {
if ( e == null ) {
return "service_error";
}
String s = ClassUtils.getShortClassName( e.getClass() );
s = StringUtils.removeEnd( s, "Exception" );
s = InflectionUtils.underscore( s ).toLowerCase();
return s;
}
示例12: getName
import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
/**
* It returns the full test name.
* @see junit.framework.TestCase#getName()
*/
public String getName()
{
return ClassUtils.getShortClassName(this.getClass()) + "::" + super.getName();
}
示例13: toString
import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
public String toString() {
return getSide() + " " + getQuantity() + " " + ClassUtils.getShortClassName(this.getClass()) + " " + getSecurity().getSymbol() + " trailingAmount "
+ getTrailingAmount();
}
示例14: toString
import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
public String toString() {
return getSide() + " " + getQuantity() + " " + ClassUtils.getShortClassName(this.getClass()) + " " + getSecurity().getSymbol() + " stop " + getStop()
+ " limit " + getLimit();
}
示例15: toString
import org.apache.commons.lang.ClassUtils; //导入方法依赖的package包/类
public String toString()
{
return ClassUtils.getShortClassName(this.getClass()) + "[references-size="
+ (references != null ? "" + references.size() : "undefined") + "]";
}