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


Java ReflectionToStringBuilder類代碼示例

本文整理匯總了Java中org.apache.commons.lang.builder.ReflectionToStringBuilder的典型用法代碼示例。如果您正苦於以下問題:Java ReflectionToStringBuilder類的具體用法?Java ReflectionToStringBuilder怎麽用?Java ReflectionToStringBuilder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ReflectionToStringBuilder類屬於org.apache.commons.lang.builder包,在下文中一共展示了ReflectionToStringBuilder類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: copyLinkedDemographicsPropertiesToLocal

import org.apache.commons.lang.builder.ReflectionToStringBuilder; //導入依賴的package包/類
public static void copyLinkedDemographicsPropertiesToLocal(LoggedInInfo loggedInInfo, Integer localDemographicId) {
	try {
		DemographicWs demographicWs = CaisiIntegratorManager.getDemographicWs(loggedInInfo, loggedInInfo.getCurrentFacility());
		List<DemographicTransfer> directLinks=demographicWs.getDirectlyLinkedDemographicsByDemographicId(localDemographicId);
		
		logger.debug("found linked demographics size:"+directLinks.size());
		
		if (directLinks.size()>0)
		{
			DemographicTransfer demographicTransfer=directLinks.get(0);
			
			logger.debug("remoteDemographic:"+ReflectionToStringBuilder.toString(demographicTransfer));
			
			DemographicDao demographicDao=(DemographicDao) SpringUtils.getBean("demographicDao");
			Demographic demographic=demographicDao.getDemographicById(localDemographicId);
			
			CaisiIntegratorManager.copyDemographicFieldsIfNotNull(demographicTransfer, demographic);
			
			demographic.setRosterDate(new Date());
			
			demographicDao.save(demographic);				
		}
	} catch (Exception e) {
		logger.error("Error", e);
	}
}
 
開發者ID:williamgrosset,項目名稱:OSCAR-ConCert,代碼行數:27,代碼來源:ConformanceTestHelper.java

示例2: processIntercept

import org.apache.commons.lang.builder.ReflectionToStringBuilder; //導入依賴的package包/類
private void processIntercept(@SuppressWarnings("rawtypes") Iterator processorChain, BaseService baseService,
		IData idata, ServiceStatus serviceStatus) throws ServerException {
	FlowPosition pipelinePosition = new FlowPosition(BEFORE, baseService.getNSName().getFullName());
	InterceptResult beforeIntResult = processAdvice(false, pipelinePosition, idata, serviceStatus);
	if (beforeIntResult.getException() != null) {
		return; // Exception in before to prevent execution of service/mock
	}
	
	pipelinePosition.setInterceptPoint(INVOKE);
	InterceptResult intResult = processAdvice(true, pipelinePosition, idata, serviceStatus);

	if (intResult.hasIntercepted() && logger.isDebugEnabled()) {
		logger.info("Intercepted: " + ReflectionToStringBuilder.toString(serviceStatus));
	}

	if (!intResult.hasIntercepted() && processorChain.hasNext()) {
		((InvokeChainProcessor) processorChain.next()).process(processorChain, baseService, idata, serviceStatus);
	}

	pipelinePosition.setInterceptPoint(AFTER);
	processAdvice(false, pipelinePosition, idata, serviceStatus);
}
 
開發者ID:wmaop,項目名稱:wm-aop,代碼行數:23,代碼來源:AOPChainProcessor.java

示例3: toString

import org.apache.commons.lang.builder.ReflectionToStringBuilder; //導入依賴的package包/類
/**
 * 對象轉字符串
 * @param obj
 * 			目標對象
 * 
 * @param style
 * 			@see org.apache.commons.lang.builder.ToStringStyle
 * 
 * @return
 */
public static String toString(Object obj, ToStringStyle style){
	if(null == obj){
		return "";
	}
	
	StringBuilder defaultObjReg = new StringBuilder();
	defaultObjReg.append("^[\\w\\.]*");
	defaultObjReg.append(obj.getClass().getSimpleName());
	defaultObjReg.append("@");
	defaultObjReg.append("[a-zA-Z0-9]+");
	defaultObjReg.append("$");
	
	// 未重寫toString
	if(String.valueOf(obj).matches(defaultObjReg.toString())){
		return ReflectionToStringBuilder.toString(obj,
				style);
	}
	
	return obj.toString();
}
 
開發者ID:ls960972314,項目名稱:report,代碼行數:31,代碼來源:ObjectUtil.java

示例4: toString

