signature:
public class BoxNode { /** * Checks if another node is located inside the visual bounds of this box .
 * @ param childNode the node to check
 * @ return < code > true < / code > if the child node is completely inside this node , < code > false < / code > otherwise */
public boolean visuallyEncloses ( BoxNode childNode ) { } }

implementation:
int cx1 = childNode . getVisualBounds ( ) . getX1 ( ) ; int cy1 = childNode . getVisualBounds ( ) . getY1 ( ) ; int cx2 = childNode . getVisualBounds ( ) . getX2 ( ) ; int cy2 = childNode . getVisualBounds ( ) . getY2 ( ) ; int px1 = getVisualBounds ( ) . getX1 ( ) ; int py1 = getVisualBounds ( ) . getY1 ( ) ; int px2 = getVisualBounds ( ) . getX2 ( ) ; int py2 = getVisualBounds ( ) . getY2 ( ) ; /* if ( this . toString ( ) . contains ( " pBody " ) & & childNode . toString ( ) . contains ( " mediawiki " ) )
 System . out . println ( childNode + " inside of " + this ) ;
 if ( childNode . toString ( ) . contains ( " www - lupa - cz " ) & & this . toString ( ) . contains ( " [ page ] " ) )
 System . out . println ( childNode + " inside of " + this ) ; */
/* if ( this . getOrder ( ) = = 70 & & childNode . getOrder ( ) = = 74)
 System . out . println ( " jo ! " ) ; */
// check how many corners of the child are inside enough ( with some overlap )
int ccnt = 0 ; if ( cx1 >= px1 + OVERLAP && cx1 <= px2 - OVERLAP && cy1 >= py1 + OVERLAP && cy1 <= py2 - OVERLAP ) ccnt ++ ; // top left
if ( cx2 >= px1 + OVERLAP && cx2 <= px2 - OVERLAP && cy1 >= py1 + OVERLAP && cy1 <= py2 - OVERLAP ) ccnt ++ ; // top right
if ( cx1 >= px1 + OVERLAP && cx1 <= px2 - OVERLAP && cy2 >= py1 + OVERLAP && cy2 <= py2 - OVERLAP ) ccnt ++ ; // bottom left
if ( cx2 >= px1 + OVERLAP && cx2 <= px2 - OVERLAP && cy2 >= py1 + OVERLAP && cy2 <= py2 - OVERLAP ) ccnt ++ ; // bottom right
// check how many corners of the child are inside the parent exactly
int xcnt = 0 ; if ( cx1 >= px1 && cx1 <= px2 && cy1 >= py1 && cy1 <= py2 ) xcnt ++ ; // top left
if ( cx2 >= px1 && cx2 <= px2 && cy1 >= py1 && cy1 <= py2 ) xcnt ++ ; // top right
if ( cx1 >= px1 && cx1 <= px2 && cy2 >= py1 && cy2 <= py2 ) xcnt ++ ; // bottom left
if ( cx2 >= px1 && cx2 <= px2 && cy2 >= py1 && cy2 <= py2 ) xcnt ++ ; // bottom right
// and reverse direction - how many corners of the parent are inside of the child
int rxcnt = 0 ; if ( px1 >= cx1 && px1 <= cx2 && py1 >= cy1 && py1 <= cy2 ) rxcnt ++ ; // top left
if ( px2 >= cx1 && px2 <= cx2 && py1 >= cy1 && py1 <= cy2 ) rxcnt ++ ; // top right
if ( px1 >= cx1 && px1 <= cx2 && py2 >= cy1 && py2 <= cy2 ) rxcnt ++ ; // bottom left
if ( px2 >= cx1 && px2 <= cx2 && py2 >= cy1 && py2 <= cy2 ) rxcnt ++ ; // bottom right
// shared areas
int shared = getVisualBounds ( ) . intersection ( childNode . getVisualBounds ( ) ) . getArea ( ) ; double sharedperc = ( double ) shared / childNode . getBounds ( ) . getArea ( ) ; // no overlap
if ( xcnt == 0 ) return false ; // fully overlapping or over a corner - the order decides
else if ( ( cx1 == px1 && cy1 == py1 && cx2 == px2 && cy2 == py2 ) // full overlap
|| ( ccnt == 1 && xcnt <= 1 ) ) // over a corner
return this . getOrder ( ) < childNode . getOrder ( ) && sharedperc >= AREAP ; // fully inside
else if ( xcnt == 4 ) return true ; // partly inside ( at least two corners )
else if ( xcnt >= 2 ) { if ( rxcnt == 4 ) // reverse relation - the child contains the parent
return false ; else // child partly inside the parent
return this . getOrder ( ) < childNode . getOrder ( ) && sharedperc >= AREAP ; } // not inside
else return false ;


signature:
public class BoxNode { /** * Checks if another node is fully located inside the content bounds of this box .
 * @ param childNode the node to check
 * @ return < code > true < / code > if the child node is completely inside this node , < code > false < / code > otherwise */
public boolean visuallyEncloses1 ( BoxNode childNode ) { } }

implementation:
int cx1 = childNode . getVisualBounds ( ) . getX1 ( ) ; int cy1 = childNode . getVisualBounds ( ) . getY1 ( ) ; int cx2 = childNode . getVisualBounds ( ) . getX2 ( ) ; int cy2 = childNode . getVisualBounds ( ) . getY2 ( ) ; int px1 = getVisualBounds ( ) . getX1 ( ) ; int py1 = getVisualBounds ( ) . getY1 ( ) ; int px2 = getVisualBounds ( ) . getX2 ( ) ; int py2 = getVisualBounds ( ) . getY2 ( ) ; // check how many corners of the child are inside the parent exactly
int xcnt = 0 ; if ( cx1 >= px1 && cx1 <= px2 && cy1 >= py1 && cy1 <= py2 ) xcnt ++ ; // top left
if ( cx2 >= px1 && cx2 <= px2 && cy1 >= py1 && cy1 <= py2 ) xcnt ++ ; // top right
if ( cx1 >= px1 && cx1 <= px2 && cy2 >= py1 && cy2 <= py2 ) xcnt ++ ; // bottom left
if ( cx2 >= px1 && cx2 <= px2 && cy2 >= py1 && cy2 <= py2 ) xcnt ++ ; // bottom right
/* if ( childNode . toString ( ) . contains ( " globalWrapper " ) & & this . toString ( ) . contains ( " mediawiki " ) )
 System . out . println ( " jo ! " ) ; */
if ( ( cx1 == px1 && cy1 == py1 && cx2 == px2 && cy2 == py2 ) ) // exact overlap
return this . getOrder ( ) < childNode . getOrder ( ) ; else return xcnt == 4 ;


signature:
public class BoxNode { /** * Takes a list of nodes and selects the nodes that are located directly inside
 * of this node ' s box . The { @ code nearestParent } of the selected boxes is set to this box .
 * @ param list the list of nodes to test
 * @ param full when set to true , all the nodes within the box content bounds are considered .
 * Otherwise , only the boxes within the visual bounds are considered . */
public void markNodesInside ( Vector < BoxNode > list , boolean full ) { } }

implementation: for ( Iterator < BoxNode > it = list . iterator ( ) ; it . hasNext ( ) ; ) { BoxNode node = it . next ( ) ; if ( full ) { if ( node != this && this . contentEncloses ( node ) && ( node . isRootNode ( ) || ! this . contentEncloses ( node . nearestParent ) ) ) { node . nearestParent = this ; } } else { if ( node != this && this . visuallyEncloses ( node ) && ( node . isRootNode ( ) || ! this . visuallyEncloses ( node . nearestParent ) ) ) { node . nearestParent = this ; } } }


signature:
public class BoxNode { /** * Takes a list of nodes and selects the nodes whose parent box is identical to this node ' s box .
 * The { @ code nearestParent } of the selected boxes is set to this box node .
 * @ param list the list of nodes to test */
public void markChildNodes ( Vector < BoxNode > list ) { } }

implementation: final Box thisBox = this . getBox ( ) ; for ( Iterator < BoxNode > it = list . iterator ( ) ; it . hasNext ( ) ; ) { BoxNode node = it . next ( ) ; if ( node != this && node . getBox ( ) . getParent ( ) == thisBox ) node . nearestParent = this ; }


signature:
public class BoxNode { /** * Goes through the parent ' s children , takes all the nodes that are inside of this node
 * and makes them the children of this node . Then , recursively calls the children to take
 * their nodes . */
public void takeChildren ( Vector < BoxNode > list ) { } }

implementation:
for ( Iterator < BoxNode > it = list . iterator ( ) ; it . hasNext ( ) ; ) { BoxNode node = it . next ( ) ; if ( node . nearestParent . equals ( this ) ) { appendChild ( node ) ; it . remove ( ) ; } } // let the children take their children
for ( int i = 0 ; i < getChildCount ( ) ; i ++ ) ( ( BoxNode ) getChildAt ( i ) ) . takeChildren ( list ) ;


signature: public class DefaultServiceRegistry { @ Override public < T > void register ( Class < T > interfaceClass , T service ) { } }

implementation: register ( interfaceClass , service , DEFAULT_HINT ) ;


signature: public class DefaultServiceRegistry { @ Override public < T > T getService ( Class < T > requiredType ) { } }

implementation: return getService ( requiredType , ANY_HINT ) ;


signature:
public class DefaultServiceRegistry { /** * 找到符合相应类型的服务map
 * @ param requiredType 服务类型
 * @ param < T > 服务类型
 * @ return 第一个找到的map */
private < T > Map < String , Object > digMaps ( Class < T > requiredType ) { } }

implementation:
Map < String , Object > all = new HashMap < String , Object > ( ) ; Set < Class > keys = services . keySet ( ) ; for ( Class serviceClass : keys ) { if ( requiredType . isAssignableFrom ( serviceClass ) ) { // 如果出现子类型中的服务与已有存在的冲突了怎么办 ?
Map < String , Object > map = services . get ( serviceClass ) ; for ( String key : map . keySet ( ) ) { Object service = map . get ( key ) ; Object exist = all . get ( key ) ; if ( exist != null ) { int n = 1 ; String newKey ; do { newKey = key + "#" + n ++ ; } while ( all . containsKey ( newKey ) ) ; all . put ( newKey , service ) ; } else { all . put ( key , service ) ; } } } } return all ;


signature:
public class AppLauncher { /** * 启动当前的组件Jar包 */
public void start ( ) throws Exception { } }

implementation:
try { long start = System . currentTimeMillis ( ) ; // Ensure there is no legacy signal files
FileUtils . deleteQuietly ( getSignal ( "exit" ) ) ; FileUtils . deleteQuietly ( getSignal ( "exiting" ) ) ; logger . info ( banner ( "Loading components starts from {}" , this . mainComponent ) ) ; environment . load ( this . mainComponent ) ; logger . info ( banner ( "Loaded  components starts from {}" , this . mainComponent ) ) ; if ( ! StringUtils . isEmpty ( System . getProperty ( "app.port" ) ) ) exportAsRMI ( ) ; addShutdownHook ( ) ; logger . info ( banner ( "The {} is started" , getAppName ( ) ) ) ; logger . info ( banner ( "System starts took {}" , formatDurationHMS ( System . currentTimeMillis ( ) - start ) ) ) ; // Thread . currentThread ( ) . setDaemon ( true ) ;
// 让主线程基于STDIO接受交互命令
// 以后应该让CLI组件托管这块工作
// if ( ! StringUtils . isEmpty ( System . getProperty ( " app . port " ) ) )
// processCommands ( ) ;
if ( StringUtils . isEmpty ( System . getProperty ( "app.port" ) ) ) checkSignalPeriodically ( ) ; } catch ( Exception ex ) { logger . error ( "Failed to start" , ex ) ; System . exit ( 1 ) ; }


signature:
public class AppLauncher { /** * 退出 */
public void exit ( ) { } }

implementation:
if ( exiting ( ) ) { logger . debug ( "Another thread is shutting down" ) ; return ; } final long start = System . currentTimeMillis ( ) ; // noinspection finally
File exitingSignal = getSignal ( "exiting" ) ; try { logger . info ( banner ( "Unloading the main component {}" , this . mainComponent ) ) ; FileUtils . touch ( exitingSignal ) ; environment . unload ( this . mainComponent ) ; logger . info ( banner ( "Unloaded  the main component {}" , this . mainComponent ) ) ; } catch ( Exception ex ) { logger . error ( ex . getMessage ( ) , ex ) ; } finally { FileUtils . deleteQuietly ( exitingSignal ) ; // 启动一个额外的线程停止自身
new Thread ( "Stopper" ) { @ Override public void run ( ) { logger . info ( banner ( "System stops took {}" , formatDurationHMS ( System . currentTimeMillis ( ) - start ) ) ) ; System . exit ( 0 ) ; } } . start ( ) ; }


