This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class FooEntity { | |
| private ValueHolder relatedEntity; | |
| public BarEntity getRelatedEntity() { | |
| return (BarEntity) relatedEntity.getValue(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class FooEntity { | |
| enum Status { GHOST, LOADING, LOADED }; | |
| private Status status; | |
| private long id; | |
| private BarEntity relatedEntity; | |
| public FooEntity(long id) { | |
| this.id = id; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class FooEntity { | |
| private BarEntity relatedEntity; | |
| public BarEntity getRelatedEntity() { | |
| if (relatedEntity == null) | |
| relatedEntity = new BarEntity(); // Alternatively, this might be a database call | |
| return relatedEntity; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void addChildContexts(XmlApplicationContext parent) { | |
| for (Module module : Module.values()) { | |
| if (ModuleUtils.hasModule(module)) | |
| parent.addChildContext(module.initialize(parent)); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public enum Module { | |
| ORM(ORM_MARKER_CLASS, ORM_CONTEXT_CLASS), | |
| AOP(AOP_MARKER_CLASS, AOP_CONTEXT_CLASS), | |
| WEB(WEB_MARKER_CLASS, WEB_CONTEXT_CLASS); | |
| // ... | |
| public InfinitumContext initialize(InfinitumContext parent) { | |
| try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static boolean hasModule(Module module) { | |
| return hasClass(module.getMarkerClass()); | |
| } | |
| private static boolean hasClass(String name) { | |
| try { | |
| Thread.currentThread().getContextClassLoader().loadClass(name); | |
| return true; | |
| } catch (ClassNotFoundException e) { | |
| return false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ find . -name "*.java" -print0 | xargs -0 sed -i -e '/This file is part of Infinitum Framework./,/along with Infinitum Framework/c\ | |
| * Licensed under the Apache License, Version 2.0 (the "License");\ | |
| * you may not use this file except in compliance with the License.\ | |
| * You may obtain a copy of the License at\ | |
| *\ | |
| * http://www.apache.org/licenses/LICENSE-2.0\ | |
| *\ | |
| * Unless required by applicable law or agreed to in writing, software\ | |
| * distributed under the License is distributed on an "AS IS" BASIS,\ | |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ sed -i -e '/Replace everything from this line/,/To this line/c\ | |
| With this line' file.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ find . -name "*.java" -print0 | xargs -0 sed -i 's/foo/bar/g' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Copyright (c) 2012 Tyler Treat | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |