idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
35,100 | @ Override public ValueAndDeclaredType traverse ( final Object toTraverse , final String type , final boolean onlyToParent , final String ... names ) { // Traverse through names (if any) if ( ( names == null ) || ( names . length == 0 ) ) { // If no names, no parent if ( onlyToParent ) { return new ValueAndDeclaredType... | Traverses the given Class heirarchy using properties of the given names . | 252 | 15 |
35,101 | private void inspectClassProperties ( final String type , Map < String , Property > properties ) { JavaSource < ? > clazz = sourceForName ( this . project , type ) ; if ( clazz instanceof MethodHolder < ? > ) { lookupGetters ( properties , ( MethodHolder < ? > ) clazz ) ; lookupSetters ( properties , ( MethodHolder < ?... | Recursive lookup for properties from superclass in order to support inheritance | 167 | 13 |
35,102 | protected String isGetter ( final Method < ? , ? > method ) { String methodName = method . getName ( ) ; String propertyName ; if ( methodName . startsWith ( ClassUtils . JAVABEAN_GET_PREFIX ) ) { propertyName = methodName . substring ( ClassUtils . JAVABEAN_GET_PREFIX . length ( ) ) ; } else if ( methodName . startsWi... | Returns whether the given method is a getter method . | 233 | 11 |
35,103 | protected String isSetter ( final Method < ? , ? > method ) { String methodName = method . getName ( ) ; if ( ! methodName . startsWith ( ClassUtils . JAVABEAN_SET_PREFIX ) ) { return null ; } String propertyName = methodName . substring ( ClassUtils . JAVABEAN_SET_PREFIX . length ( ) ) ; return StringUtils . decapital... | Returns whether the given method is a setter method . | 103 | 11 |
35,104 | @ Override public void newOneToOneRelationship ( Project project , final JavaResource resource , final String fieldName , final String fieldType , final String inverseFieldName , final FetchType fetchType , final boolean required , final Iterable < CascadeType > cascadeTypes ) throws FileNotFoundException { JavaSourceF... | Creates a One - to - One relationship | 439 | 9 |
35,105 | @ Override public void newManyToOneRelationship ( final Project project , final JavaResource resource , final String fieldName , final String fieldType , final String inverseFieldName , final FetchType fetchType , final boolean required , final Iterable < CascadeType > cascadeTypes ) throws FileNotFoundException { Java... | Creates a Many - To - One relationship | 698 | 9 |
35,106 | @ Override public void newEmbeddedRelationship ( final Project project , final JavaResource resource , final String fieldName , final String fieldType ) throws FileNotFoundException { JavaSourceFacet java = project . getFacet ( JavaSourceFacet . class ) ; JavaClassSource entityClass = getJavaClassFrom ( resource ) ; Ja... | Creates an Embedded relationship | 175 | 6 |
35,107 | private boolean areTypesSame ( String from , String to ) { String fromCompare = from . endsWith ( ".java" ) ? from . substring ( 0 , from . length ( ) - 5 ) : from ; String toCompare = to . endsWith ( ".java" ) ? to . substring ( 0 , to . length ( ) - 5 ) : to ; return fromCompare . equals ( toCompare ) ; } | Checks if the types are the same removing the . java in the end of the string in case it exists | 88 | 22 |
35,108 | public Collection < JavaClassSource > allResources ( ) { Set < JavaClassSource > result = new HashSet <> ( ) ; for ( DTOPair pair : dtos . values ( ) ) { if ( pair . rootDTO != null ) { result . add ( pair . rootDTO ) ; } if ( pair . nestedDTO != null ) { result . add ( pair . nestedDTO ) ; } } return result ; } | Retrieves all the DTOs present in this instance . | 95 | 13 |
35,109 | public void addRootDTO ( JavaClass < ? > entity , JavaClassSource rootDTO ) { DTOPair dtoPair = dtos . containsKey ( entity ) ? dtos . get ( entity ) : new DTOPair ( ) ; dtoPair . rootDTO = rootDTO ; dtos . put ( entity , dtoPair ) ; } | Registers the root DTO created for a JPA entity | 84 | 12 |
35,110 | public void addNestedDTO ( JavaClass < ? > entity , JavaClassSource nestedDTO ) { DTOPair dtoPair = dtos . containsKey ( entity ) ? dtos . get ( entity ) : new DTOPair ( ) ; dtoPair . nestedDTO = nestedDTO ; dtos . put ( entity , dtoPair ) ; } | Registers the nested DTO created for a JPA entity | 85 | 12 |
35,111 | public boolean containsDTOFor ( JavaClass < ? > entity , boolean root ) { if ( dtos . get ( entity ) == null ) { return false ; } return ( root ? ( dtos . get ( entity ) . rootDTO != null ) : ( dtos . get ( entity ) . nestedDTO != null ) ) ; } | Indicates whether a DTO is found in the underlying collection or not . | 76 | 15 |
35,112 | public JavaClassSource getDTOFor ( JavaClass < ? > entity , boolean root ) { if ( dtos . get ( entity ) == null ) { return null ; } return root ? ( dtos . get ( entity ) . rootDTO ) : ( dtos . get ( entity ) . nestedDTO ) ; } | Retrieves the DTO created for the JPA entity depending on whether a top level or nested DTO was requested as the return value . | 72 | 29 |
35,113 | @ Override public boolean promptRequiredMissingValues ( ShellImpl shell ) throws InterruptedException { Map < String , InputComponent < ? , ? > > inputs = getController ( ) . getInputs ( ) ; if ( hasMissingRequiredInputValues ( inputs . values ( ) ) ) { UIOutput output = shell . getOutput ( ) ; if ( ! getContext ( ) . ... | Prompts for required missing values | 155 | 7 |
35,114 | protected < T extends ProjectFacet > boolean filterValueChoicesFromStack ( Project project , UISelectOne < T > select ) { boolean result = true ; Optional < Stack > stackOptional = project . getStack ( ) ; // Filtering only supported facets if ( stackOptional . isPresent ( ) ) { Stack stack = stackOptional . get ( ) ; ... | Filters the given value choices according the current enabled stack | 229 | 11 |
35,115 | @ SuppressWarnings ( "unchecked" ) private < F extends FACETTYPE > F safeGetFacet ( Class < F > type ) { for ( FACETTYPE facet : facets ) { if ( type . isInstance ( facet ) ) { return ( F ) facet ; } } return null ; } | Returns the installed facet that is an instance of the provided type argument null otherwise . | 66 | 16 |
35,116 | @ SuppressWarnings ( "unchecked" ) @ Override public Object convert ( Object source ) { Object value = source ; for ( Converter < Object , Object > converter : converters ) { if ( converter != null ) { value = converter . convert ( value ) ; } } return value ; } | This method always returns the last object converted from the list | 65 | 11 |
35,117 | private String buildFacesViewId ( final String servletMapping , final String resourcePath ) { for ( String suffix : getFacesSuffixes ( ) ) { if ( resourcePath . endsWith ( suffix ) ) { StringBuffer result = new StringBuffer ( ) ; Map < Pattern , String > patterns = new HashMap <> ( ) ; Pattern pathMapping = Pattern . c... | Build a Faces view ID for the given resource path return null if not mapped by Faces Servlet | 325 | 19 |
35,118 | protected String encodePassword ( String password ) { StringBuilder result = new StringBuilder ( ) ; if ( password != null ) { for ( int i = 0 ; i < password . length ( ) ; i ++ ) { int c = password . charAt ( i ) ; c ^= 0xdfaa ; result . append ( Integer . toHexString ( c ) ) ; } } return result . toString ( ) ; } | Copied from com . intellij . openapi . util . PasswordUtil . java | 90 | 19 |
35,119 | public void registerMapping ( String prefix , String namespaceURI ) { prefix2Ns . put ( prefix , namespaceURI ) ; ns2Prefix . put ( namespaceURI , prefix ) ; } | Registers prefix - namespace URI mapping | 40 | 7 |
35,120 | public static CharSequence prettyPrint ( DependencyNode root ) { StringBuilder sb = new StringBuilder ( ) ; prettyPrint ( root , new Predicate < DependencyNode > ( ) { @ Override public boolean accept ( DependencyNode node ) { return true ; } } , sb , 0 ) ; return sb ; } | Prints a tree - like structure for this object | 71 | 10 |
35,121 | protected void initializeEnablementUI ( UIBuilder builder ) { enabled . setEnabled ( hasEnablement ( ) ) ; if ( getSelectedProject ( builder ) . hasFacet ( CDIFacet_1_1 . class ) ) { priority . setEnabled ( hasEnablement ( ) ) ; builder . add ( priority ) ; } else { priority . setEnabled ( false ) ; } builder . add ( e... | Note that enablement should be initialized last | 91 | 8 |
35,122 | public static String colorizeResource ( FileResource < ? > resource ) { String name = resource . getName ( ) ; if ( resource . isDirectory ( ) ) { name = new TerminalString ( name , new TerminalColor ( Color . BLUE , Color . DEFAULT ) ) . toString ( ) ; } else if ( resource . isExecutable ( ) ) { name = new TerminalStr... | Applies ANSI colors in a specific resource | 110 | 9 |
35,123 | @ Override protected void addColumnComponents ( HtmlDataTable dataTable , Map < String , String > attributes , NodeList elements , StaticXmlMetawidget metawidget ) { super . addColumnComponents ( dataTable , attributes , elements , metawidget ) ; if ( dataTable . getChildren ( ) . isEmpty ( ) ) { return ; } if ( ! attr... | Overridden to add a remove column . | 768 | 8 |
35,124 | protected Resource < ? > generateNavigation ( final String targetDir ) throws IOException { WebResourcesFacet web = this . project . getFacet ( WebResourcesFacet . class ) ; HtmlTag unorderedList = new HtmlTag ( "ul" ) ; ResourceFilter filter = new ResourceFilter ( ) { @ Override public boolean accept ( Resource < ? > ... | Generates the navigation menu based on scaffolded entities . | 541 | 11 |
35,125 | protected Map < String , String > parseNamespaces ( final String template ) { Map < String , String > namespaces = CollectionUtils . newHashMap ( ) ; Document document = XmlUtils . documentFromString ( template ) ; Element element = document . getDocumentElement ( ) ; NamedNodeMap attributes = element . getAttributes (... | Parses the given XML and determines what namespaces it already declares . These are later removed from the list of namespaces that Metawidget introduces . | 198 | 31 |
35,126 | protected int parseIndent ( final String template , final String indentOf ) { int indent = 0 ; int indexOf = template . indexOf ( indentOf ) ; while ( ( indexOf >= 0 ) && ( template . charAt ( indexOf ) != ' ' ) ) { if ( template . charAt ( indexOf ) == ' ' ) { indent ++ ; } indexOf -- ; } return indent ; } | Parses the given XML and determines the indent of the given String namespaces that Metawidget introduces . | 86 | 22 |
35,127 | protected void writeEntityMetawidget ( final Map < Object , Object > context , final int entityMetawidgetIndent , final Map < String , String > existingNamespaces ) { StringWriter stringWriter = new StringWriter ( ) ; this . entityMetawidget . write ( stringWriter , entityMetawidgetIndent ) ; context . put ( "metawidge... | Writes the entity Metawidget and its namespaces into the given context . | 158 | 16 |
35,128 | protected void writeSearchAndBeanMetawidget ( final Map < Object , Object > context , final int searchMetawidgetIndent , final int beanMetawidgetIndent , final Map < String , String > existingNamespaces ) { StringWriter stringWriter = new StringWriter ( ) ; this . searchMetawidget . write ( stringWriter , searchMetawid... | Writes the search Metawidget the bean Metawidget and their namespaces into the given context . | 244 | 21 |
35,129 | private boolean areTypesAssignable ( Class < ? > source , Class < ? > target ) { if ( target . isAssignableFrom ( source ) ) { return true ; } else if ( ! source . isPrimitive ( ) && ! target . isPrimitive ( ) ) { return false ; } else if ( source . isPrimitive ( ) ) { // source is primitive return primitiveToWrapperMa... | Check if the parameters are primitive and if they can be assignable | 118 | 13 |
35,130 | @ SuppressWarnings ( "unchecked" ) protected Element findAndReplaceProperties ( Counter counter , Element parent , String name , Map props ) { boolean shouldExist = ( props != null ) && ! props . isEmpty ( ) ; Element element = updateElement ( counter , parent , name , shouldExist ) ; if ( shouldExist ) { Iterator it =... | Method findAndReplaceProperties . | 253 | 8 |
35,131 | protected Element findAndReplaceSimpleElement ( Counter counter , Element parent , String name , String text , String defaultValue ) { if ( ( defaultValue != null ) && ( text != null ) && defaultValue . equals ( text ) ) { Element element = parent . getChild ( name , parent . getNamespace ( ) ) ; // if exist and is def... | Method findAndReplaceSimpleElement . | 187 | 8 |
35,132 | protected Element findAndReplaceSimpleLists ( Counter counter , Element parent , java . util . Collection list , String parentName , String childName ) { boolean shouldExist = ( list != null ) && ( list . size ( ) > 0 ) ; Element element = updateElement ( counter , parent , parentName , shouldExist ) ; if ( shouldExist... | Method findAndReplaceSimpleLists . | 315 | 9 |
35,133 | protected Element findAndReplaceXpp3DOM ( Counter counter , Element parent , String name , Xpp3Dom dom ) { boolean shouldExist = ( dom != null ) && ( ( dom . getChildCount ( ) > 0 ) || ( dom . getValue ( ) != null ) ) ; Element element = updateElement ( counter , parent , name , shouldExist ) ; if ( shouldExist ) { rep... | Method findAndReplaceXpp3DOM . | 116 | 10 |
35,134 | protected void insertAtPreferredLocation ( Element parent , Element child , Counter counter ) { int contentIndex = 0 ; int elementCounter = 0 ; Iterator it = parent . getContent ( ) . iterator ( ) ; Text lastText = null ; int offset = 0 ; while ( it . hasNext ( ) && ( elementCounter <= counter . getCurrentIndex ( ) ) )... | Method insertAtPreferredLocation . | 364 | 7 |
35,135 | protected void iterateContributor ( Counter counter , Element parent , java . util . Collection list , java . lang . String parentTag , java . lang . String childTag ) { boolean shouldExist = ( list != null ) && ( list . size ( ) > 0 ) ; Element element = updateElement ( counter , parent , parentTag , shouldExist ) ; i... | Method iterateContributor . | 326 | 6 |
35,136 | @ SuppressWarnings ( "unchecked" ) protected void replaceXpp3DOM ( final Element parent , final Xpp3Dom parentDom , final Counter counter ) { if ( parentDom . getChildCount ( ) > 0 ) { Xpp3Dom [ ] childs = parentDom . getChildren ( ) ; Collection < Xpp3Dom > domChilds = new ArrayList <> ( ) ; for ( int i = 0 ; i < chil... | Method replaceXpp3DOM . | 495 | 7 |
35,137 | protected void updateActivation ( Activation value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndRepla... | Method updateActivation . | 221 | 5 |
35,138 | protected void updateActivationFile ( ActivationFile value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; find... | Method updateActivationFile . | 130 | 6 |
35,139 | protected void updateActivationOS ( ActivationOS value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndR... | Method updateActivationOS . | 180 | 6 |
35,140 | protected void updateActivationProperty ( ActivationProperty value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ... | Method updateActivationProperty . | 128 | 6 |
35,141 | protected void updateBuild ( Build value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleEl... | Method updateBuild . | 465 | 4 |
35,142 | protected void updateBuildBase ( BuildBase value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplace... | Method updateBuildBase . | 289 | 5 |
35,143 | protected void updateCiManagement ( CiManagement value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndR... | Method updateCiManagement . | 156 | 6 |
35,144 | protected void updateConfigurationContainer ( ConfigurationContainer value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ... | Method updateConfigurationContainer . | 137 | 5 |
35,145 | protected void updateContributor ( Contributor value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "name" , value . getName ( ) , null ) ; findAndReplaceSimpleElement ( ... | Method updateContributor . | 264 | 5 |
35,146 | protected void updateDependency ( Dependency value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "groupId" , value . getGroupId ( ) , null ) ; findAndReplaceSimpleElemen... | Method updateDependency . | 315 | 6 |
35,147 | protected void updateDependencyManagement ( DependencyManagement value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) ... | Method updateDependencyManagement . | 108 | 7 |
35,148 | protected void updateDeploymentRepository ( DeploymentRepository value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) ... | Method updateDeploymentRepository . | 234 | 7 |
35,149 | protected void updateDistributionManagement ( DistributionManagement value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ... | Method updateDistributionManagement . | 227 | 6 |
35,150 | protected Element updateElement ( Counter counter , Element parent , String name , boolean shouldExist ) { Element element = parent . getChild ( name , parent . getNamespace ( ) ) ; if ( ( element != null ) && shouldExist ) { counter . increaseCount ( ) ; } if ( ( element == null ) && shouldExist ) { element = factory ... | Method updateElement . | 217 | 4 |
35,151 | protected void updateExclusion ( Exclusion value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "artifactId" , value . getArtifactId ( ) , null ) ; findAndReplaceSimpleEl... | Method updateExclusion . | 102 | 5 |
35,152 | protected void updateExtension ( Extension value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "groupId" , value . getGroupId ( ) , null ) ; findAndReplaceSimpleElement ... | Method updateExtension . | 127 | 5 |
35,153 | protected void updateFileSet ( FileSet value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimp... | Method updateFileSet . | 161 | 5 |
35,154 | protected void updateIssueManagement ( IssueManagement value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; fi... | Method updateIssueManagement . | 126 | 5 |
35,155 | protected void updateLicense ( License value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "name" , value . getName ( ) , null ) ; findAndReplaceSimpleElement ( innerCou... | Method updateLicense . | 148 | 4 |
35,156 | protected void updateMailingList ( MailingList value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "name" , value . getName ( ) , null ) ; findAndReplaceSimpleElement ( ... | Method updateMailingList . | 217 | 6 |
35,157 | protected void updateModelBase ( ModelBase value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplace... | Method updateModelBase . | 330 | 5 |
35,158 | protected void updateNotifier ( Notifier value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "type" , value . getType ( ) , "mail" ) ; findAndReplaceSimpleElement ( inne... | Method updateNotifier . | 335 | 5 |
35,159 | protected void updateOrganization ( Organization value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndR... | Method updateOrganization . | 125 | 5 |
35,160 | protected void updateParent ( Parent value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimple... | Method updateParent . | 191 | 4 |
35,161 | protected void updatePatternSet ( PatternSet value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndRepla... | Method updatePatternSet . | 135 | 5 |
35,162 | protected void updatePlugin ( Plugin value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "groupId" , value . getGroupId ( ) , "org.apache.maven.plugins" ) ; findAndRepla... | Method updatePlugin . | 343 | 4 |
35,163 | protected void updatePluginConfiguration ( PluginConfiguration value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + ... | Method updatePluginConfiguration . | 123 | 5 |
35,164 | protected void updatePluginContainer ( PluginContainer value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; it... | Method updatePluginContainer . | 100 | 5 |
35,165 | protected void updatePluginExecution ( PluginExecution value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "id" , value . getId ( ) , "default" ) ; findAndReplaceSimpleE... | Method updatePluginExecution . | 194 | 6 |
35,166 | protected void updatePrerequisites ( Prerequisites value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAn... | Method updatePrerequisites . | 106 | 5 |
35,167 | protected void updateProfile ( Profile value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "id" , value . getId ( ) , null ) ; updateActivation ( value . getActivation (... | Method updateProfile . | 367 | 4 |
35,168 | protected void updateRelocation ( Relocation value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndRepla... | Method updateRelocation . | 184 | 5 |
35,169 | protected void updateReporting ( Reporting value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplace... | Method updateReporting . | 183 | 4 |
35,170 | protected void updateReportPlugin ( ReportPlugin value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "groupId" , value . getGroupId ( ) , "org.apache.maven.plugins" ) ; ... | Method updateReportPlugin . | 231 | 5 |
35,171 | protected void updateReportSet ( ReportSet value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "id" , value . getId ( ) , "default" ) ; findAndReplaceXpp3DOM ( innerCoun... | Method updateReportSet . | 164 | 5 |
35,172 | protected void updateRepository ( Repository value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; updateRepositoryPolicy ( value . getReleases ( ) , "releases" , innerCount , root ) ; updateRepositoryPolicy ( value . get... | Method updateRepository . | 198 | 5 |
35,173 | protected void updateRepositoryBase ( RepositoryBase value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; find... | Method updateRepositoryBase . | 182 | 6 |
35,174 | protected void updateRepositoryPolicy ( RepositoryPolicy value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; ... | Method updateRepositoryPolicy . | 180 | 6 |
35,175 | protected void updateResource ( Resource value , String xmlTag , Counter counter , Element element ) { Element root = element ; Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElement ( innerCount , root , "targetPath" , value . getTargetPath ( ) , null ) ; findAndReplaceSimpleElem... | Method updateResource . | 207 | 4 |
35,176 | protected void updateScm ( Scm value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElemen... | Method updateScm . | 183 | 5 |
35,177 | protected void updateSite ( Site value , String xmlTag , Counter counter , Element element ) { boolean shouldExist = value != null ; Element root = updateElement ( counter , element , xmlTag , shouldExist ) ; if ( shouldExist ) { Counter innerCount = new Counter ( counter . getDepth ( ) + 1 ) ; findAndReplaceSimpleElem... | Method updateSite . | 150 | 4 |
35,178 | public static String validateRequired ( final InputComponent < ? , ? > input ) { String requiredMessage = null ; if ( input . isEnabled ( ) && input . isRequired ( ) && ! InputComponents . hasValue ( input ) ) { requiredMessage = input . getRequiredMessage ( ) ; if ( Strings . isNullOrEmpty ( requiredMessage ) ) { Stri... | Validate if an required and enabled input has a value . If not return the error message . | 161 | 19 |
35,179 | public static String getLabelFor ( InputComponent < ? , ? > input , boolean addColon ) { String label = input . getLabel ( ) ; // If no label was provided, use name if ( label == null ) { label = input . getName ( ) ; } // if a colon is required, add it if ( addColon && ! label . endsWith ( COLON ) ) { label += COLON ;... | Returns the label for this component | 94 | 6 |
35,180 | private synchronized void refreshFlow ( ) { try { initialize ( ) ; } catch ( Exception e ) { throw new IllegalStateException ( "Error while initializing wizard" , e ) ; } int currentFlowPointer = this . flowPointer ; try { this . flowPointer = 0 ; while ( canMoveToNextStep ( ) ) { try { next ( ) . initialize ( ) ; } ca... | Refreshes the current flow so it s possible to eagerly fetch all the steps | 136 | 16 |
35,181 | private synchronized void cleanSubsequentStalePages ( ) { // FIXME: Workaround until FORGE-1704 is fixed if ( flowPointer == 0 ) { flow . subList ( 1 , flow . size ( ) ) . clear ( ) ; subflow . clear ( ) ; } else { // Remove subsequent pages and push the subflows back to the stack Iterator < WizardStepEntry > it = flow... | Remove stale pages in case of navigational changes | 168 | 9 |
35,182 | private List < Resource < ? > > allDirectoriesOnPath ( Resource < ? > startingDir ) { List < Resource < ? > > result = new ArrayList <> ( ) ; while ( startingDir != null ) { result . add ( startingDir ) ; startingDir = startingDir . getParent ( ) ; } return result ; } | Returns all directories on path starting from given directory up to the root . | 71 | 14 |
35,183 | private Project findProjectInDirectory ( Resource < ? > target , ProjectProvider projectProvider , Predicate < Project > filter ) { Project result = null ; Imported < ProjectCache > caches = getCaches ( ) ; if ( projectProvider . containsProject ( target ) ) { boolean cached = false ; for ( ProjectCache cache : caches ... | Returns project residing in given directory if no such is found then null is returned . | 184 | 16 |
35,184 | public static NavigationResultBuilder create ( NavigationResult result ) { NavigationResultBuilder builder = new NavigationResultBuilder ( ) ; if ( result != null && result . getNext ( ) != null ) { builder . entries . addAll ( Arrays . asList ( result . getNext ( ) ) ) ; } return builder ; } | Create a new instance of a NavigationResultBuilder using the provided NavigationResult instance as a base . | 67 | 19 |
35,185 | public NavigationResultBuilder add ( NavigationResult result ) { if ( result != null && result . getNext ( ) != null ) { entries . addAll ( Arrays . asList ( result . getNext ( ) ) ) ; } return this ; } | Add a UICommand instance to create a single navigation entry . | 52 | 14 |
35,186 | public NavigationResultBuilder add ( UICommandMetadata metadata , Iterable < Class < ? extends UICommand > > types ) { List < NavigationResultEntry > internalEntries = new ArrayList <> ( ) ; for ( Class < ? extends UICommand > type : types ) { if ( UIWizard . class . isAssignableFrom ( type ) ) { throw new IllegalArgum... | Add multiple UICommand types to create a single navigation entry . Every invocation of this method creates a separate navigation entry . UIWizard types must not be provided as arguments since wizards and wizard steps cannot be combined with other UICommand types in the same navigation entry . | 173 | 56 |
35,187 | public List < Resource < ? > > search ( ) { return match ( path . split ( Pattern . quote ( File . separator ) ) , 0 , res , new LinkedList < Resource < ? > > ( ) ) ; } | Perform a search by doing a breadth - first traversal of the resource tree for resources that match the path string . | 49 | 24 |
35,188 | @ Override public Resource < ? > getChild ( final String name ) { return getResourceFactory ( ) . create ( new File ( getUnderlyingResourceObject ( ) . getAbsolutePath ( ) , name ) ) ; } | Obtain a reference to the child resource . | 48 | 9 |
35,189 | public boolean isEJB ( JavaType < ? > javaType ) { return javaType . hasAnnotation ( Stateless . class ) || javaType . hasAnnotation ( Stateful . class ) || javaType . hasAnnotation ( Singleton . class ) || javaType . hasAnnotation ( MessageDriven . class ) ; } | Given a JavaType this method checks if it s an EJB or not | 70 | 15 |
35,190 | private static Prompt createPrompt ( Resource < ? > currentResource ) { // [ currentdir]$ if ( OperatingSystemUtils . isWindows ( ) ) { List < TerminalCharacter > prompt = new LinkedList <> ( ) ; prompt . add ( new TerminalCharacter ( ' ' ) ) ; for ( char c : currentResource . getName ( ) . toCharArray ( ) ) { prompt .... | Creates an initial prompt | 297 | 5 |
35,191 | VersionRangeResult getVersions ( DependencyQuery query ) { Coordinate dep = query . getCoordinate ( ) ; try { String version = dep . getVersion ( ) ; if ( version == null || version . isEmpty ( ) ) { dep = CoordinateBuilder . create ( dep ) . setVersion ( "[,)" ) ; } else if ( ! version . matches ( "(\\(|\\[).*?(\\)|\\... | Returns the versions of a specific artifact | 321 | 7 |
35,192 | public static File getContextFile ( Resource < ? > r ) { do { Object o = r . getUnderlyingResourceObject ( ) ; if ( o instanceof File ) { return ( File ) r . getUnderlyingResourceObject ( ) ; } } while ( ( r = r . getParent ( ) ) != null ) ; return null ; } | A simple utility method to locate the outermost contextual File reference for the specified resource . | 73 | 17 |
35,193 | CliRequest createCliRequest ( String [ ] params , String workingDirectory ) { CliRequest cliRequest = null ; try { Constructor < CliRequest > constructor = CliRequest . class . getDeclaredConstructor ( String [ ] . class , ClassWorld . class ) ; // This is package-private constructor . setAccessible ( true ) ; cliReque... | Horrible hack . Bad Maven API | 249 | 8 |
35,194 | @ Override protected void implementInterface ( InterfaceCapableSource < ? > source , Iterable < String > value , JavaSourceFacet facet ) { for ( String type : value ) { source . addInterface ( type ) ; } } | Interfaces don t require overriding method declarations | 49 | 8 |
35,195 | public static boolean isEnabled ( UICommand command , UIContext context ) { return ( command . isEnabled ( context ) && ! ( command instanceof UIWizardStep ) ) ; } | Returns true if this command can be invoked | 40 | 8 |
35,196 | public static String shellifyOptionValue ( String value ) { return COLONS . matcher ( WHITESPACES . matcher ( value . trim ( ) ) . replaceAll ( "_" ) ) . replaceAll ( "" ) . toUpperCase ( ) ; } | Shellifies an option value | 57 | 5 |
35,197 | public static String shellifyOptionNameDashed ( String name ) { String shellName = shellifyName ( name ) ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < shellName . length ( ) ; i ++ ) { char c = shellName . charAt ( i ) ; if ( Character . isUpperCase ( c ) ) { if ( i > 0 ) { char previousChar = shel... | Shellifies an option name using the provided style | 216 | 9 |
35,198 | public static int execFromPath ( final String command , final String [ ] parms , final OutputStream out , final DirectoryResource path ) throws IOException { Assert . notNull ( command , "Command must not be null." ) ; Assert . notNull ( path , "Directory path must not be null." ) ; Assert . notNull ( out , "OutputStre... | Execute a native system command as if it were run from the given path . | 276 | 16 |
35,199 | public static void exec ( final boolean wait , final String command , final String ... parms ) throws IOException { String [ ] commandTokens = parms == null ? new String [ 1 ] : new String [ parms . length + 1 ] ; commandTokens [ 0 ] = command ; if ( commandTokens . length > 1 ) { System . arraycopy ( parms , 0 , comma... | Execute the given system command | 107 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.