signature:
public class AppLauncher { /** * 将本对象通过Spring的RMI机制暴露出去
 * @ throws Exception */
private void exportAsRMI ( ) throws Exception { } }

implementation:
String appHost = System . getProperty ( "app.host" ) ; String appPort = System . getProperty ( "app.port" ) ; RmiServiceExporter exporter = new RmiServiceExporter ( ) ; exporter . setServiceInterface ( Executable . class ) ; String serviceName = getAppName ( ) + "Launcher" ; // exporter . setRegistryHost ( appHost ) ;
exporter . setRegistryPort ( Integer . valueOf ( appPort ) ) ; exporter . setServiceName ( serviceName ) ; exporter . setService ( this ) ; exporter . afterPropertiesSet ( ) ; String serviceUrl = String . format ( "rmi://%s:%s/%s" , appHost , appPort , serviceName ) ; logger . info ( banner ( "Export Executable Service at {}" , serviceUrl ) ) ;


signature:
public class AppLauncher { /** * Process user specified command
 * @ param command the command */
protected void process ( String command ) { } }

implementation: try { Method method = this . getClass ( ) . getMethod ( command ) ; logger . info ( "Try to delegate '{}' to launcher directly." , command ) ; method . invoke ( this ) ; logger . info ( "Invoke '{}' to launcher directly successfully. \r\n" , command ) ; } catch ( NoSuchMethodException e ) { logger . warn ( "unrecognized command: '{}'" , command ) ; } catch ( Exception e ) { logger . warn ( "Failed to execute: '{}'" , command ) ; }


signature:
public class AppLauncher { /** * < h1 > 支持系统启动与停止 < / h1 >
 * < h2 > 启动方式 < / h2 >
 * 开发模式下 , 通过命令行以 :
 * < p > < strong > java - classpath jdk / jars ; container / classes ; other / classes
 * dnt . component . container . AppLauncher depended . group . artifact - version < / strong > < / p >
 * 生产模式下 , 通过命令行以 :
 * < p > < strong > java - Dapp . home = path / to / home - jar path / to / container . jar depended . group . artifact - version < / strong > < / p >
 * 的方式启动
 * 定制方式 :
 * 用户可以通过 - Dapp . launch . environment = the . launch . env . class 的方式定制启动逻辑
 * 但请注意将相应的Launch Env类配置在主jar的class - path中 ( 或开发环境的pom依赖下 )
 * 退出情况 :
 * < ul >
 * < li > 0 : 正常退出 < / li >
 * < li > 1 : Launch Env不能初始化 < / li >
 * < li > 2 : 目标主jar | classes未定义 < / li >
 * < li > 3 : 目标主jar | classes无法初始化 < / li >
 * < li > 100 : 未知异常 < / li >
 * < li > 其他 : 业务异常 , 待明确 < / li >
 * < / ul >
 * < h2 > 停止方式 < / h2 >
 * 开发模式下 , 通过命令行以 :
 * < p > < strong > java - classpath jdk / jars ; container / classes ; other / classes
 * dnt . component . container . AppLauncher depended . group . artifact - version - - stop < / strong > < / p >
 * 生产模式下 , 通过命令行以 :
 * < p > < strong > java - Dapp . home = path / to / home - jar path / to / container . jar depended . group . artifact - version - - stop < / strong > < / p >
 * 的方式停止
 * @ param args 最少要指定一个入口jar文件或者入口主模块输出路径 */
public static void main ( String [ ] args ) { } }

implementation:
if ( args . length < 1 ) throw new IllegalArgumentException ( "You must specify a main dependency" ) ; // 设定的路径可能包括lib / 等目录
String [ ] strings = args [ 0 ] . split ( "\\|/" ) ; if ( strings . length > 1 ) { args [ 0 ] = strings [ strings . length - 1 ] ; } try { // When started by Service wrapper , the context class loader is URLClassLoader of wrapper . jar
// but this main class is loaded by the framework jar ' s ClassLoader ( FactoryClassLoader )
if ( AppLauncher . class . getClassLoader ( ) != ClassLoader . getSystemClassLoader ( ) ) { // 说明是基于Service Wrapper启动
Thread . currentThread ( ) . setContextClassLoader ( MainClassLoader . getInstance ( AppLauncher . class . getClassLoader ( ) ) ) ; } else { Thread . currentThread ( ) . setContextClassLoader ( MainClassLoader . getInstance ( ) ) ; } // To register the url handler by current context class loader , instead of system bootstrap class loader
URL . setURLStreamHandlerFactory ( ComponentURLStreamHandlerFactory . getFactory ( ) ) ; int exitCode = mainWithExitCode ( args ) ; System . exit ( exitCode ) ; } catch ( LaunchException e ) { System . err . println ( describeException ( e ) ) ; System . exit ( e . getExitCode ( ) ) ; } catch ( Exception e ) { System . err . println ( describeException ( e ) ) ; System . exit ( 100 ) ; }


signature:
public class AppLauncher { /** * 启动逻辑 , 暂时还没有支持停止
 * @ param args The application command - line arguments .
 * @ return an integer exit code
 * @ throws Exception If an error occurs . */
public static int mainWithExitCode ( String [ ] args ) throws Exception { } }

implementation:
LaunchEnvironment environment = detectEnvironment ( ) ; Component mainComponent = null ; try { logger . debug ( banner ( "Resolving starts from {}" , args [ 0 ] ) ) ; mainComponent = environment . resolveComponent ( args [ 0 ] ) ; logger . debug ( banner ( "Resolved  starts from {}" , args [ 0 ] ) ) ; AppLauncher launcher = environment . createLauncher ( mainComponent ) ; // 去掉主入口参数之后 , 将其余参数传入
String [ ] newArgs = new String [ args . length - 1 ] ; System . arraycopy ( args , 1 , newArgs , 0 , args . length - 1 ) ; // 启动程序 , 根据剩余的 newArgs , 可能有多种启动方式
// 包括 : 打印组件依赖列表
// 启动系统 ( 在当前进程内启动系统 )
// 停止系统 ( 通过本机Socket停止另外一个已经在运行的系统 )
environment . execute ( launcher , newArgs ) ; return 0 ; } catch ( ComponentException ex ) { logger . error ( "{} : {}" , ex . getPath ( ) , describeException ( ex ) ) ; return - 1 ; } catch ( Throwable ex ) { logger . error ( "Failed: {}" , describeException ( ex ) ) ; return - 1 ; } finally { if ( mainComponent != null ) { environment . unload ( mainComponent ) ; } environment . shutdown ( ) ; }


signature:
public class AbstractAppConfig { /** * < h2 > 暴露某个服务 < / h2 >
 * @ param serviceClass 需要暴露的服务接口
 * @ param service 实际的服务实例 ( 不能为空 )
 * @ param hint 服务的注释
 * @ param < T > 服务的类型 */
protected < T > void exports ( Class < T > serviceClass , T service , String hint ) { } }

implementation: exporter . exports ( serviceClass , service , hint ) ;


signature:
public class AbstractAppConfig { /** * < h2 > 暴露某个服务 ( hint = default ) < / h2 >
 * @ param serviceClass 需要暴露的服务接口
 * @ param service 实际的服务实例 ( 不能为空 )
 * @ param < T > 服务的类型 */
protected < T > void exports ( Class < T > serviceClass , T service ) { } }

implementation: exporter . exports ( serviceClass , service ) ;


signature:
public class AbstractAppConfig { /** * < h2 > 暴露某个服务 < / h2 >
 * @ param serviceClass 需要暴露的服务接口
 * @ param hint 服务的注释
 * @ param < T > 服务的类型 */
protected < T > void exports ( Class < T > serviceClass , String hint ) { } }

implementation: localExporter ( ) . exports ( serviceClass , hint ) ;


signature:
public class DefaultComponent { /** * 其实如果以当前project为this , 把env , system作为上下文 , 通过对象图的方式提供变量索引 , 实现起来更好 */
@ Override public String resolveVariable ( String key ) { } }

implementation:
if ( key . startsWith ( "project." ) ) { return resolveVariable ( key . substring ( "project." . length ( ) ) ) ; } else if ( key . startsWith ( "pom." ) ) { return resolveVariable ( key . substring ( "pom." . length ( ) ) ) ; } else if ( key . startsWith ( "parent." ) ) { if ( parent == null ) return null ; return parent . resolveVariable ( key . substring ( "parent." . length ( ) ) ) ; } else if ( key . startsWith ( "env." ) ) { return System . getenv ( key . substring ( "env." . length ( ) ) ) ; } if ( "packaging" . equals ( key ) ) key = "type" ; if ( Arrays . binarySearch ( ATTRIBUTE_NAMES , key ) >= 0 ) { try { Field field = getClass ( ) . getDeclaredField ( key ) ; return String . valueOf ( field . get ( this ) ) ; } catch ( Exception e ) { return null ; } } else if ( System . getProperty ( key ) != null ) { return System . getProperty ( key ) ; } else if ( properties != null ) { String property = properties . getProperty ( key ) ; if ( property == null && parent != null ) { property = parent . resolveVariable ( key ) ; } return property ; } else { // delegate parent to resolve it
if ( parent == null ) return null ; return parent . resolveVariable ( key ) ; }


signature:
public class ContextUtils { /** * 继承上级上下文中的属性配置器
 * @ param inheriting 上级上下文
 * @ param context 当前上下文 */
public static void inheritParentProperties ( ApplicationContext inheriting , GenericApplicationContext context ) { } }

implementation: if ( ! ( inheriting instanceof AbstractApplicationContext ) ) return ; List < BeanFactoryPostProcessor > processors = ( ( AbstractApplicationContext ) inheriting ) . getBeanFactoryPostProcessors ( ) ; for ( BeanFactoryPostProcessor processor : processors ) { if ( processor instanceof PropertyResourceConfigurer ) context . addBeanFactoryPostProcessor ( processor ) ; }


signature:
public class ContextUtils { /** * 修改特定上下文的Event Multicaster的默认实现
 * @ param context 被修改的上下文 */
public static void initApplicationEventMulticaster ( GenericApplicationContext context ) { } }

implementation: ApplicationEventMulticaster multicaster ; ConfigurableListableBeanFactory beanFactory = context . getBeanFactory ( ) ; if ( beanFactory . containsLocalBean ( APPLICATION_EVENT_MULTICASTER_BEAN_NAME ) ) { multicaster = beanFactory . getBean ( APPLICATION_EVENT_MULTICASTER_BEAN_NAME , ApplicationEventMulticaster . class ) ; } else { multicaster = new SmartApplicationEventMulticaster ( beanFactory ) ; beanFactory . registerSingleton ( APPLICATION_EVENT_MULTICASTER_BEAN_NAME , multicaster ) ; } setApplicationEventMulticaster ( context , multicaster ) ;


signature:
public class Application { /** * Use this data source to create an embedded database . */
@ Bean public DataSource dataSource ( ) { } }

implementation:
// Replace this with your own datasource .
return new EmbeddedDatabaseBuilder ( ) . setName ( "test" ) . setType ( EmbeddedDatabaseType . HSQL ) . addScript ( "classpath:hsql-schema.sql" ) . build ( ) ;


signature:
public class Application { /** * Use this data source to connect to an existing database . */
@ Bean public DataSource dataSource_plain ( ) { } }

implementation: SimpleDriverDataSource ds = new SimpleDriverDataSource ( ) ; ds . setDriverClass ( null ) ; ds . setUrl ( "jdbc:oracle:thin:@<server>[:<1521>]:<database_name>" ) ; ds . setUsername ( "" ) ; ds . setPassword ( "" ) ; return ds ;


signature:
public class DropwizardModule { /** * Called when the configuration and environment come into scope .
 * @ param config Provided by Dropwizard .
 * @ param env Provided by Dropwizard . */
public void setup ( PlatformConfiguration config , Environment env ) { } }

implementation: this . configuration = Preconditions . checkNotNull ( config , "Configuration cannot be null." ) ; this . environment = Preconditions . checkNotNull ( env , "Environment cannot be null." ) ;


signature:
public class InterfaceItTask { /** * ( non - Javadoc )
 * @ see org . apache . tools . ant . Task # execute ( ) */
@ Override public void execute ( ) throws BuildException { } }

