Class PathDescriptorPart
- java.lang.Object
-
- com.helger.photon.api.pathdescriptor.PathDescriptorPart
-
- All Implemented Interfaces:
Serializable
@Immutable public final class PathDescriptorPart extends Object implements Serializable
This class keeps a single path part. This can be either a static string or a variable argument with optional constraints.- Author:
- Philip Helger
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static charCONSTRAINT_SEPARATORstatic StringVARIABLE_ENDstatic StringVARIABLE_START
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PathDescriptorPartcreate(String sPathPart)booleanequals(Object o)com.helger.commons.collection.impl.ICommonsList<PathDescriptorVariableConstraint>getAllVariableConstraints()StringgetAsURLString()StringgetName()static StringgetVariableName(String sName)inthashCode()booleanisVariable()booleanmatches(String sPathPart)Check if the passed path part matches the requirements of this object.StringtoString()
-
-
-
Field Detail
-
VARIABLE_START
public static final String VARIABLE_START
- See Also:
- Constant Field Values
-
VARIABLE_END
public static final String VARIABLE_END
- See Also:
- Constant Field Values
-
CONSTRAINT_SEPARATOR
public static final char CONSTRAINT_SEPARATOR
- See Also:
- Constant Field Values
-
-
Method Detail
-
isVariable
public boolean isVariable()
- Returns:
trueif this is variable path part,falseif it is static
-
getName
@Nonnull @Nonempty public String getName()
- Returns:
- Either the static string or the name of the variable. Neither
nullnor empty.
-
getAllVariableConstraints
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<PathDescriptorVariableConstraint> getAllVariableConstraints()
- Returns:
- The optional variable constraints. Only relevant if this is a
variable path part. Never
nullbut maybe empty.
-
matches
public boolean matches(@Nonnull String sPathPart)
Check if the passed path part matches the requirements of this object. If this is a static path part, it's a simple string equals. For variable path parts, all the constraints (if any) must be fulfilled.- Parameters:
sPathPart- The string to be checked.- Returns:
trueif the passed string matches,falseotherwise.
-
getVariableName
@Nonnull @Nonempty public static String getVariableName(@Nonnull @Nonempty String sName)
-
create
@Nonnull public static PathDescriptorPart create(@Nonnull @Nonempty String sPathPart)
-
-