Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2012 Daniel Bechler
   *
   * 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.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 package de.danielbechler.diff;
 
 
 import java.util.*;

Author(s):
Daniel Bechler
 
 public class Configuration implements NodeInspector
 {
Defines how default values of primitive types (int, long, short, byte, char, boolean, float, double) will be treated. A default value is either the one specified by the JDK (numbers are 0, booleans are false) or the value of the corresponding property when a new instance of its holding class gets created. In order to determine the proper default value, we'll attempt to instantiate the holding class once via its public constructor. If this instantiation fails (for example if there is no such constructor), we'll fall back to the JDK default. This configuration does not apply to the corresponding wrapper types (Integer, Long, Short, Byte, Character, Boolean, Float, Double).
 
 	{
Default values of primitive types will be treated like any other value. Since there is no distinction, any change to a primitive value will be marked as de.danielbechler.diff.node.Node.State.CHANGED.
 
 		ASSIGNED,

Default values of primitive types will be treated as if the property has not been set. The consequence of this is that a change from default value to something else will be marked as de.danielbechler.diff.node.Node.State.ADDED and from something else to the default value as de.danielbechler.diff.node.Node.State.REMOVED.
 
 		UNASSIGNED
 	}
 
 	private final Collection<StringincludedCategories = new TreeSet<String>();
 	private final Collection<StringexcludedCategories = new TreeSet<String>();
 	private final Collection<Class<?>> equalsOnlyTypes = new LinkedHashSet<Class<?>>(10);
 	private boolean returnUnchangedNodes = false;
 	private boolean returnIgnoredNodes = false;
 	private boolean returnCircularNodes = true;
 	private boolean returnChildrenOfAddedNodes = false;
 	private boolean returnChildrenOfRemovedNodes = false;
 
 	public Configuration withCategory(final String category)
 	{
 		this..addAll(Arrays.asList(category));
 		return this;
 	}
 
 	public Configuration withoutCategory(final String... category)
 	{
 		this..addAll(Arrays.asList(category));
 		return this;
 	}
 
 	public Configuration withPropertyPath(final PropertyPath propertyPath)
 	{
 		this..add(propertyPath);
 		return this;
 	}
 
 	public Configuration withoutProperty(final PropertyPath propertyPath)
 	{
 		this..add(propertyPath);
 		return this;
 	}
 
 	public Configuration withEqualsOnlyType(final Class<?> type)
 	{
 		this..add(type);
 		return this;
 	}
 
 	public Configuration withEqualsOnlyProperty(final PropertyPath propertyPath)
 	{
 		this..add(propertyPath);
		return this;
	}
	{
		this. = true;
		return this;
	}
	{
		this. = false;
		return this;
	}
	{
		this. = true;
		return this;
	}
	{
		this. = false;
		return this;
	}
	{
		this. = true;
		return this;
	}
	{
		this. = false;
		return this;
	}
	{
		return this;
	}
	{
		return this;
	}
	{
		return this;
	}
	{
		return this;
	}
	{
		this. = mode;
		return this;
	}
	{
	}
	public boolean isIgnored(final Node node)
	{
		return node.isIgnored() || !isIncluded(node) || isExcluded(node);
	}
	public boolean isIncluded(final Node node)
	{
		if (node.isRootNode())
		{
			return true;
		}
		{
			return true;
		}
		else if (de.danielbechler.util.Collections.containsAny(node.getCategories(), ))
		{
			return true;
		}
		{
			return true;
		}
		return false;
	}
	public boolean isExcluded(final Node node)
	{
		{
			return true;
		}
		if (de.danielbechler.util.Collections.containsAny(node.getCategories(), ))
		{
			return true;
		}
		return false;
	}
	public boolean isEqualsOnly(final Node node)
	{
		final Class<?> propertyType = node.getType();
		if (propertyType != null)
		{
			if (propertyType.getAnnotation(ObjectDiffEqualsOnlyType.class) != null)
			{
				return true;
			}
			if (.contains(propertyType))
			{
				return true;
			}
			if (Classes.isSimpleType(propertyType))
			{
				return true;
			}
		}
		if (node.isEqualsOnly())
		{
			return true;
		}
		{
			return true;
		}
		return false;
	}
	public boolean isReturnable(final Node node)
	{
		if (node.isIgnored())
		{
		}
		else if (node.isCircular())
		{
		}
		else if (node.isUntouched())
		{
			if (node.hasChanges())
			{
				return true;
			}
			else if (node.hasChildren())
			{
				return true;
			}
		}
		return true;
	}
	public boolean isIntrospectible(final Node node)
	{
		if (isEqualsOnly(node))
		{
			return false;
		}
		else if (node.isAdded())
		{
		}
		else if (node.isRemoved())
		{
		}
		return true;
	}
New to GrepCode? Check out our FAQ X