implementation: if ( null != this . echo ) { out . emitText ( echo ) ; } validateAttributes ( ) ; StatisticProvidingMixinGenerator generator = makeInterfaceItGenerator ( ) ; try { if ( debug ) { out . emitText ( this . toString ( ) ) ; } if ( null == this . targetInterfaceParentName || targetInterfaceParentName . trim ( ) . length ( ) < 1 ) { File wroteFile = generator . generateMixinJavaFile ( getOutputDirectory ( ) , getTargetInterfaceName ( ) , getDelegateClassObject ( ) , getTargetPackageName ( ) , makeArgumentNameSource ( ) ) ; GenerationStatistics stats = generator . getStatistics ( ) ; emitGenerationResult ( wroteFile , stats ) ; } else { final Class < ? > delegateClassObject = this . getDelegateClassObject ( ) ; final Class < ? > superclass = delegateClassObject . getSuperclass ( ) ; if ( null == superclass || java . lang . Object . class . equals ( superclass ) ) { out . emitText ( "Execution halted without generation. The attribute 'targetInterfaceParentName' should be empty if the delegate class has no superclass other than Object." ) ; return ; } MultiFileOutputOptions options = new OptionsForSplittingChildAndParent ( this . targetPackageName , getOutputDirectory ( ) , this . targetInterfaceName , this . targetInterfaceParentName , delegateClassObject ) ; List < File > results = generator . generateMixinJavaFiles ( options , makeArgumentNameSource ( ) , delegateClassObject , superclass ) ; for ( File result : results ) { emitGenerationResult ( result , generator . getStatisticsFor ( result . getName ( ) ) . orElse ( generator . getStatistics ( ) ) ) ; } } } catch ( IOException e ) { handleIOException ( e ) ; } catch ( ClassNotFoundException e ) { handleClassNotFound ( e ) ; } catch ( Throwable t ) { handleUnexpectedError ( t ) ; }


signature:
public class OpenStates { /** * Modify whether or not the cache is first checked for files .
 * Note that any JSON read will always be written to the
 * cache .
 * @ param checkCache the check cache */
public static void setCache ( boolean checkCache ) { } }

implementation: if ( OpenStates . checkCache != checkCache ) logger . fine ( "Changing checkCache setting to:" + checkCache ) ; OpenStates . checkCache = checkCache ;


signature:
public class OpenStates { /** * Handles the actual API calls and caching .
 * This is part of a static class and therefore is not thread - safe . This method
 * is not for public consumption . */
public < T > T query ( MethodMap methodMap , ArgMap argMap , Class < T > responseType ) throws OpenStatesException { } }

implementation:
BufferedReader reader = null ; HttpURLConnection conn = null ; String charSet = "utf-8" ; try { if ( isCaching ( methodMap , argMap ) ) { File file = getCacheFile ( methodMap , argMap ) ; long fileLength = file . length ( ) ; logger . fine ( "Length of File in cache:" + fileLength + ": " + file . getName ( ) ) ; if ( fileLength == 0L ) { OpenStates . cacheFileFromAPI ( methodMap , argMap , file , responseType ) ; } reader = new BufferedReader ( new InputStreamReader ( new FileInputStream ( file ) , charSet ) ) ; } else { conn = OpenStates . getConnectionFromAPI ( methodMap , argMap ) ; charSet = getCharset ( conn ) ; // better check it first
int rcode = conn . getResponseCode ( ) ; if ( rcode / 100 != 2 ) { String msg = conn . getResponseMessage ( ) ; conn . disconnect ( ) ; throw new OpenStatesException ( rcode , msg , methodMap , argMap , responseType ) ; } reader = new BufferedReader ( new InputStreamReader ( conn . getInputStream ( ) , charSet ) ) ; } return mapper . readValue ( reader , responseType ) ; } catch ( JsonParseException e ) { throw new OpenStatesException ( e , methodMap , argMap , responseType ) ; } catch ( JsonMappingException e ) { throw new OpenStatesException ( e , methodMap , argMap , responseType ) ; } catch ( URISyntaxException e ) { throw new OpenStatesException ( e , methodMap , argMap , responseType ) ; } catch ( IOException e ) { throw new OpenStatesException ( e , methodMap , argMap , responseType ) ; } finally { suspendCache = false ; if ( conn != null ) conn . disconnect ( ) ; if ( reader != null ) { try { reader . close ( ) ; } catch ( IOException e ) { throw new OpenStatesException ( e , methodMap , argMap , responseType ) ; } } }


signature:
public class Shell { /** * Registers the specified command instance into the shell .
 * @ param command Command to be registered . */
public void register ( Command command ) { } }

implementation: Preconditions . checkArgument ( command != null , "Parameter 'command' must not be [" + command + "]" ) ; register ( command . name ( ) , command ) ;


signature:
public class Shell { /** * Registers the specified command instance into the shell with the specified name .
 * @ param name Name of command .
 * @ param command Command to be registered . */
public void register ( String name , Command command ) { } }

implementation: Preconditions . checkArgument ( name != null && ! name . isEmpty ( ) , "Parameter 'name' must not be [" + name + "]" ) ; Preconditions . checkArgument ( command != null , "Parameter 'command' must not be [" + command + "]" ) ; commands . put ( name , command ) ;


signature:
public class Shell { /** * Unregisters the command corresponding to the specified name from the shell .
 * @ param name Name of command . */
public void unregister ( String name ) { } }

implementation: Preconditions . checkArgument ( name != null && ! name . isEmpty ( ) , "Parameter 'name' must not be [" + name + "]" ) ; commands . remove ( name ) ;


signature:
public class Shell { /** * Executes the specified command line input .
 * @ param line Command line input . */
@ SuppressWarnings ( "unchecked" ) public void exec ( String line ) { } }

implementation:
String [ ] strings = line . split ( "\\s" ) ; if ( strings . length == 0 ) { return ; } String cmd = strings [ 0 ] ; if ( strings [ 0 ] == null || strings [ 0 ] . isEmpty ( ) ) { return ; } String [ ] args = { } ; if ( strings . length > 1 ) { args = new String [ strings . length - 1 ] ; System . arraycopy ( strings , 1 , args , 0 , args . length ) ; } Command command = commands . get ( cmd ) ; if ( command == null ) { // $ NON - NLS - N $
console . println ( cmd + ": command not found" ) ; return ; } Usage usage = command . usage ( ) ; Options opts = options . get ( command . name ( ) ) ; if ( opts == null ) { opts = new Options ( ) ; for ( Usage . Option option : usage . options ( ) ) { Option opt = new Option ( option . opt ( ) , option . longOpt ( ) , false , option . description ( ) ) ; opt . setRequired ( option . required ( ) ) ; String arg = option . arg ( ) ; if ( arg == null || arg . isEmpty ( ) ) { opt . setArgs ( 1 ) ; opt . setArgName ( arg ) ; } opts . addOption ( opt ) ; } options . put ( command . name ( ) , opts ) ; } CommandLineParser parser = new GnuParser ( ) ; CommandLine commandLine = null ; try { commandLine = parser . parse ( opts , args ) ; } catch ( ParseException e ) { console ( ) . println ( usage . toString ( ) ) ; return ; } Map < String , String > options = new HashMap < > ( ) ; for ( Option option : commandLine . getOptions ( ) ) { String opt = option . getOpt ( ) ; if ( opt != null && ! opt . isEmpty ( ) ) { options . put ( opt , option . getValue ( ) ) ; } String longOpt = option . getLongOpt ( ) ; if ( longOpt != null && ! longOpt . isEmpty ( ) ) { options . put ( longOpt , option . getValue ( ) ) ; } } Line l = new Line ( cmd , options , commandLine . getArgList ( ) ) ; try { command . run ( l ) ; } catch ( Exception e ) { e . printStackTrace ( new PrintWriter ( console . reader ( ) . getOutput ( ) ) ) ; }


signature:
public class Shell { /** * Runs into the REPL mode . */
public void start ( ) { } }

implementation: repl . set ( true ) ; String line = null ; while ( repl . get ( ) && ( ( line = console . readLine ( ) ) != null ) ) { exec ( line ) ; }


signature:
public class CommitteeClass { /** * Committee Search
 * @ param state
 * @ return Committee objects returned by this method do not include the list of members by default . */
public Committees searchByState ( String state ) throws OpenStatesException { } }

implementation: return api . query ( new MethodMap ( "committees" ) , new ArgMap ( "state" , state ) , Committees . class ) ;


signature:
public class CommitteeClass { /** * Committee Search
 * This method allows searching by state and chamber .
 * Committee objects returned by this method do not include the list of members by default .
 * @ param state
 * @ param chamber
 * @ return { @ link Committees } */
public Committees searchByStateChamber ( String state , String chamber ) throws OpenStatesException { } }

implementation: return api . query ( new MethodMap ( "committees" ) , new ArgMap ( "state" , state , "chamber" , chamber ) , Committees . class ) ;


signature:
public class CommitteeClass { /** * Committee Search
 * This method allows searching by a number of fields :
 * Committee objects returned by this method do not include the list of members by default .
 * @ param state
 * @ param chamber
 * @ param committee
 * @ param subcommittee
 * @ return { @ link Committees }
 * @ throws OpenStatesException */
public Committees search ( String state , String chamber , String committee , String subcommittee ) throws OpenStatesException { } }

implementation: return api . query ( new MethodMap ( "committees" ) , new ArgMap ( "state" , state , "chamber" , chamber , "committee" , committee , "subcommittee" , subcommittee ) , Committees . class ) ;


signature:
public class CommitteeClass { /** * Committee Detail
 * This method returns the full committee object given a committee id .
 * @ param id
 * @ return { @ link Committee } object given a committee id . */
public Committee detail ( String id ) throws OpenStatesException { } }

implementation: return api . query ( new MethodMap ( "committees" , id ) , null , Committee . class ) ;


signature:
public class RemoteMBeanInvocationHandler { /** * Connect to the JMX service .
 * @ param host the host .
 * @ param port the port .
 * @ param login the login .
 * @ param password the password .
 * @ return the JMX connector .
 * @ throws IOException if unable to connect to the JMX service . */
private static JMXConnector connect ( String host , String port , String login , String password ) throws IOException { } }

implementation:
// Set the service URL .
JMXServiceURL serviceUrl = new JMXServiceURL ( new StringBuffer ( ) . append ( "service:jmx:rmi://" ) . append ( host ) . append ( ":" ) . append ( port ) . append ( "/jndi/rmi://" ) . append ( host ) . append ( ":" ) . append ( port ) . append ( "/jmxrmi" ) . toString ( ) ) ; // Set the service environment .
Map < String , Object > serviceEnv = new HashMap < String , Object > ( ) ; serviceEnv . put ( "jmx.remote.credentials" , new String [ ] { login , password } ) ; // Connect to the JMX service .
return JMXConnectorFactory . connect ( serviceUrl , serviceEnv ) ;


signature:
public class RemoteMBeanInvocationHandler { /** * Get the MBean represented by the interface class and object name .
 * @ param interfaceClass the MBean interface class .
 * @ param objectName the MBean object name .
 * @ param environment the JMX environment properties .
 * @ return the MBean .
 * @ throws MBeanException if unable to get the MBean . */
@ SuppressWarnings ( "unchecked" ) public static < T > T getMBean ( Class < T > interfaceClass , ObjectName objectName , Properties environment ) throws MBeanException { } }

implementation:
JMXConnector connector = null ; // Get the JMX environment properties .
String host = getProperty ( environment , MBeanUtility . JMX_HOST_KEY ) ; String port = getProperty ( environment , MBeanUtility . JMX_PORT_KEY ) ; String login = getProperty ( environment , MBeanUtility . JMX_LOGIN_KEY ) ; String password = getProperty ( environment , MBeanUtility . JMX_PASSWORD_KEY ) ; try { // Connect to the JMX service .
connector = connect ( host , port , login , password ) ; // Connect to the MBean server .
MBeanServerConnection mBeanServerConnection = connector . getMBeanServerConnection ( ) ; // Validate the MBean .
MBeanUtility . validateMBean ( interfaceClass , objectName , mBeanServerConnection ) ; } catch ( IOException e ) { throw new MBeanException ( e , "Unable to create the MBean represented by the interface class " + interfaceClass . getName ( ) + " and object name " + objectName . getCanonicalName ( ) + "." ) ; } finally { close ( connector ) ; } // Create the MBean .
return ( T ) Proxy . newProxyInstance ( interfaceClass . getClassLoader ( ) , new Class [ ] { interfaceClass } , new RemoteMBeanInvocationHandler < T > ( interfaceClass , objectName , host , port , login , password ) ) ;


signature:
public class RemoteMBeanInvocationHandler { /** * Get the property .
 * @ param properties the properties .
 * @ param key the property key .
 * @ return the property .
 * @ throws IllegalArgumentException if the property does not exist . */
private static String getProperty ( Properties properties , String key ) { } }

