当前位置: 首页>>代码示例>>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;未经允许,请勿转载。