import org.apache.commons.lang.builder.ReflectionToStringBuilder; //導入依賴的package包/類
@Override
public String toString() {
    class DataObjectToStringBuilder extends ReflectionToStringBuilder {
        private DataObjectToStringBuilder(Object object) {
            super(object);
        }

        @Override
        public boolean accept(Field field) {
            if (field.getType().isPrimitive()
                    || field.getType().isEnum()
                    || java.lang.String.class.isAssignableFrom(field.getType())
                    || java.lang.Number.class.isAssignableFrom(field.getType())
                    || java.util.Collection.class.isAssignableFrom(field.getType())) {
                return super.accept(field);
            }
            return false;
        }
    };
    return new DataObjectToStringBuilder(this).toString();
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:22,代碼來源:DataObjectBase.java

示例5: toString

import org.apache.commons.lang.builder.ReflectionToStringBuilder; //導入依賴的package包/類
@Override
public String toString() {
       class BusinessObjectToStringBuilder extends ReflectionToStringBuilder {

           private BusinessObjectToStringBuilder(Object object) {
               super(object);
           }

           @Override
           public boolean accept(Field field) {
               // ignore printing out byte arrays in toString methods
               if (byte[].class.isAssignableFrom(field.getType())) {
                 return false;
               }
               return String.class.isAssignableFrom(field.getType())
                       || ClassUtils.isPrimitiveOrWrapper(field.getType());
           }

       }

       return new BusinessObjectToStringBuilder(this).toString();
   }
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:23,代碼來源:BusinessObjectBase.java

示例6: failureLogin

import org.apache.commons.lang.builder.ReflectionToStringBuilder; //導入依賴的package包/類
public AuthenticationFailureHandler failureLogin(){
	AuthenticationFailureHandler handler = new AuthenticationFailureHandler() {
		
		@Override
		public void onAuthenticationFailure(HttpServletRequest arg0,
				HttpServletResponse arg1, AuthenticationException arg2)
				throws IOException, ServletException {
			
			System.out.println("SecurityConfig.failureLogin()#httpservletrequest\n"
					+ ReflectionToStringBuilder.toString(arg0, ToStringStyle.SIMPLE_STYLE)
					+ "\n----------------"
					+ "\ngetQueryString: " + arg0.getQueryString()
					+ "\ngetRequestURI: " + arg0.getRequestURI()
					+ "\ngetServletPath: " + arg0.getServletPath()
					+ "\ngetRequestURL: " + arg0.getRequestURL()
					+ "\n\n"
			);
			
			 arg1.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
	         arg1.sendRedirect("login");  
			
		}
	}; 
	
	return handler;
}
 
開發者ID:gleb619,項目名稱:hotel_shop,代碼行數:27,代碼來源:SecurityConfig.java

示例7: execute

import org.apache.commons.lang.builder.ReflectionToStringBuilder; //導入依賴的package包/類
protected CommandResult execute(List<String> commands) {
    if (log.isDebugEnabled()) {
        log.debug(commands);
    }

    // タイムアウトしないようにする
    long timeout = Long.MAX_VALUE;

    CommandResult result = CommandUtils.execute(commands, timeout);

    if (log.isDebugEnabled()) {
        log.debug(ReflectionToStringBuilder.toString(result));
    }

    return result;
}
 
開發者ID:primecloud-controller-org,項目名稱:primecloud-controller,代碼行數:17,代碼來源:PuppetClient.java

示例8: addCanonicalName

import org.apache.commons.lang.builder.ReflectionToStringBuilder; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void addCanonicalName(String fqdn, String canonicalName) {
    List<String> commands = createCommands();
    List<String> stdins = createAddCanonicalName(fqdn, canonicalName);

    CommandResult result = execute(commands, stdins);

    if (result.getExitValue() != 0) {
        // CNAMEレコードの追加に失敗
        AutoException exception = new AutoException("ECOMMON-000205", fqdn, canonicalName);
        exception.addDetailInfo("result="
                + ReflectionToStringBuilder.toString(result, ToStringStyle.SHORT_PREFIX_STYLE));
        throw exception;
    }

    // CNAMEの確認はしない(參照先ホスト名を解決できない場合もあるため)
}
 
開發者ID:primecloud-controller-org,項目名稱:primecloud-controller,代碼行數:21,代碼來源:DnsStrategy.java

示例9: waitInstance

import org.apache.commons.lang.builder.ReflectionToStringBuilder; //導入依賴的package包/類
public InstanceDto waitInstance(String instanceId) {
    // インスタンスの処理待ち
    String[] stableStatus = new String[] { "running", "stopped" };
    // TODO: ニフティクラウドAPIの経過観察(インスタンスのステータス warning はAPIリファレンスに記載されていない)
    String[] unstableStatus = new String[] { "pending", "warning" };//

    InstanceDto instance;
    while (true) {
        instance = describeInstance(instanceId);
        String status = instance.getState().getName();

        if (ArrayUtils.contains(stableStatus, status)) {
            break;
        }

        if (!ArrayUtils.contains(unstableStatus, status)) {
            // 予期しないステータス
            AutoException exception = new AutoException("EPROCESS-000604", instanceId, status);
            exception.addDetailInfo("result=" + ReflectionToStringBuilder.toString(instance));
            throw exception;
        }
    }

    return instance;
}
 
開發者ID:primecloud-controller-org,項目名稱:primecloud-controller,代碼行數:26,代碼來源:NiftyProcessClient.java

示例10: waitCreateVolume

import org.apache.commons.lang.builder.ReflectionToStringBuilder; //導入依賴的package包/類
public VolumeDto waitCreateVolume(String volumeId) {
    // ボリュームの作成待ち
    VolumeDto volume = null;
    volume = waitVolume(volumeId);

    String status = volume.getStatus();
    if (!"in-use".equals(status)) {
        // ボリューム作成失敗時
        AutoException exception = new AutoException("EPROCESS-000621", volumeId, status);
        exception.addDetailInfo("result=" + ReflectionToStringBuilder.toString(volume));
        throw exception;
    }

    // ログ出力
    if (log.isInfoEnabled()) {
        log.info(MessageUtils.getMessage("IPROCESS-100522", volumeId));
    }

    return volume;
}
 
開發者ID:primecloud-controller-org,項目名稱:primecloud-controller,代碼行數:21,代碼來源:NiftyProcessClient.java

示例11: waitVolume

import org.apache.commons.lang.builder.ReflectionToStringBuilder; //導入依賴的package包/類
protected VolumeDto waitVolume(String volumeId) {
    // Volumeの処理待ち
    String[] stableStatus = new String[] { "available", "in-use" };
    String[] unstableStatus = new String[] { "creating" };
    VolumeDto volume = null;
    while (true) {
        volume = describeVolume(volumeId);
        String status;
        status = volume.getStatus();

        if (ArrayUtils.contains(stableStatus, status)) {
            break;
        }

        if (!ArrayUtils.contains(unstableStatus, status)) {
            // 予期しないステータス
            AutoException exception = new AutoException("EPROCESS-000620", volumeId, status);
            exception.addDetailInfo("result=" + ReflectionToStringBuilder.toString(volume));
            throw exception;
        }
    }

    return volume;
}
 
開發者ID:primecloud-controller-org,項目名稱:primecloud-controller,代碼行數:25,代碼來源:NiftyProcessClient.java

示例12: doConnect

import org.apache.commons.lang.builder.ReflectionToStringBuilder; //導入依賴的package包/類
@Override
protected Connection doConnect(final ISupplierWithException<Connection, SQLException> supplier) throws DatabaseAnonymizerException {
    final Field[] allFields = supplier.getClass().getDeclaredFields();
    assertEquals(1, allFields.length);
    final Field field = allFields[0];
    field.setAccessible(true);
    try { // not exactly a great test, but checks that supplier has parent's properties at least
        final String representation = ReflectionToStringBuilder.toString(field.get(supplier));
        log.debug(representation);
        assertTrue(representation.contains(
            "[driver=java.util.List,vendor=mssql,url=invalid-url,userName=invalid-user,password=invalid-pass]"));
    } catch (IllegalArgumentException | IllegalAccessException e) {
        log.error(e.toString());
    }
    return mockConnection;
}
 
開發者ID:armenak,項目名稱:DataDefender,代碼行數:17,代碼來源:MSSQLDBConnectionTest.java

示例13: main

import org.apache.commons.lang.builder.ReflectionToStringBuilder; //導入依賴的package包/類
public static void main(String[] args) {

        List<TestVo> list = new ArrayList<TestVo>();

        for (int i = 0; i < 10; i++) {
            TestVo a = new TestVo();
            a.setId(new Long(i));
            long tt = i % 3;
            a.setCreatorId(tt);
            list.add(a);
        }

        Map<?, List<Object>> map = SubGroupUtils.getByPropertyValue(list, "CreatorId");

        for (Map.Entry<?, List<Object>> e : map.entrySet()) {
            System.out.println((Long) e.getKey() + "=" + ReflectionToStringBuilder.toString(e.getValue()));
        }

    }
 
開發者ID:Tassemble,項目名稱:delicious,代碼行數:20,代碼來源:SubGroupUtils.java

示例14: buildDebitPendingEntry

import org.apache.commons.lang.builder.ReflectionToStringBuilder; //導入依賴的package包/類
/**
 * @see org.kuali.kfs.module.tem.batch.service.ImportedExpensePendingEntryService#buildDebitPendingEntry(org.kuali.kfs.module.tem.businessobject.AgencyStagingData, org.kuali.kfs.module.tem.businessobject.TripAccountingInformation, org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySequenceHelper, java.lang.String, org.kuali.rice.kns.util.KualiDecimal, boolean)
 */
@Override
public List<GeneralLedgerPendingEntry> buildDebitPendingEntry(AgencyStagingData agencyData, TripAccountingInformation info, GeneralLedgerPendingEntrySequenceHelper sequenceHelper, String objectCode, KualiDecimal amount, boolean generateOffset){

    List<GeneralLedgerPendingEntry> entryList = new ArrayList<GeneralLedgerPendingEntry>();

    GeneralLedgerPendingEntry pendingEntry = buildGeneralLedgerPendingEntry(agencyData, info, sequenceHelper, info.getTripChartCode(), objectCode, amount, KFSConstants.GL_DEBIT_CODE);
    if(ObjectUtils.isNotNull(pendingEntry )) {
        pendingEntry.setAccountNumber(info.getTripAccountNumber());
        pendingEntry.setSubAccountNumber(StringUtils.defaultIfEmpty(info.getTripSubAccountNumber(), GENERAL_LEDGER_PENDING_ENTRY_CODE.getBlankSubAccountNumber()));

        LOG.info("Created DEBIT GLPE: " + pendingEntry.getDocumentNumber() + " for AGENCY Import Expense: " + agencyData.getId() + " TripId: " + agencyData.getTripId()
            + "\n\n" + ReflectionToStringBuilder.reflectionToString(pendingEntry, ToStringStyle.MULTI_LINE_STYLE));

        //add to list if entry was created successfully
        entryList.add(pendingEntry);
        //handling offset
        if (generateOffset){
            generateOffsetPendingEntry(entryList, sequenceHelper, pendingEntry);
        }
    }
    return entryList;
}
 
開發者ID:kuali,項目名稱:kfs,代碼行數:26,代碼來源:ImportedExpensePendingEntryServiceImpl.java

示例15: buildServiceFeeCreditPendingEntry

import org.apache.commons.lang.builder.ReflectionToStringBuilder; //導入依賴的package包/類
/**
 * @see org.kuali.kfs.module.tem.batch.service.ImportedExpensePendingEntryService#buildCreditPendingEntry(org.kuali.kfs.module.tem.businessobject.AgencyStagingData, org.kuali.kfs.module.tem.businessobject.TripAccountingInformation, org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntrySequenceHelper, java.lang.String, org.kuali.rice.kns.util.KualiDecimal, boolean)
 */
@Override
public List<GeneralLedgerPendingEntry> buildServiceFeeCreditPendingEntry(AgencyStagingData agencyData, TripAccountingInformation info, GeneralLedgerPendingEntrySequenceHelper sequenceHelper, AgencyServiceFee serviceFee, KualiDecimal amount, boolean generateOffset){
    List<GeneralLedgerPendingEntry> entryList = new ArrayList<GeneralLedgerPendingEntry>();

    GeneralLedgerPendingEntry pendingEntry = buildGeneralLedgerPendingEntry(agencyData, info, sequenceHelper, serviceFee.getCreditChartCode(), serviceFee.getCreditObjectCode(), amount, KFSConstants.GL_CREDIT_CODE);
    if(ObjectUtils.isNotNull(pendingEntry )) {
        pendingEntry.setAccountNumber(serviceFee.getCreditAccountNumber());
        pendingEntry.setSubAccountNumber(GENERAL_LEDGER_PENDING_ENTRY_CODE.getBlankSubAccountNumber());
    }

    LOG.info("Created ServiceFee CREDIT GLPE: " + pendingEntry.getDocumentNumber() + " for AGENCY Import Expense: " + agencyData.getId() + " TripId: " + agencyData.getTripId()
            + "\n\n" + ReflectionToStringBuilder.reflectionToString(pendingEntry, ToStringStyle.MULTI_LINE_STYLE));

    //add to list if entry was created successfully
    if (ObjectUtils.isNotNull(pendingEntry)) {
        entryList.add(pendingEntry);
        //handling offset
        if (generateOffset){
            generateOffsetPendingEntry(entryList, sequenceHelper, pendingEntry);
        }
    }
    return entryList;
}
 
開發者ID:kuali,項目名稱:kfs,代碼行數:27,代碼來源:ImportedExpensePendingEntryServiceImpl.java


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