implementation:
// Check if the properties do not exist .
if ( properties == null || properties . getProperty ( key ) == null ) { throw new IllegalArgumentException ( "The property " + key + " does not exist." ) ; } return properties . getProperty ( key ) ;


signature:
public class RemoteMBeanInvocationHandler { /** * Invoke the method and return the result .
 * @ param proxy the proxy .
 * @ param method the method .
 * @ param args the method arguments .
 * @ return the result of invoking the method .
 * @ throws Throwable if unable to invoke the method . */
@ Override public Object invoke ( Object proxy , Method method , Object [ ] args ) throws Throwable { } }

implementation:
Object result ; JMXConnector connector = null ; try { // Connect to the JMX service .
connector = connect ( this . host , this . port , this . login , this . password ) ; // Create the MBean .
T object = JMX . newMXBeanProxy ( connector . getMBeanServerConnection ( ) , this . objectName , this . interfaceClass ) ; // Invoke a method on the MBean .
result = method . invoke ( object , args ) ; } finally { // Close the JMX service .
close ( connector ) ; } return result ;


signature:
public class CommandCompleter { /** * / * ( non - Javadoc )
 * @ see jline . console . completer . Completer # complete ( java . lang . String , int , java . util . List ) */
@ Override public int complete ( String buffer , int cursor , List < CharSequence > candidates ) { } }

implementation: SortedSet < String > commands = new TreeSet < > ( shell . commands ( ) . keySet ( ) ) ; if ( buffer == null ) { candidates . addAll ( commands ) ; } else { for ( String match : commands . tailSet ( buffer ) ) { if ( ! match . startsWith ( buffer ) ) { break ; } candidates . add ( match ) ; } } if ( candidates . size ( ) == 1 ) { candidates . set ( 0 , candidates . get ( 0 ) + " " ) ; } return candidates . isEmpty ( ) ? - 1 : 0 ;


signature:
public class ResourceContextConfig { /** * 选择某类别的默认名称资源 。
 * @ param catalog
 * 类别
 * @ return 资源选择 */
public ResourceSelection getSelection ( final String catalog ) { } }

implementation: checkReload ( ) ; Set < ResourceSelection > result = set . getSelections ( catalog ) ; return Iterables . getFirst ( result , null ) ;


signature:
public class ResourceContextConfig { /** * 检查本配置与另一配置包含资源仓库选择的差异 。
 * @ param target
 * 另一配置
 * @ return 差异集合 */
public Set < ResourceSelection > checkDiff ( final ResourceContextConfig target ) { } }

implementation: checkReload ( ) ; return set . checkDiff ( target . set ) ;


signature:
public class ResourceSelectionSet { /** * 汇总得到所有资源仓库选择的类别信息 。
 * @ return 类别名称集合 */
public Set < String > catalogNames ( ) { } }

implementation: Set < String > catalogs = new HashSet < > ( ) ; for ( ResourceSelection selection : selections ) { catalogs . add ( selection . getCatalog ( ) ) ; } return catalogs ;


signature:
public class ResourceSelectionSet { /** * 根据类别名称获取集合中包含的同一类别的资源名称 。
 * @ param catalog
 * 类别
 * @ return 资源名称集合 */
public Set < String > resourceNames ( final String catalog ) { } }

implementation: Set < String > resources = new HashSet < > ( ) ; for ( ResourceSelection selection : selections ) { if ( selection . getCatalog ( ) . equals ( catalog ) ) { resources . add ( selection . getName ( ) ) ; } } return resources ;


signature:
public class ResourceSelectionSet { /** * 选择某类别的默认名称资源 。
 * @ param catalog
 * 类别
 * @ return 资源选择 */
public Set < ResourceSelection > getSelections ( final String catalog ) { } }

implementation: return getSelections ( catalog , ResourceSelection . generateName ( catalog ) ) ;


signature:
public class ResourceSelectionSet { /** * 选择某类别的特定名称资源 。
 * @ param catalog
 * 类别
 * @ param name
 * 名称
 * @ return 资源选择 */
public Set < ResourceSelection > getSelections ( final String catalog , final String name ) { } }

implementation: Set < ResourceSelection > result = new HashSet < > ( ) ; for ( ResourceSelection selection : selections ) { if ( selection . getCatalog ( ) . equals ( catalog ) && selection . getName ( ) . equals ( name ) ) { result . add ( selection ) ; } } return result ;


signature:
public class ResourceSelectionSet { /** * 检查本集合与另一集合包含资源仓库选择的差异 。
 * @ param target
 * 另一集合
 * @ return 差异集合 */
public Set < ResourceSelection > checkDiff ( final ResourceSelectionSet target ) { } }

implementation:
// 更新信息列表
Set < ResourceSelection > diffs = new HashSet < > ( ) ; // 读取源版本
Set < ResourceSelection > sourceEntrys = selections ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "源版本：{}" , sourceEntrys ) ; } // 读取目标版本
Set < ResourceSelection > targetEntrys = target . selections ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "目标版本：{}" , targetEntrys ) ; } // 处理是否更新
diffs . addAll ( targetEntrys ) ; diffs . removeAll ( sourceEntrys ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "更新结果：{}" , diffs ) ; } return diffs ;


signature:
public class CodedMessageDefinition { /** * 获取编码消息定义 。
 * @ param code
 * 编码
 * @ return 编码消息定义 */
public static CodedMessageDefinition getDefinition ( final String code ) { } }

implementation: Map < Locale , CodedMessageDefinition > definitions = DEFINITIONS . get ( code ) ; if ( definitions == null ) { return null ; } CodedMessageDefinition definition = definitions . get ( Locales . current ( ) ) ; if ( definition == null ) { definition = definitions . get ( Locale . ROOT ) ; } return definition ;


signature:
public class CodedMessageDefinition { /** * 定义编码消息 。
 * @ param definition
 * 编码消息定义 */
public static void define ( final CodedMessageDefinition definition ) { } }

implementation: String code = definition . getCode ( ) ; Locale locale = definition . getLocale ( ) ; Map < Locale , CodedMessageDefinition > definitions = DEFINITIONS . get ( code ) ; if ( definitions == null ) { definitions = new HashMap < > ( ) ; DEFINITIONS . put ( code , definitions ) ; } definitions . put ( locale , definition ) ;


signature:
public class FilterBinder { /** * Builds a Filter Binder using a Filter instance rather than a class . It will use a
 * { @ link io . graceland . filter . FilterProvider } as the provider .
 * @ param binder The Binder for the current Guice module .
 * @ param filter The Filter to be bound .
 * @ return A working FilterBinder . */
public static FilterBinder forInstance ( Binder binder , Filter filter ) { } }

implementation: Preconditions . checkNotNull ( filter , "Filter cannot be null." ) ; return new FilterBinder ( binder , filter . getClass ( ) , new FilterProvider ( filter ) ) ;


signature:
public class FilterBinder { /** * Builds a Filter Binder using a Filter Class rather than an instance . It will use the { @ link com . google . inject . Binder }
 * to create a { @ link com . google . inject . Provider } used in the Filter Binder .
 * @ param binder The Binder for the current Guice module .
 * @ param filterClass The Class of a Filter to be bound .
 * @ return A working FilterBinder . */
public static FilterBinder forClass ( Binder binder , Class < ? extends Filter > filterClass ) { } }

implementation: Preconditions . checkNotNull ( binder , "Binder cannot be null." ) ; Preconditions . checkNotNull ( filterClass , "Filter Class cannot be null." ) ; return new FilterBinder ( binder , filterClass , binder . getProvider ( filterClass ) ) ;


signature:
public class FilterBinder { /** * Adds a { @ link io . graceland . filter . FilterPattern } to the final filter . You can add more than one with the binder .
 * @ param filterPattern The filter pattern to add .
 * @ return The current Filter Binder . */
public FilterBinder addPattern ( FilterPattern filterPattern ) { } }

implementation: Preconditions . checkNotNull ( filterPattern , "Filter Pattern cannot be null." ) ; filterPatterns . add ( filterPattern ) ; return this ;


signature:
public class FilterBinder { /** * Builds a { @ link io . graceland . filter . FilterSpec } and adds it to the Guice dependency graph . */
public void bind ( ) { } }

implementation: FilterSpec fitlerSpec = new FilterSpec ( filterProvider , priority , name . or ( filterClass . getSimpleName ( ) ) , buildPatterns ( ) ) ; Multibinder . newSetBinder ( binder , FilterSpec . class , Graceland . class ) . addBinding ( ) . toInstance ( fitlerSpec ) ;


signature:
public class AbstractPlugin { /** * Add a resource to the graceland platform .
 * There are two ways of adding a resource :
 * < ul >
 * < li > < strong > Instance < / strong > - bind an instance of a resource directly . < / li >
 * < li > < strong > Class < / strong > - bind a class of a resource , and it will be built by the { @ link com . google . inject . Injector } . < / li >
 * < / ul >
 * @ param resource The resource to add , either a { @ link java . lang . Class } or an instance . */
protected void bindJerseyComponent ( Object resource ) { } }

implementation: Preconditions . checkNotNull ( resource , "Resource cannot be null." ) ; buildBinders ( ) ; jerseyBinder . addBinding ( ) . toInstance ( resource ) ;


signature:
public class ResourceRepository { /** * 定位资源 。
 * @ param selection
 * 资源仓库选择
 * @ return 资源 */
public Resource getResource ( final ResourceSelection selection ) { } }

implementation: if ( LOG . isTraceEnabled ( ) ) { LOG . trace ( "定位资源：{}" , selection ) ; } String catalog = selection . getCatalog ( ) ; String version = selection . getVersion ( ) ; String name = selection . getName ( ) ; String path = catalog ; if ( StringUtils . isNotBlank ( version ) ) { path = path + '/' + version ; } while ( true ) { try { Resource resource = root . createRelative ( path + '/' + name ) ; if ( resource . exists ( ) ) { if ( LOG . isTraceEnabled ( ) ) { LOG . trace ( "定位资源到：{}" , resource ) ; } return resource ; } } catch ( IOException e ) { LOG . warn ( root . toString ( ) + '/' + path + '/' + name + " 解析失败" , e ) ; return null ; } if ( path . length ( ) <= catalog . length ( ) ) { break ; } path = path . substring ( 0 , path . lastIndexOf ( '/' ) ) ; } if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "未找到资源：{}" , selection ) ; } return null ;


signature:
public class CodedMessage { /** * 判断消息中是否包含指定级别的消息 。
 * @ param targetLevel
 * 目标级别
 * @ return true 包含 */
public boolean hasLevel ( final CodedMessageLevel targetLevel ) { } }

implementation: if ( level == targetLevel ) { return true ; } for ( CodedMessage message : messages ) { if ( message . hasLevel ( targetLevel ) ) { return true ; } } return false ;


signature:
public class CodedMessage { /** * 将消息格式化为字符串 。 */
private void format ( final StringBuilder sb ) { } }

implementation: CodedMessageDefinition def = CodedMessageDefinition . getDefinition ( code ) ; if ( def == null ) { sb . append ( MessageFormats . formatFallback ( code , arguments . toArray ( ) ) ) ; } else { sb . append ( MessageFormats . format ( def . getTemplate ( ) , def . getLocale ( ) , arguments . toArray ( ) ) ) ; } for ( String unformattedArgument : unformattedArguments ) { sb . append ( '，' ) ; sb . append ( unformattedArgument ) ; }


signature:
public class CodedMessage { /** * 将所有消息格式化为字符串 。
 * @ return 消息字符串 */
public String formatAll ( ) { } }

implementation: StringBuilder sb = new StringBuilder ( ) ; formatAll ( sb , 0 ) ; sb . deleteCharAt ( sb . length ( ) - 1 ) ; return sb . toString ( ) ;


signature:
public class CodedMessage { /** * 将所有消息格式化为字符串 。 */
private void formatAll ( final StringBuilder sb , final int depth ) { } }

implementation: for ( int i = 0 ; i < depth ; i ++ ) { sb . append ( '\t' ) ; } format ( sb ) ; sb . append ( '\n' ) ; for ( CodedMessage message : messages ) { message . formatAll ( sb , depth + 1 ) ; }


signature:
public class DistrictClass { /** * List districts for state .
 * @ param state
 * @ return { @ link Districts } */
public Districts searchByState ( String state ) throws OpenStatesException { } }

implementation: return api . query ( new MethodMap ( "districts" , state ) , null , Districts . class ) ;


signature:
public class DistrictClass { /** * List districts for state and chamber .
 * @ param state
 * @ param chamber
 * @ return { @ link Districts } */
public Districts search ( String state , String chamber ) throws OpenStatesException { } }

