Skip to content

Commit

Permalink
use static inner classes to keep instance size small, and avoid keepi…
Browse files Browse the repository at this point in the history
…ng references to

creator objects if appropriate.
  • Loading branch information
SavvasMisaghMoayyed committed Apr 9, 2018
1 parent 61fb70a commit 625559f
Show file tree
Hide file tree
Showing 30 changed files with 38 additions and 38 deletions.
Expand Up @@ -256,7 +256,7 @@ protected void onUpdate(AjaxRequestTarget target) {
}
}

private class PasswordModel implements IModel<String> {
private static class PasswordModel implements IModel<String> {

IModel<ProtectedStringType> psModel;

Expand Down
Expand Up @@ -35,7 +35,7 @@ public String getDuplicatesList() {
return sb.toString();
}

private class ObjectTypeRecord {
private static class ObjectTypeRecord {

@NotNull public final ShadowKindType kind;
@NotNull public final String intent;
Expand Down
Expand Up @@ -131,7 +131,7 @@ static Severity fromModel(@NotNull com.evolveum.midpoint.model.api.validator.Iss
}
}

public class Issue implements Serializable {
public static class Issue implements Serializable {
@NotNull private final Severity severity;
@NotNull private final String text;
@Nullable private final Class<? extends WizardStep> relatedStep;
Expand Down
Expand Up @@ -201,7 +201,7 @@ public String getObject() {
}


private class NoOffsetPrismReferencePanel extends PrismPropertyPanel<ReferenceWrapper> {
private static class NoOffsetPrismReferencePanel extends PrismPropertyPanel<ReferenceWrapper> {
public NoOffsetPrismReferencePanel(String id, IModel<ReferenceWrapper> propertyModel, Form form, PageBase pageBase) {
super(id, propertyModel, form, null, pageBase);
}
Expand Down
Expand Up @@ -64,7 +64,7 @@ public class SystemConfigurationDto implements Serializable {
public static final String F_ADMIN_GUI_CONFIGURATION = "adminGuiConfiguration";
private AEPlevel aepLevel;

private class CleanupInfo implements Serializable {
private static class CleanupInfo implements Serializable {
String ageValue;
Integer records;

Expand Down
Expand Up @@ -587,7 +587,7 @@ public Component getComponent() {
return this;
}

class LookupReportPropertyModel extends LookupPropertyModel<String> {
static class LookupReportPropertyModel extends LookupPropertyModel<String> {

private static final long serialVersionUID = 1L;

Expand Down
Expand Up @@ -160,7 +160,7 @@ public void initResultsPanel(RepeatingView resultView, List<OpResult> opresults,
}
}

private class ConnectorStruct implements Serializable {
private static class ConnectorStruct implements Serializable {
private String connectorName;
private List<OpResult> connectorResultsDto;
}
Expand Down
Expand Up @@ -232,7 +232,7 @@ protected boolean isGovernance(){
return true;
}

class RoleRelationSelectionDto implements Serializable {
static class RoleRelationSelectionDto implements Serializable {

private static final long serialVersionUID = 1L;
private boolean approver;
Expand Down
Expand Up @@ -105,7 +105,7 @@ private List<RootXNode> readInternal(@NotNull ParserSource source, @NotNull Pars
}
}

private class IterativeParsingContext {
private static class IterativeParsingContext {
final RootXNodeHandler handler;
boolean dataSent; // true if we really found the list of objects and sent it out
String defaultNamespace; // default namespace, if present
Expand Down Expand Up @@ -621,7 +621,7 @@ private JsonParser configureParser(JsonParser parser) {

//region Serialization implementation

class JsonSerializationContext {
static class JsonSerializationContext {
@NotNull final JsonGenerator generator;
@NotNull private final SerializationContext prismSerializationContext;
private String currentNamespace;
Expand Down
Expand Up @@ -401,7 +401,7 @@ public CompareResult compareComplexOld(ItemPath otherPath) {
/**
* Alternative to normalization: reads the same sequence of segments of 'path' as segments of 'path.normalize()'
*/
private class ItemPathNormalizingIterator implements Iterator<ItemPathSegment> {
private static class ItemPathNormalizingIterator implements Iterator<ItemPathSegment> {
final ItemPath path;
private int i = 0;
private boolean nextIsArtificialId = false;
Expand Down
Expand Up @@ -166,7 +166,7 @@ public InputSource resolveResourceUsingBuiltinResolver(String type, String names
return inputSource;
}

class Input implements LSInput {
static class Input implements LSInput {

private String publicId;
private String systemId;
Expand Down
Expand Up @@ -395,7 +395,7 @@ public RootXNode getSingleEntryMapAsRoot() {
return new RootXNode(key, get(key));
}

private class Entry implements Map.Entry<QName, XNode>, Serializable {
private static class Entry implements Map.Entry<QName, XNode>, Serializable {

private QName key;
private XNode value;
Expand Down
Expand Up @@ -277,7 +277,7 @@ public void launch(AccessCertificationCampaignType campaign, OperationResult par
LOGGER.trace("Closing task for {} switched to background, control thread returning with task {}", toShortString(campaign), task);
}

private class ObjectContext {
private static class ObjectContext {
@NotNull final ObjectType object;
@NotNull final List<ItemDelta<?, ?>> modifications = new ArrayList<>();

Expand All @@ -286,7 +286,7 @@ private class ObjectContext {
}
}

private class RunContext {
private static class RunContext {
final Task task;
final Map<String, ObjectContext> objectContextMap = new HashMap<>();
final PerformerCommentsFormatter commentsFormatter;
Expand Down
Expand Up @@ -56,8 +56,8 @@ public class ProfilingModelInspector implements DiagnosticContext, ClockworkInsp
private ModelContext lastLensContext;
private ModelState currentState = null;
private long totalRepoTime = 0;
class Runtimes {

static class Runtimes {
long startTime = 0;
long finishTime = 0;

Expand All @@ -70,7 +70,7 @@ String etimeStr() {
}
}

class PartRuntime {
static class PartRuntime {

public PartRuntime(String part) {
super();
Expand Down
Expand Up @@ -68,7 +68,7 @@ public void init() {
}

// TODO clean this up
private class EvaluationContext {
private static class EvaluationContext {
private final List<LocalizableMessage> messages = new ArrayList<>();
private final List<EvaluatedPolicyRuleType> rules = new ArrayList<>();
}
Expand Down
Expand Up @@ -616,7 +616,7 @@ private boolean wasExecuted(LensProjectionContext accountContext){
return true;
}

class DependencyAndSource {
static class DependencyAndSource {
ResourceObjectTypeDependencyType dependency;
LensProjectionContext sourceProjectionContext;
}
Expand Down
Expand Up @@ -129,7 +129,7 @@ private ComputationResult compute(@NotNull List<EvaluatedPolicyRule> rulesToReco
return cr;
}

private class ComputationResult {
private static class ComputationResult {
final Set<String> oldPolicySituations = new HashSet<>();
final Set<String> newPolicySituations = new HashSet<>();
final Set<EvaluatedPolicyRuleType> oldTriggeredRules = new HashSet<>();
Expand Down
Expand Up @@ -85,7 +85,7 @@ public class ResourceValidatorImpl implements ResourceValidator {
@Autowired
private PrismContext prismContext;

private class ResourceValidationContext {
private static class ResourceValidationContext {
@NotNull final PrismObject<ResourceType> resourceObject;
@NotNull final ObjectReferenceType resourceRef;
@NotNull final Scope scope;
Expand Down
Expand Up @@ -119,7 +119,7 @@ public void onTaskDelete(Task task, OperationResult result) {
}
}

class Statistics {
static class Statistics {
int processes = 0;
int processesWithNonExistingTaskOid = 0;
int processesWithNonWorkflowTaskOid = 0;
Expand Down
Expand Up @@ -249,7 +249,7 @@ public List<ObjectReferenceType> getMidpointAssignees(TaskExtract taskExtract) {
/**
* Helper class to carry relevant data from both Task and DelegateTask (to avoid code duplication)
*/
private class TaskExtract {
private static class TaskExtract {

private String id;
private String assignee;
Expand Down
Expand Up @@ -108,7 +108,7 @@ public ExpressionVariables getDefaultVariables(WfContextType wfContext, String r
}

// TODO name
public class ComputationResult {
public static class ComputationResult {
private ApprovalLevelOutcomeType predeterminedOutcome;
private AutomatedCompletionReasonType automatedCompletionReason;
private Set<ObjectReferenceType> approverRefs;
Expand Down
Expand Up @@ -31,7 +31,7 @@
*/
public class PolicyRuleApplication {

class Cause {
static class Cause {
private final ResourceShadowDiscriminator shadowDiscriminator; // non-null for projection context
@NotNull private final ItemPath itemPath; // should be non-empty
@NotNull private final PrismValue itemValue;
Expand Down
Expand Up @@ -51,7 +51,7 @@ void setProcessSpecification(ProcessSpecification processSpecification) {
this.processSpecification = processSpecification;
}

class Result {
static class Result {
@NotNull final ApprovalSchemaType schemaType;
@NotNull final SchemaAttachedPolicyRulesType attachedRules;
@Nullable final ProcessSpecification processSpecification;
Expand All @@ -68,7 +68,7 @@ public Result(@NotNull ApprovalSchemaType schemaType,
}
}

private class Fragment {
private static class Fragment {
// object to which relations (approved, owner) are resolved
// TODO test this thoroughly in presence of non-direct rules and merged schemas
final PrismObject<?> target;
Expand Down
Expand Up @@ -533,7 +533,7 @@ public String getFrameworkVersion() {
return connectorFactory.getFrameworkVersion();
}

private class ConfiguredConnectorInstanceEntry {
private static class ConfiguredConnectorInstanceEntry {
public String connectorOid;
public PrismContainer<ConnectorConfigurationType> configuration;
public ConnectorInstance connectorInstance;
Expand Down
Expand Up @@ -277,7 +277,7 @@ public void shutdown() {
// Nothing to do
}

private class ConnectorStruct {
private static class ConnectorStruct {
Class<? extends ConnectorInstance> connectorClass;
ConnectorType connectorObject;
PrismSchema connectorConfigurationSchema;
Expand Down
Expand Up @@ -51,7 +51,7 @@ public class SqlPerformanceMonitor {

private SqlRepositoryFactory sqlRepositoryFactory;

class OperationRecord {
static class OperationRecord {
String kind;
long handle;
int attempts;
Expand Down Expand Up @@ -121,7 +121,7 @@ private void writeStatisticsToFile(String file) {

}

class StatEntry {
static class StatEntry {
long totalTime, wastedTime;
int attempts;
int records;
Expand Down
Expand Up @@ -58,7 +58,7 @@ public abstract class HibernateQuery {
*/
private List<Condition> conditions = new ArrayList<>();

public class Ordering {
public static class Ordering {
@NotNull private final String byProperty;
private final OrderDirection direction;

Expand All @@ -80,7 +80,7 @@ public OrderDirection getDirection() {
private List<Ordering> orderingList = new ArrayList<>();


public class Grouping {
public static class Grouping {
@NotNull private final String byProperty;

Grouping(@NotNull String byProperty) {
Expand Down
Expand Up @@ -216,7 +216,7 @@ public void execute(JobExecutionContext context) throws JobExecutionException {

}

class GroupExecInfo {
static class GroupExecInfo {
int limit;
Set<Task> tasks = new HashSet<>();

Expand Down Expand Up @@ -314,7 +314,7 @@ private void addToGroupMap(Map<String, GroupExecInfo> groupMap, Task otherTask)
}
}

private class RescheduleTime {
private static class RescheduleTime {
private final long timestamp;
private final boolean regular;
private RescheduleTime(long timestamp, boolean regular) {
Expand Down
Expand Up @@ -55,7 +55,7 @@ public void initialize() {
taskManager.registerHandler(HANDLER_URI, this);
}

private class Statistics {
private static class Statistics {
Integer min = null;
Integer max = null;
int total = 0;
Expand Down
Expand Up @@ -209,7 +209,7 @@ private List<String> processBoundaries() {
return rv;
}

private class Scanner {
private static class Scanner {
final String string;
int index;

Expand Down

0 comments on commit 625559f

Please sign in to comment.