Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Gabriel Roldan <gabriel.roldan@gmail.com>
- Loading branch information
Showing
18 changed files
with
139 additions
and
85 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
File renamed without changes.
File renamed without changes.
87 changes: 87 additions & 0 deletions
87
src/api/src/main/java/org/locationtech/geogig/model/impl/RevFeatureTypeImpl.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/* Copyright (c) 2014-2016 Boundless and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Distribution License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/org/documents/edl-v10.html | ||
* | ||
* Contributors: | ||
* Gabriel Roldan (Boundless) - initial implementation | ||
*/ | ||
package org.locationtech.geogig.model.impl; | ||
|
||
import org.locationtech.geogig.model.ObjectId; | ||
import org.locationtech.geogig.model.RevFeatureType; | ||
import org.opengis.feature.type.FeatureType; | ||
import org.opengis.feature.type.Name; | ||
import org.opengis.feature.type.PropertyDescriptor; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
|
||
import lombok.NonNull; | ||
|
||
/** | ||
* A binary representation of the state of a Feature Type. | ||
*/ | ||
class RevFeatureTypeImpl extends AbstractRevObject implements RevFeatureType { | ||
|
||
private final FeatureType featureType; | ||
|
||
/** | ||
* Constructs a new {@code RevFeatureType} from the given {@link ObjectId} and | ||
* {@link FeatureType}. | ||
* | ||
* @param id the object id to use for this feature type | ||
* @param featureType the feature type to use | ||
*/ | ||
RevFeatureTypeImpl(@NonNull ObjectId id, @NonNull FeatureType featureType) { | ||
super(id); | ||
this.featureType = featureType; | ||
} | ||
|
||
@Override | ||
public TYPE getType() { | ||
return TYPE.FEATURETYPE; | ||
} | ||
|
||
@Override | ||
public FeatureType type() { | ||
return featureType; | ||
} | ||
|
||
/** | ||
* @return the list of {@link PropertyDescriptor}s of the feature type | ||
*/ | ||
@Override | ||
public ImmutableList<PropertyDescriptor> descriptors() { | ||
return ImmutableList.copyOf(featureType.getDescriptors()); | ||
} | ||
|
||
/** | ||
* @return the name of the feature type | ||
*/ | ||
@Override | ||
public Name getName() { | ||
return type().getName(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
StringBuilder builder = new StringBuilder(); | ||
builder.append("FeatureType["); | ||
builder.append(getId().toString()); | ||
builder.append("; "); | ||
boolean first = true; | ||
for (PropertyDescriptor desc : descriptors()) { | ||
if (first) { | ||
first = false; | ||
} else { | ||
builder.append(", "); | ||
} | ||
builder.append(desc.getName().getLocalPart()); | ||
builder.append(": "); | ||
builder.append(desc.getType().getBinding().getSimpleName()); | ||
} | ||
builder.append(']'); | ||
return builder.toString(); | ||
} | ||
} |
This file contains 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
File renamed without changes.
File renamed without changes.
This file contains 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
File renamed without changes.
This file contains 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
File renamed without changes.
This file contains 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
This file contains 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
Oops, something went wrong.