implementation: return api . query ( new MethodMap ( "districts" , state , chamber ) , null , Districts . class ) ;


signature:
public class DistrictClass { /** * Get geographic boundary for a district .
 * @ param boundary _ id
 * @ return { @ link District } */
public District boundaryLookup ( String boundary_id ) throws OpenStatesException { } }

implementation: return api . query ( new MethodMap ( "districts" , "boundary" , boundary_id ) , null , District . class ) ;


signature:
public class MetadataClass { /** * Get detailed metadata for a particular state .
 * @ param state
 * @ return { @ link Metadata } */
public Metadata state ( String state ) throws OpenStatesException { } }

implementation: return api . query ( new MethodMap ( "metadata" , state ) , null , Metadata . class ) ;


signature:
public class MBeanUtility { /** * Create the MBean object .
 * @ param interfaceClass the MBean interface class .
 * @ return the MBean object . */
private static < T > T createObject ( Class < T > interfaceClass ) { } }

implementation:
ServiceLoader < T > loader = ServiceLoader . load ( interfaceClass ) ; T object = null ; // Loop through the services .
for ( T loadedObject : loader ) { // Check if a factory has not been found .
if ( object == null ) { // Set the factory .
object = loadedObject ; } else { throw new IllegalArgumentException ( "More than one MBean object found." ) ; } } // Check if a object has not been found .
if ( object == null ) { throw new IllegalArgumentException ( "No MBean object found." ) ; } return object ;


signature:
public class MBeanUtility { /** * Get the MBean represented by the interface class . The object name is
 * set to the object name returned by the getObjectName ( Class interfaceClass ) method .
 * @ param interfaceClass the MBean interface class .
 * @ return the MBean .
 * @ throws MBeanException if unable to get the MBean . */
public static < T > T getMBean ( Class < T > interfaceClass ) throws MBeanException { } }

implementation: return getMBean ( interfaceClass , getObjectName ( interfaceClass ) ) ;


signature:
public class MBeanUtility { /** * Get the MBean represented by the interface class and object name .
 * @ param interfaceClass the MBean interface class .
 * @ param objectName the MBean object name .
 * @ return the MBean .
 * @ throws MBeanException if unable to get the MBean . */
public static < T > T getMBean ( Class < T > interfaceClass , ObjectName objectName ) throws MBeanException { } }

implementation:
// Get the MBean server .
MBeanServer mBeanServer = ManagementFactory . getPlatformMBeanServer ( ) ; validateMBean ( interfaceClass , objectName , mBeanServer ) ; // Create the MBean .
return JMX . newMXBeanProxy ( mBeanServer , objectName , interfaceClass ) ;


signature:
public class MBeanUtility { /** * Get the MBean represented by the interface class . The object name is
 * set to the object name returned by the getObjectName ( Class interfaceClass ) method .
 * @ param interfaceClass the MBean interface class .
 * @ param environment the JMX environment properties .
 * @ return the MBean .
 * @ throws MBeanException if unable to get the MBean . */
public static < T > T getMBean ( Class < T > interfaceClass , Properties environment ) throws MBeanException { } }

implementation: return getMBean ( interfaceClass , getObjectName ( interfaceClass ) , environment ) ;


signature:
public class MBeanUtility { /** * Get the MBean represented by the interface class and object name .
 * @ param interfaceClass the MBean interface class .
 * @ param objectName the MBean object name .
 * @ param environment the JMX environment properties .
 * @ return the MBean .
 * @ throws MBeanException if unable to get the MBean . */
public static < T > T getMBean ( Class < T > interfaceClass , ObjectName objectName , Properties environment ) throws MBeanException { } }

implementation: return RemoteMBeanInvocationHandler . getMBean ( interfaceClass , objectName , environment ) ;


signature:
public class MBeanUtility { /** * Get the MBean object name .
 * @ param interfaceClass the MBean interface class .
 * @ param key the property key .
 * @ param value the property value .
 * @ return the MBean object name .
 * @ throws IllegalArgumentException if the interface class is invalid or
 * unable to get the MBean object name . */
public static ObjectName getObjectName ( Class interfaceClass , String key , String value ) { } }

implementation:
// Set the table .
Hashtable < String , String > table = new Hashtable < String , String > ( ) ; table . put ( key , value ) ; return getObjectName ( interfaceClass , table ) ;


signature:
public class MBeanUtility { /** * Get the MBean object name .
 * @ param interfaceClass the MBean interface class .
 * @ param table the properties table .
 * @ return the MBean object name .
 * @ throws IllegalArgumentException if the interface class is invalid or
 * unable to get the MBean object name . */
public static ObjectName getObjectName ( Class interfaceClass , Hashtable < String , String > table ) { } }

implementation:
// Check if the interface class is valid .
if ( interfaceClass == null ) { throw new IllegalArgumentException ( "The interface class is invalid." ) ; } ObjectName objectName ; try { // Check if the table is null .
if ( table == null ) { // Initialize the table .
table = new Hashtable < String , String > ( ) ; } // Add the " type " to the table .
table . put ( "type" , interfaceClass . getSimpleName ( ) ) ; // Get the MBean object name .
objectName = ObjectName . getInstance ( interfaceClass . getPackage ( ) . getName ( ) , table ) ; } catch ( MalformedObjectNameException e ) { throw new IllegalArgumentException ( "Unable to get the MBean object name for " + interfaceClass . getName ( ) + "." , e ) ; } return objectName ;


signature:
public class MBeanUtility { /** * Register the MBean represented by the interface class . The MBean object
 * name is set to the object name returned by the
 * getObjectName ( Class interfaceClass ) method .
 * @ param interfaceClass the MBean interface class .
 * @ return the MBean object name .
 * @ throws IllegalArgumentException if the interface class is invalid or
 * unable to get the MBean object name .
 * @ throws MBeanException if unable to register the MBean . */
public static < T > ObjectName register ( Class < T > interfaceClass ) throws MBeanException { } }

implementation: return register ( interfaceClass , getObjectName ( interfaceClass ) ) ;


signature:
public class MBeanUtility { /** * Register the MBean represented by the interface class . The MBean object
 * name is set to the object name returned by the
 * getObjectName ( Class interfaceClass , String key , String value ) method .
 * @ param interfaceClass the MBean interface class .
 * @ param key the property key .
 * @ param value the property value .
 * @ return the MBean object name .
 * @ throws IllegalArgumentException if the interface class is invalid or
 * unable to get the MBean object name .
 * @ throws MBeanException if unable to register the MBean . */
public static < T > ObjectName register ( Class < T > interfaceClass , String key , String value ) throws MBeanException { } }

implementation: return register ( interfaceClass , getObjectName ( interfaceClass , key , value ) ) ;


signature:
public class MBeanUtility { /** * Register the MBean represented by the interface class . The MBean object
 * name is set to the object name returned by the
 * getObjectName ( Class interfaceClass , Hashtable < String , String > table )
 * method .
 * @ param interfaceClass the MBean interface class .
 * @ param table the properties table .
 * @ return the MBean object name .
 * @ throws IllegalArgumentException if the interface class is invalid or
 * unable to get the MBean object name .
 * @ throws MBeanException if unable to register the MBean . */
public static < T > ObjectName register ( Class < T > interfaceClass , Hashtable < String , String > table ) throws MBeanException { } }

implementation: return register ( interfaceClass , getObjectName ( interfaceClass , table ) ) ;


signature:
public class MBeanUtility { /** * Register the MBean represented by the interface class .
 * @ param interfaceClass the MBean interface class .
 * @ param objectName the MBean object name .
 * @ return the MBean object name .
 * @ throws IllegalArgumentException if the interface class is invalid .
 * @ throws MBeanException if unable to register the MBean . */
public static < T > ObjectName register ( Class < T > interfaceClass , ObjectName objectName ) throws MBeanException { } }

implementation:
// Check if the interface class is valid .
if ( interfaceClass == null ) { throw new IllegalArgumentException ( "The interface class is invalid." ) ; } try { // Get the MBean server .
MBeanServer mBeanServer = ManagementFactory . getPlatformMBeanServer ( ) ; // Check if the MBean is not registered with the MBean server .
if ( ! mBeanServer . isRegistered ( objectName ) ) { // Register the MBean with the MBean server .
ObjectInstance objectInstance = mBeanServer . registerMBean ( createObject ( interfaceClass ) , objectName ) ; // Get the object name for the registered MBean .
objectName = objectInstance . getObjectName ( ) ; } } catch ( Exception e ) { throw new MBeanException ( e , "Unable to register the MBean." ) ; } return objectName ;


signature:
public class MBeanUtility { /** * Unregister the MBean represented by the object name .
 * @ param objectName the MBean object name .
 * @ throws MBeanException if unable to unregister the MBean . */
public static void unregister ( ObjectName objectName ) throws MBeanException { } }

implementation:
try { // Get the MBean server .
MBeanServer mBeanServer = ManagementFactory . getPlatformMBeanServer ( ) ; // Check if the MBean is registered with the MBean server .
if ( mBeanServer . isRegistered ( objectName ) ) { // Unregister the MBean with the MBean server .
mBeanServer . unregisterMBean ( objectName ) ; } } catch ( Exception e ) { throw new MBeanException ( e , "Unable to unregister the MBean " + objectName . getCanonicalName ( ) + "." ) ; }


signature:
public class MBeanUtility { /** * Validate the MBean represented by the interface class and object name .
 * @ param interfaceClass the MBean interface class .
 * @ param objectName the MBean object name .
 * @ param mBeanServerConnection the MBean server connection .
 * @ throws IllegalArgumentException if the MBean is invalid .
 * @ throws IOException if unable to validate the MBean . */
protected static void validateMBean ( Class interfaceClass , ObjectName objectName , MBeanServerConnection mBeanServerConnection ) throws MBeanException { } }

implementation:
try { // Check if the interface class is null .
if ( interfaceClass == null ) { throw new IllegalArgumentException ( "The interface class is null." ) ; } // Check if the interface class is not a MXBean interface .
if ( ! JMX . isMXBeanInterface ( interfaceClass ) ) { throw new IllegalArgumentException ( "The interface class " + interfaceClass . getName ( ) + " is not a MXBean interface." ) ; } // Check if the object name is not registered .
if ( ! mBeanServerConnection . isRegistered ( objectName ) ) { throw new IllegalArgumentException ( "The object name " + objectName . getCanonicalName ( ) + " is not registered." ) ; } // Check if the object name is not an instance of the interface class .
if ( ! mBeanServerConnection . isInstanceOf ( objectName , interfaceClass . getName ( ) ) ) { throw new IllegalArgumentException ( "The object name " + objectName . getCanonicalName ( ) + " is not an instance of the interface class " + interfaceClass . getName ( ) + "." ) ; } } catch ( InstanceNotFoundException e ) { throw new IllegalArgumentException ( "The object name " + objectName . getCanonicalName ( ) + " is not found." ) ; } catch ( IOException e ) { throw new MBeanException ( e , "Unable to validate the MBean represented by the interface class " + interfaceClass . getName ( ) + " and object name " + objectName . getCanonicalName ( ) + "." ) ; }


signature:
public class Platform { /** * Ran when the Dropwizard service initializes . This method is responsible for setting up the
 * { @ link io . dropwizard . Bundle } s and { @ link io . dropwizard . cli . Command } s .
 * @ param bootstrap Provided by Dropwizard . */
@ Override public void initialize ( Bootstrap < PlatformConfiguration > bootstrap ) { } }

implementation: for ( Initializer initializer : wrapper . getInitializers ( ) ) { initializer . initialize ( bootstrap ) ; LOGGER . debug ( "Registered Initializer: {}" , initializer . getClass ( ) . getCanonicalName ( ) ) ; } for ( Bundle bundle : wrapper . getBundles ( ) ) { bootstrap . addBundle ( bundle ) ; LOGGER . debug ( "Registered Bundle: {}" , bundle . getClass ( ) . getCanonicalName ( ) ) ; } for ( Command command : wrapper . getCommands ( ) ) { bootstrap . addCommand ( command ) ; LOGGER . debug ( "Registered Command: {}" , command . getClass ( ) . getCanonicalName ( ) ) ; }


signature:
public class Platform { /** * Ran when the Dropwizard service starts up . This method is responsible for setting up the
 * { @ link io . dropwizard . setup . Environment } using the bindings from the loaded
 * { @ link io . graceland . plugin . Plugin } s .
 * @ param configuration Provided by Dropwizard .
 * @ param environment Provided by Dropwizard .
 * @ throws Exception Thrown by Dropwizard . */
@ Override public void run ( PlatformConfiguration configuration , Environment environment ) throws Exception { } }

