當前位置: 首頁>>代碼示例>>Java>>正文


Java ClassUtils.getShortClassName方法代碼示例

本文整理匯總了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 }));
    }
}
 
開發者ID:luoyaogui,項目名稱:otter-G,代碼行數:23,代碼來源:LogInterceptor.java

示例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;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:19,代碼來源:AnnotationHelper.java

示例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();
}
 
開發者ID:baidu,項目名稱:uid-generator,代碼行數:15,代碼來源:NamingThreadFactory.java

示例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;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:15,代碼來源:ValuedEnum.java

示例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;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:15,代碼來源:Enum.java

示例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);
}
 
開發者ID:thinking-github,項目名稱:nbone,代碼行數:10,代碼來源:ExceptionUtils.java

示例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();
      }
    }
  }
}
 
開發者ID:apache,項目名稱:apex-malhar,代碼行數:40,代碼來源:SortedMovingWindow.java

示例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;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:32,代碼來源:ConvertResolver.java

示例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;
}
 
開發者ID:IHTSDO,項目名稱:MLDS,代碼行數:10,代碼來源:AffiliatesExporterService.java

示例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);
}
 
開發者ID:vactowb,項目名稱:jbehave-core,代碼行數:9,代碼來源:AuthenticationSteps.java

示例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;
}
 
開發者ID:apache,項目名稱:usergrid,代碼行數:10,代碼來源:ApiResponse.java

示例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();
}
 
開發者ID:dvorka,項目名稱:mindraider,代碼行數:9,代碼來源:MRBaseTest.java

示例13: toString

import org.apache.commons.lang.ClassUtils; //導入方法依賴的package包/類
public String toString() {

		return getSide() + " " + getQuantity() + " " + ClassUtils.getShortClassName(this.getClass()) + " " + getSecurity().getSymbol() + " trailingAmount "
				+ getTrailingAmount();
	}
 
開發者ID:curtiszimmerman,項目名稱:AlgoTrader,代碼行數:6,代碼來源:TrailingStopOrderImpl.java

示例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();
	}
 
開發者ID:curtiszimmerman,項目名稱:AlgoTrader,代碼行數:6,代碼來源:StopLimitOrderImpl.java

示例15: toString

import org.apache.commons.lang.ClassUtils; //導入方法依賴的package包/類
public String toString()
{
    return ClassUtils.getShortClassName(this.getClass()) + "[references-size="
            + (references != null ? "" + references.size() : "undefined") + "]";
}
 
開發者ID:KualiCo,項目名稱:ojb,代碼行數:6,代碼來源:Image.java


注:本文中的org.apache.commons.lang.ClassUtils.getShortClassName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。