implementation: dropwizardModule . setup ( configuration , environment ) ; for ( Configurator configurator : wrapper . getConfigurators ( ) ) { configurator . configure ( configuration , environment ) ; LOGGER . debug ( "Registered Configurator: {}" , configurator . getClass ( ) . getCanonicalName ( ) ) ; } for ( Object jerseyComponent : wrapper . getJerseyComponents ( ) ) { environment . jersey ( ) . register ( jerseyComponent ) ; LOGGER . debug ( "Registered Jersey Component: {}" , jerseyComponent . getClass ( ) . getCanonicalName ( ) ) ; } for ( Managed managed : wrapper . getManaged ( ) ) { environment . lifecycle ( ) . manage ( managed ) ; LOGGER . debug ( "Registered Managed Object: {}" , managed . getClass ( ) . getCanonicalName ( ) ) ; } for ( HealthCheck healthCheck : wrapper . getHealthChecks ( ) ) { environment . healthChecks ( ) . register ( healthCheck . toString ( ) , healthCheck ) ; LOGGER . debug ( "Registered Health Check: {}" , healthCheck . getClass ( ) . getCanonicalName ( ) ) ; } for ( Task task : wrapper . getTasks ( ) ) { environment . admin ( ) . addTask ( task ) ; LOGGER . debug ( "Registered Task: {}" , task . getClass ( ) . getCanonicalName ( ) ) ; } for ( FilterSpec filterSpec : wrapper . getFilterSpecs ( ) ) { registerFilterSpec ( environment , filterSpec ) ; LOGGER . debug ( "Registered Filter {}: {}" , filterSpec . getName ( ) , filterSpec . getFilter ( ) . getClass ( ) . getCanonicalName ( ) ) ; }


signature:
public class UUIDPathMinter { /** * Mint a unique identifier as a UUID
 * @ return uuid */
@ Override public String get ( ) { } }

implementation: try ( final Timer . Context context = timer . time ( ) ) { final String s = randomUUID ( ) . toString ( ) ; if ( length == 0 || count == 0 ) { return s ; } final StringJoiner joiner = new StringJoiner ( "/" , "" , "/" + s ) ; IntStream . rangeClosed ( 0 , count - 1 ) . forEach ( x -> joiner . add ( s . substring ( x * length , ( x + 1 ) * length ) ) ) ; return joiner . toString ( ) ; }


signature:
public class CodedMessageDefinitionLoader { /** * 加载所有匹配的配置文件 。
 * @ param resolver
 * 资源加载策略
 * @ param locationPattern
 * 匹配模式 */
public static void loadDefinitions ( final ResourcePatternResolver resolver , final String locationPattern ) { } }

implementation: try { Resource [ ] resources = resolver . getResources ( locationPattern ) ; for ( Resource resource : resources ) { String filename = resource . getFilename ( ) ; Locale locale = Locale . ROOT ; String filenamePrefix = "codedMessageDefinition_" ; if ( filename . startsWith ( filenamePrefix ) ) { locale = LocaleUtils . toLocale ( filename . substring ( filenamePrefix . length ( ) , filename . lastIndexOf ( ".xml" ) ) ) ; } loadDefinitions ( locale , resource ) ; } } catch ( IOException e ) { LOG . error ( "加载失败" , e ) ; }


signature:
public class CodedMessageDefinitionLoader { /** * 从特定位置加载配置文件 。
 * @ param locale
 * 区域
 * @ param resource
 * 配置文件位置 */
public static void loadDefinitions ( final Locale locale , final Resource resource ) { } }

implementation: try { XMLConfiguration config = new XMLConfiguration ( ) ; config . setDelimiterParsingDisabled ( true ) ; config . load ( resource . getInputStream ( ) ) ; for ( HierarchicalConfiguration definitionConfig : config . configurationsAt ( "definition" ) ) { String code = definitionConfig . getString ( "[@code]" ) ; String template = definitionConfig . getString ( "[@template]" ) ; CodedMessageDefinition . define ( new CodedMessageDefinition ( code , locale , template ) ) ; } } catch ( IOException e ) { LOG . error ( "加载失败" , e ) ; } catch ( ConfigurationException e ) { LOG . error ( "加载失败" , e ) ; }


signature: public class InjectorWrapper { private < T > Set < T > getSetSafely ( Key < Set < T > > key ) { } }

implementation: try { return injector . getInstance ( key ) ; } catch ( ConfigurationException e ) { LOGGER . debug ( "No bindings found for key: {}" , key , e ) ; return ImmutableSet . of ( ) ; }


signature:
public class InjectorWrapper { /** * Returns a Set of Jersey components , including Providers and Resources . These objects are usually fed into the
 * { @ link io . dropwizard . jersey . setup . JerseyEnvironment # register ( Class ) } method .
 * @ return An immutable set of Jersey components . */
@ SuppressWarnings ( "unchecked" ) public ImmutableSet < Object > getJerseyComponents ( ) { } }

implementation: Set < Object > components = getSetSafely ( Keys . JerseyComponents ) ; ImmutableSet . Builder < Object > builder = ImmutableSet . builder ( ) ; for ( Object classOrInstance : components ) { if ( classOrInstance instanceof Class ) { Object instance = injector . getInstance ( ( Class < Object > ) classOrInstance ) ; builder . add ( instance ) ; } else { builder . add ( classOrInstance ) ; } } return builder . build ( ) ;


signature:
public class ParameterDescription { /** * Add the specified value to the field . First , validate the value if a
 * validator was specified . Then look up any field converter , then any type
 * converter , and if we can ' t find any , throw an exception . */
public void addValue ( String value , boolean isDefault ) { } }

implementation:
p ( "Adding " + ( isDefault ? "default " : "" ) + "value:" + value + " to parameter:" + m_field . getName ( ) ) ; String name = m_wrappedParameter . names ( ) [ 0 ] ; if ( m_assigned && ! isMultiOption ( ) ) { throw new ParameterException ( "Can only specify option " + name + " once." ) ; } validateParameter ( name , value ) ; Class < ? > type = m_field . getType ( ) ; Object convertedValue = m_jCommander . convertValue ( this , value ) ; boolean isCollection = Collection . class . isAssignableFrom ( type ) ; try { if ( isCollection ) { @ SuppressWarnings ( "unchecked" ) Collection < Object > l = ( Collection < Object > ) m_field . get ( m_object ) ; if ( l == null || fieldIsSetForTheFirstTime ( isDefault ) ) { l = newCollection ( type ) ; m_field . set ( m_object , l ) ; } if ( convertedValue instanceof Collection ) { l . addAll ( ( Collection ) convertedValue ) ; } else { // if ( isMainParameter | | m _ parameterAnnotation . arity ( ) > 1 ) {
l . add ( convertedValue ) ; // } else {
} } else { m_wrappedParameter . addValue ( m_field , m_object , convertedValue ) ; } if ( ! isDefault ) m_assigned = true ; } catch ( IllegalAccessException ex ) { ex . printStackTrace ( ) ; }


signature:
public class ClassResolver { /** * Resolves the { @ code Class } es that matches to the specified { @ code Matcher } .
 * @ param matcher { @ code Matcher } .
 * @ return { @ code Class } es that matches to the specified { @ code Matcher } .
 * @ throws IOException If any I / O access fails while traversing the search
 * path . */
public Set < T > resolve ( Matcher < T > matcher ) throws IOException { } }

implementation:
Set < T > classes = new HashSet < T > ( ) ; for ( URL url : paths ) { if ( url . toString ( ) . endsWith ( ".jar" ) ) { // System . out . println ( url ) ;
JarFile jarFile = new JarFile ( URLDecoder . decode ( url . getPath ( ) , "UTF-8" ) ) ; Manifest manifest = jarFile . getManifest ( ) ; if ( manifest != null ) { // System . out . println ( manifest ) ;
Attributes mainAttributes = manifest . getMainAttributes ( ) ; if ( mainAttributes != null ) { // System . out . println ( mainAttributes ) ;
String classpath = mainAttributes . getValue ( Name . CLASS_PATH ) ; if ( classpath != null ) { // System . out . println ( classpath ) ;
StringTokenizer stringTokenizer = new StringTokenizer ( classpath ) ; while ( stringTokenizer . hasMoreTokens ( ) ) { String token = stringTokenizer . nextToken ( ) ; URL entry = new URL ( url , token ) ; if ( entry . toString ( ) . endsWith ( "/" ) ) { // System . out . println ( entry ) ;
classes . addAll ( getMatchedClasses ( matcher , new File ( URLDecoder . decode ( entry . getPath ( ) , "UTF-8" ) ) ) ) ; } else { // System . out . println ( entry ) ;
classes . addAll ( getMatchedClasses ( matcher , new JarFile ( URLDecoder . decode ( entry . getPath ( ) , "UTF-8" ) ) ) ) ; } } } } } classes . addAll ( getMatchedClasses ( matcher , jarFile ) ) ; } else { File base = new File ( URLDecoder . decode ( url . getPath ( ) , "UTF-8" ) ) ; classes . addAll ( getMatchedClasses ( matcher , base ) ) ; } } return classes ;


signature:
public class BillClass { /** * Bill Search
 * This method returns just a subset of the bill fields by default .
 * NOTE : * * * This method never uses the cache . Use with caution . * * *
 * Filter Parameters
 * The following parameters filter the returned set of bills , at least one must be provided .
 * Use null for any parameter that is not used .
 * @ param state - Only return bills from a given state ( e . g . ' nc ' )
 * @ param updated _ since - Only bills updated since a provided date ( provided in YYYY - MM - DD format )
 * The API will not return exceedingly large responses , so it may be
 * necessary to use page and per _ page to control the number of results returned :
 * @ param page - Page of results , each of size per _ page ( defaults to 1)
 * @ param per _ page - Number of results per page , is unlimited unless page is set , in which case it defaults to 50.
 * @ return { @ link Bills } */
public Bills searchByDate ( String state , String updated_since , String page , String per_page ) throws OpenStatesException { } }

implementation: OpenStates . suspendCache ( ) ; Bills bills = api . query ( new MethodMap ( "bills" ) , new ArgMap ( "state" , state , "updated_since" , updated_since , "page" , page , "per_page" , per_page ) , Bills . class ) ; return bills ;


signature:
public class BillClass { /** * Bill Search
 * This method returns just a subset of the bill fields by default .
 * NOTE : * * * This method never uses the cache . Use with caution . * * *
 * Filter Parameters
 * The following parameters filter the returned set of bills , at least one must be provided .
 * Use null for any parameter that is not used .
 * @ param state - Only return bills from a given state ( e . g . ' nc ' )
 * @ param search _ window By default all bills are searched ,
 * but if a time window is desired the
 * following options can be passed to search _ window :
 * all - Default , include all sessions .
 * term - Only bills from sessions within the current term .
 * session - Only bills from the current session .
 * session : 2009 - Only bills from the session named 2009.
 * term : 2009-2011 - Only bills from the sessions in the 2009-2011 session .
 * The API will not return exceedingly large responses , so it may be
 * necessary to use page and per _ page to control the number of results returned :
 * @ param page - Page of results , each of size per _ page ( defaults to 1)
 * @ param per _ page - Number of results per page , is unlimited unless page is set , in which case it defaults to 50.
 * @ return { @ link Bills } */
public Bills searchByWindow ( String state , String search_window , String page , String per_page ) throws OpenStatesException { } }

implementation: OpenStates . suspendCache ( ) ; Bills bills = api . query ( new MethodMap ( "bills" ) , new ArgMap ( "state" , state , "search_window" , search_window , "page" , page , "per_page" , per_page ) , Bills . class ) ; return bills ;


signature:
public class BillClass { /** * Bill Search
 * This method returns just a subset of the bill fields by default .
 * NOTE : * * * This method never uses the cache . Use with caution . * * *
 * Filter Parameters
 * The following parameters filter the returned set of bills , at least one must be provided .
 * Use null for any parameter that is not used .
 * @ param state - Only return bills from a given state ( e . g . ' nc ' )
 * @ param chamber - Only return bills matching the provided chamber ( ' upper ' or ' lower ' )
 * @ param bill _ id - Only return bills with a given bill _ id .
 * @ param bill _ id _ _ in - Accepts a pipe ( | ) delimited list of bill ids .
 * @ param q Only return bills matching the provided full text query .
 * @ param search _ window By default all bills are searched ,
 * but if a time window is desired the
 * following options can be passed to search _ window :
 * all - Default , include all sessions .
 * term - Only bills from sessions within the current term .
 * session - Only bills from the current session .
 * session : 2009 - Only bills from the session named 2009.
 * term : 2009-2011 - Only bills from the sessions in the 2009-2011 session .
 * @ param updated _ since - Only bills updated since a provided date ( provided in YYYY - MM - DD format )
 * @ param sponsor _ id - Only bills sponsored by a given legislator id ( e . g . ' ILL000555 ' )
 * @ param subject - Only bills categorized by Open States as belonging to this subject .
 * @ param type - Only bills of a given type ( e . g . ' bill ' , ' resolution ' , etc . )
 * Additional Parameters
 * @ param sort - Sort - order of results , defaults to ' last ' , options are :
 * ' first ' , ' last ' , ' signed ' , ' passed _ lower ' , ' passed _ upper ' , ' updated _ at ' , ' created _ at ' .
 * See the above action _ dates , created _ at , and updated _ at documentation for the meaning of these dates .
 * The API will not return exceedingly large responses , so it may be
 * necessary to use page and per _ page to control the number of results returned :
 * @ param page - Page of results , each of size per _ page ( defaults to 1)
 * @ param per _ page - Number of results per page , is unlimited unless page is set , in which case it defaults to 50.
 * @ return { @ link Bills } */
public Bills search ( String state , String chamber , String bill_id , String bill_id__in , String q , String search_window , String updated_since , String sponsor_id , String subject , String type , String sort , String page , String per_page ) throws OpenStatesException { } }

implementation: OpenStates . suspendCache ( ) ; Bills bills = api . query ( new MethodMap ( "bills" ) , new ArgMap ( "state" , state , "chamber" , chamber , "bill_id" , bill_id , "bill_id__in" , bill_id__in , "q" , q , "search_window" , search_window , "updated_since" , updated_since , "sponsor_id" , sponsor_id , "subject" , subject , "type" , type , "sort" , sort , "page" , page , "per_page" , per_page ) , Bills . class ) ; return bills ;


signature:
public class BillClass { /** * Bill Detail
 * This method returns the full detail object for a bill .
 * @ param state
 * @ param session
 * @ param number
 * @ return { @ link Bill } */
public Bill detail ( String state , String session , String number ) throws OpenStatesException { } }

implementation: return api . query ( new MethodMap ( "bills" , state , session , number ) , null , Bill . class ) ;


signature:
public class BillClass { /** * Bill Detail
 * This method returns the full detail object for a bill .
 * @ param bill _ id
 * @ return { @ link Bill } */
public Bill detailById ( String bill_id ) throws OpenStatesException { } }

implementation: return api . query ( new MethodMap ( "bills" , bill_id ) , null , Bill . class ) ;


signature:
public class LegislatorClass { /** * Get Legislators by State .
 * @ param state Filter by state .
 * @ return { @ link Legislators } */
public Legislators searchByState ( String state ) throws OpenStatesException { } }

implementation: return api . query ( new MethodMap ( "legislators" ) , new ArgMap ( "state" , state ) , Legislators . class ) ;


signature:
public class LegislatorClass { /** * Get Legislators by State and Active filters .
 * @ param state Filter by state .
 * @ param active ' true ' ( default ) to only include current legislators , ' false ' will include all legislators
 * @ return { @ link Legislators } */
public Legislators searchByStateActive ( String state , Boolean active ) throws OpenStatesException { } }

implementation: return api . query ( new MethodMap ( "legislators" ) , new ArgMap ( "state" , state , "active" , active . toString ( ) ) , Legislators . class ) ;


signature:
public class LegislatorClass { /** * Search for Legislators by State and Term .
 * @ param state Filter by state .
 * @ param term Only legislators that have a role in a certain term .
 * @ return { @ link Legislators } */
public Legislators searchByStateTerm ( String state , String term ) throws OpenStatesException { } }

implementation: return api . query ( new MethodMap ( "legislators" ) , new ArgMap ( "state" , state , "term" , term ) , Legislators . class ) ;


signature:
public class LegislatorClass { /** * This method allows looking up a legislator by a number of parameters , the results do not include the roles or old _ roles items by default .
 * Pass null for parameters that are not being filtered .
 * @ param state Filter by state .
 * @ param active ' true ' ( default ) to only include current legislators , ' false ' will include all legislators
 * @ param term Only legislators that have a role in a certain term .
 * @ param chamber Only legislators with a role in the specified chamber .
 * @ param district Only legislators that have represented the specified district .
 * @ param party Only legislators that have been associated with a specified party
 * @ param first _ name Filter by first name .
 * @ param last _ name Filter by last name . */
public Legislators search ( String state , Boolean active , String term , String chamber , String district , String party , String first_name , String last_name ) throws OpenStatesException { } }

implementation: return api . query ( new MethodMap ( "legislators" ) , new ArgMap ( "state" , state , "first_name" , first_name , "last_name" , last_name , "chamber" , chamber , "active" , active == null ? null : active . toString ( ) , "term" , term , "party" , party , "district" , district ) , Legislators . class ) ;


signature:
public class LegislatorClass { /** * This method returns the full detail for a legislator .
 * @ param id
 * @ return { @ link Legislator } */
public Legislator detail ( String id ) throws OpenStatesException { } }

implementation: return api . query ( new MethodMap ( "legislators" , id ) , null , Legislator . class ) ;


signature:
public class ResourceContext { /** * 定位资源 。
 * @ param catalog
 * 类别
 * @ return 资源 */
public Resource getResource ( final String catalog ) { } }

implementation: ResourceSelection selection = contextConfig . getSelection ( catalog ) ; if ( selection == null ) { return null ; } return repository . getResource ( selection ) ;


signature:
public class ResourceContext { /** * 定位资源 。
 * @ param selection
 * 资源选择
 * @ return 资源 */
public Resource getResource ( final ResourceSelection selection ) { } }

implementation: String catalog = selection . getCatalog ( ) ; String version = selection . getVersion ( ) ; String name = selection . getName ( ) ; if ( version == null ) { if ( name == null ) { return getResource ( catalog ) ; } else { return getResource ( catalog , name ) ; } } else { return repository . getResource ( selection ) ; }


signature:
public class GlobalSystemContext { /** * 获取系统环境的全局实例 , 如果不存在则建立默认的系统环境实例 。
 * @ param id
 * 系统环境 ID
 * @ return 系统环境的全局实例 */
public static SystemContext get ( final String id ) { } }

implementation: if ( ! GLOBAL_CONTEXTS . containsKey ( id ) ) { GLOBAL_CONTEXTS . putIfAbsent ( id , new DefaultSystemContext ( ) ) ; } return GLOBAL_CONTEXTS . get ( id ) ;


signature:
public class GlobalSystemContext { /** * 设置系统环境的全局实例 。
 * @ param id
 * 系统环境 ID
 * @ param context
 * 系统环境 */
public static void set ( final String id , final SystemContext context ) { } }

implementation: if ( context == null ) { GLOBAL_CONTEXTS . remove ( id ) ; } else { GLOBAL_CONTEXTS . put ( id , context ) ; }


signature:
public class HostAwareGraphiteReporterFactory { /** * Returns the prefix for the graphite reporter , formatting the prefix with the host name as input .
 * An example of this : < pre > prefix = cluster . % s . mycomponent < / pre >
 * Will give : < pre > cluster . localhost . mycomponent < / pre >
 * Where localhost is the host name .
 * It will also replace double dots { @ code . . } with a single dot { @ code . } .
 * @ return The prefix , with the host name appended . */
@ Override public String getPrefix ( ) { } }

implementation: String pattern = super . getPrefix ( ) ; String prefix = pattern . replace ( HOSTNAME_VARIABLE , hostName ) ; prefix = prefix . replace ( ".." , "." ) ; return prefix ;


signature:
public class TypesafeEnum { /** * Returns the instance set of the specified { @ code TypesafeEnum } class .
 * @ param clazz { @ code TypesafeEnum } class .
 * @ return The instance set of the specified { @ code TypesafeEnum } class . */
@ SuppressWarnings ( "unchecked" ) public static < T extends TypesafeEnum < T > > Set < T > values ( Class < T > clazz ) { } }

implementation: Set < T > set = new HashSet < T > ( ) ; if ( constants . containsKey ( clazz ) ) { set . addAll ( ( Set < T > ) constants . get ( clazz ) ) ; } return set ;


signature:
public class TypesafeEnum { /** * Compares with the specified object by ordinal .
 * @ param o The object to be compared .
 * @ return < code > 0 < / code > If this object is the same ordinal to the
 * specified object . */
public int compareTo ( E o ) { } }

implementation: if ( o . getClass ( ) != getClass ( ) ) { throw new ClassCastException ( ) ; } return ordinal - TypesafeEnum . class . cast ( o ) . ordinal ;


signature:
public class DtoRowMapper { /** * Set the class that each row should be mapped to . */
public void setMappedClass ( Class < T > mappedClass ) { } }

implementation: if ( this . mappedClass == null ) { initialize ( mappedClass ) ; } else { if ( ! this . mappedClass . equals ( mappedClass ) ) { throw new InvalidDataAccessApiUsageException ( "The mapped class can not be reassigned to map to " + mappedClass + " since it is already providing mapping for " + this . mappedClass ) ; } }


signature:
public class DtoRowMapper { /** * Initialize the mapping metadata for the given class .
 * @ param mappedClass the mapped class . */
protected void initialize ( Class < T > mappedClass ) { } }

implementation:
this . mappedClass = mappedClass ; this . mappedFields = new HashMap < String , Field > ( ) ; this . mappedProperties = new HashSet < String > ( ) ; Field fields [ ] = mappedClass . getFields ( ) ; for ( Field field : fields ) { int mod = field . getModifiers ( ) ; if ( Modifier . isPublic ( mod ) && ! Modifier . isStatic ( mod ) ) { String fieldNameV1 = field . getName ( ) . toLowerCase ( ) ; String fieldNameV2 = underscoreName ( field . getName ( ) ) ; String fieldNameV3 = underscoreNameR ( field . getName ( ) ) ; this . mappedFields . put ( fieldNameV1 , field ) ; if ( ! fieldNameV2 . equals ( fieldNameV1 ) ) { this . mappedFields . put ( fieldNameV2 , field ) ; } if ( ! fieldNameV3 . equals ( fieldNameV1 ) && ! fieldNameV3 . equals ( fieldNameV2 ) ) { this . mappedFields . put ( fieldNameV3 , field ) ; } this . mappedProperties . add ( fieldNameV2 ) ; /* this . mappedFields . put ( field . getName ( ) . toLowerCase ( ) , field ) ;
 String underscoredName = underscoreName ( field . getName ( ) ) ;
 if ( ! field . getName ( ) . toLowerCase ( ) . equals ( underscoredName ) ) {
 this . mappedFields . put ( underscoredName , field ) ;
 this . mappedProperties . add ( underscoredName ) ; */
} }


signature:
public class DtoRowMapper { /** * Retrieve a JDBC object value for the specified column .
 * < p > The default implementation calls
 * { @ link JdbcUtils # getResultSetValue ( java . sql . ResultSet , int , Class ) } .
 * Subclasses may override this to check specific value types upfront ,
 * or to post - process values return from < code > getResultSetValue < / code > .
 * @ param rs is the ResultSet holding the data
 * @ param index is the column index
 * @ param pd the bean property that each result object is expected to match
 * ( or < code > null < / code > if none specified )
 * @ return the Object value
 * @ throws SQLException in case of extraction failure
 * @ see org . springframework . jdbc . support . JdbcUtils # getResultSetValue ( java . sql . ResultSet , int , Class ) */
protected Object getColumnValue ( ResultSet rs , int index , Field field ) throws SQLException { } }

implementation: Object value = JdbcUtils . getResultSetValue ( rs , index , field . getType ( ) ) ; if ( value != null && value instanceof String && autoTrimStrings ) { return ( ( String ) value ) . trim ( ) ; } return value ;


signature:
public class DtoRowMapper { /** * Static factory method to update a new DtoRowMapper
 * ( with the mapped class specified only once ) .
 * @ param mappedClass the class that each row should be mapped to */
public static < T > DtoRowMapper < T > newInstance ( Class < T > mappedClass ) { } }

implementation: DtoRowMapper < T > newInstance = new DtoRowMapper < T > ( ) ; newInstance . setMappedClass ( mappedClass ) ; return newInstance ;


signature:
public class MethodInvocation { /** * Proceeds this method invocation .
 * @ return The result of this invocation proceeding .
 * @ throws Throwable If any exceptions occur while this method invocation is
 * proceeding . */
@ SuppressWarnings ( "unchecked" ) public R proceed ( ) throws Throwable { } }

implementation: try { return ( R ) method ( ) . invoke ( target , args ) ; } catch ( InvocationTargetException e ) { throw e . getTargetException ( ) ; }


signature:
public class Environment { /** * Returns the Java system property corresponding to the specified key ( If
 * the system property doesn ' t exist , this method returns the specified
 * default value ) .
 * @ param key The key of Java system property .
 * @ param def The default value that is returned if the system property
 * doesn ' t exist .
 * @ return The Java system property related to the specified key as
 * { @ code String } . If the Java system property doesn ' t exist , this method
 * returns the specified default value .
 * @ see System # getProperty ( String , String ) */
public static String getProperty ( String key , String def ) { } }

implementation: return System . getProperty ( key , def ) ;


signature:
public class Stopwatch { /** * Stops to measure .
 * @ return Elapsed time . */
public long stop ( ) { } }

implementation: if ( isRunning ( ) ) { stop = System . nanoTime ( ) ; total += stop - start ; running = false ; } return Math . round ( total * getPrecision ( ) . value ) ;


signature:
public class Stopwatch { /** * Returns the elapsed time with specified precision since this
 * { @ code Stopwatch } instance started to measure . The result is rounded to
 * long .
 * @ see Math # round ( double )
 * @ return The elapsed time with specified precision . */
public long getTime ( ) { } }

implementation: long time = ( isRunning ( ) ) ? total + System . nanoTime ( ) - start : total ; return Math . round ( time * getPrecision ( ) . value ) ;


signature:
public class EventClass { /** * Event Search
 * This method allows searching by state :
 * @ param state
 * @ return { @ link Events } */
public Events searchByState ( String state ) throws OpenStatesException { } }

implementation: return api . query ( new MethodMap ( "events" ) , new ArgMap ( "state" , state ) , Events . class ) ;


signature:
public class EventClass { /** * Event Search
 * This method allows searching by a number of fields :
 * @ param state
 * @ param type
 * @ return { @ link Events } */
public Events search ( String state , String type ) throws OpenStatesException { } }

implementation: return api . query ( new MethodMap ( "events" ) , new ArgMap ( "state" , state , "type" , type ) , Events . class ) ;


signature:
public class HttpPidMinter { /** * Setup authentication in httpclient .
 * @ return the setup of authentication */
protected HttpClient buildClient ( ) { } }

implementation: HttpClientBuilder builder = HttpClientBuilder . create ( ) . useSystemProperties ( ) . setConnectionManager ( connManager ) ; if ( ! isBlank ( username ) && ! isBlank ( password ) ) { final URI uri = URI . create ( url ) ; final CredentialsProvider credsProvider = new BasicCredentialsProvider ( ) ; credsProvider . setCredentials ( new AuthScope ( uri . getHost ( ) , uri . getPort ( ) ) , new UsernamePasswordCredentials ( username , password ) ) ; builder = builder . setDefaultCredentialsProvider ( credsProvider ) ; } return builder . build ( ) ;


signature:
public class HttpPidMinter { /** * Instantiate a request object based on the method variable . */
private HttpUriRequest minterRequest ( ) { } }

implementation: switch ( method . toUpperCase ( ) ) { case "GET" : return new HttpGet ( url ) ; case "PUT" : return new HttpPut ( url ) ; default : return new HttpPost ( url ) ; }


signature:
public class HttpPidMinter { /** * Remove unwanted text from the minter service response to produce the desired identifier .
 * Override this method for processing more complex than a simple regex replacement .
 * @ param responseText the response text
 * @ throws IOException if exception occurred
 * @ return the response */
protected String responseToPid ( final String responseText ) throws IOException { } }

implementation: LOGGER . debug ( "responseToPid({})" , responseText ) ; if ( ! isBlank ( regex ) ) { return responseText . replaceFirst ( regex , "" ) ; } else if ( xpath != null ) { try { return xpath ( responseText , xpath ) ; } catch ( ParserConfigurationException | SAXException | XPathExpressionException e ) { throw new IOException ( e ) ; } } else { return responseText ; }


signature:
public class HttpPidMinter { /** * Extract the desired identifier value from an XML response using XPath */
private static String xpath ( final String xml , final XPathExpression xpath ) throws ParserConfigurationException , SAXException , IOException , XPathExpressionException { } }

implementation: final DocumentBuilder builder = DOCUMENT_BUILDER_FACTORY . newDocumentBuilder ( ) ; final Document doc = builder . parse ( new ByteArrayInputStream ( xml . getBytes ( ) ) ) ; return xpath . evaluate ( doc ) ;


signature:
public class HttpPidMinter { /** * Mint a unique identifier using an external HTTP API .
 * @ return The generated identifier . */
@ Timed @ Override public String get ( ) { } }

implementation: try { LOGGER . debug ( "mintPid()" ) ; final HttpResponse resp = client . execute ( minterRequest ( ) ) ; return responseToPid ( EntityUtils . toString ( resp . getEntity ( ) ) ) ; } catch ( final IOException ex ) { LOGGER . warn ( "Error minting pid from {}: {}" , url , ex . getMessage ( ) ) ; throw new PidMintingException ( "Error minting pid" , ex ) ; } catch ( final Exception ex ) { LOGGER . warn ( "Error processing minter response" , ex . getMessage ( ) ) ; throw new PidMintingException ( "Error processing minter response" , ex ) ; }


signature:
public class ConfigurationBinder { /** * The starting point for using a ConfigurationBinder . A class needs to be passed through , along with a binder to
 * eventually bind the configuration with .
 * @ param klass The Configuration Class to load & bind .
 * @ param binder The { @ link com . google . inject . Binder } from the { @ link io . graceland . plugin . AbstractPlugin } .
 * @ param < T > The Configuration Type .
 * @ return Returns a working ConfigurationBinder using the provided type and class information . */
public static < T extends Configuration > ConfigurationBinder < T > forClass ( Class < T > klass , Binder binder ) { } }

implementation: return new ConfigurationBinder < > ( klass , binder ) ;


signature:
public class ConfigurationBinder { /** * This method will bind the class to a particular instance .
 * @ param configuration */
public void toInstance ( Config configuration ) { } }

implementation: Preconditions . checkNotNull ( configuration , "Configuration Instance cannot be null." ) ; if ( annotationClass == null ) { binder . bind ( configClass ) . toInstance ( configuration ) ; } else { binder . bind ( configClass ) . annotatedWith ( annotationClass ) . toInstance ( configuration ) ; }


signature:
public class ConfigurationBinder { /** * This method will load the configuration using a { @ link io . dropwizard . configuration . ConfigurationFactory } to load
 * the file from the current relative working directory .
 * @ param fileName The filename to load . */
public void toFile ( String fileName ) { } }

implementation: Preconditions . checkNotNull ( fileName , "File Name cannot be null." ) ; Config configuration = buildFromFile ( fileName ) ; if ( annotationClass == null ) { binder . bind ( configClass ) . toInstance ( configuration ) ; } else { binder . bind ( configClass ) . annotatedWith ( annotationClass ) . toInstance ( configuration ) ; }


signature:
public class ConfigurationBinder { /** * Builds a Configuration object from the file path given . It uses the { @ link io . dropwizard . configuration . ConfigurationFactory }
 * to build the configuration .
 * @ param possibleFilename The path to the configuration .
 * @ return A configuration object loaded form the filename given . */
private Config buildFromFile ( String possibleFilename ) { } }

implementation: File configFile = new File ( possibleFilename ) ; Preconditions . checkArgument ( configFile . exists ( ) , "File must exist at: " + configFile . getAbsolutePath ( ) ) ; try { return new ConfigurationFactory < > ( configClass , Validation . buildDefaultValidatorFactory ( ) . getValidator ( ) , Jackson . newObjectMapper ( ) , "graceland" ) . build ( configFile ) ; } catch ( Exception e ) { String msg = "Unknown exception triggered when attempting to build config from file:" + "\n" + "\t* Configuration Class: " + configClass . getCanonicalName ( ) + "\n" + "\t* File: " + configFile . getAbsolutePath ( ) ; throw new RuntimeException ( msg , e ) ; }


signature:
public class JLCClassResolver { /** * Loads the class of the specified name from the specified
 * { @ code InputStream } and returns loaded class representation as
 * { @ code java . lang . Class } .
 * @ param clazz The name of the class to be loaded .
 * @ param stream { @ code InputStream } to load a class file .
 * @ return The loaded class representation as { @ code java . lang . Class } . */
@ Override protected Class < ? > load ( String clazz , InputStream stream ) { } }

implementation:
// System . out . println ( clazz ) ;
try { return Class . forName ( clazz , true , classLoader ) ; } catch ( Exception e ) { // System . out . println ( e ) ;
return null ; } catch ( NoClassDefFoundError e ) { // System . out . println ( e ) ;
return null ; }


signature:
public class JLCClassResolver { /** * Resolves the classes that contains the specified name as
 * { @ code java . lang . Class } .
 * @ param name The part of the class name .
 * @ return Classes that contains the specified name as
 * { @ code java . lang . Class } .
 * @ throws IOException If any I / O access fails while traversing the search
 * path . */
@ Override public Set < Class < ? > > resolveByName ( final String name ) throws IOException { } }

implementation: Matcher < Class < ? > > matcher = new Matcher < Class < ? > > ( ) { public boolean matches ( Class < ? > clazz ) { return clazz . getName ( ) . contains ( name ) ; } } ; return resolve ( matcher ) ;


signature:
public class JLCClassResolver { /** * Resolves the classes that inherits the specified superclass as
 * { @ code java . lang . Class } .
 * @ param superclass The superclass being inherited .
 * @ return Classes that inherits the specified superclass as
 * { @ code java . lang . Class } .
 * @ throws IOException If any I / O access fails while traversing the search
 * path . */
@ Override public Set < Class < ? > > resolveBySuperclass ( final Class < ? > superclass ) throws IOException { } }

implementation: Matcher < Class < ? > > matcher = new Matcher < Class < ? > > ( ) { public boolean matches ( Class < ? > clazz ) { if ( clazz . getSuperclass ( ) != null ) { if ( clazz . getSuperclass ( ) . equals ( superclass ) ) { return true ; } else { return matches ( clazz . getSuperclass ( ) ) ; } } else { return false ; } } } ; return resolve ( matcher ) ;


signature:
public class JLCClassResolver { /** * Resolves the classes that implements the specified interface as
 * { @ code java . lang . Class } .
 * @ param interfaceClass The interface being implemented .
 * @ return Classes that implements the specified interface as
 * { @ code java . lang . Class } .
 * @ throws IOException If any I / O access fails while traversing the search
 * path . */
@ Override public Set < Class < ? > > resolveByInterface ( final Class < ? > interfaceClass ) throws IOException { } }

implementation: Matcher < Class < ? > > matcher = new Matcher < Class < ? > > ( ) { public boolean matches ( Class < ? > clazz ) { Class < ? > [ ] interfaces = clazz . getInterfaces ( ) ; for ( Class < ? > c : interfaces ) { if ( c . equals ( interfaceClass ) ) { return true ; } } if ( clazz . getSuperclass ( ) != null ) { return matches ( clazz . getSuperclass ( ) ) ; } else { return false ; } } } ; return resolve ( matcher ) ;


signature:
public class JLCClassResolver { /** * Resolves the classes that is annotated by the specified annotation as
 * { @ code java . lang . Class } .
 * @ param annotation The annotation the class being annotated .
 * @ return Classes that is annotated by the specified annotation as
 * { @ code java . lang . Class } .
 * @ throws IOException If any I / O access fails while traversing the search
 * path . */
@ Override public Set < Class < ? > > resolveByAnnotation ( final Class < ? extends Annotation > annotation ) throws IOException { } }

implementation: Matcher < Class < ? > > matcher = new Matcher < Class < ? > > ( ) { public boolean matches ( Class < ? > clazz ) { Annotation [ ] annotations = clazz . getAnnotations ( ) ; for ( Annotation a : annotations ) { if ( a . annotationType ( ) . equals ( annotation ) ) { return true ; } } return false ; } } ; return resolve ( matcher ) ;


signature:
public class RecordMapper { /** * Initialize the mapping metadata for the given class .
 * @ param mappedClass the mapped class . */
protected void initialize ( Class < T > mappedClass ) { } }

implementation: this . mappedClass = mappedClass ; this . mappedFields = new HashMap < String , Field > ( ) ; Field fields [ ] = mappedClass . getFields ( ) ; for ( Field field : fields ) { int mod = field . getModifiers ( ) ; if ( Modifier . isPublic ( mod ) && ! Modifier . isStatic ( mod ) ) { for ( Annotation a : field . getAnnotations ( ) ) { if ( a . annotationType ( ) . isAssignableFrom ( Column . class ) ) { Column c = ( Column ) a ; String columnName = c . name ( ) ; mappedFields . put ( columnName , field ) ; } } } }