![JAR search and dependency download from the Maven repository](/logo.png)
com.gs.fw.common.mithra.attribute.MappedTimeAttribute Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of reladomo Show documentation
Show all versions of reladomo Show documentation
Reladomo is an object-relational mapping framework.
/*
Copyright 2016 Goldman Sachs.
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 com.gs.fw.common.mithra.attribute;
import com.gs.collections.api.block.function.Function;
import com.gs.fw.common.mithra.MithraObjectPortal;
import com.gs.fw.common.mithra.attribute.calculator.procedure.ObjectProcedure;
import com.gs.fw.common.mithra.attribute.calculator.procedure.TimeProcedure;
import com.gs.fw.common.mithra.extractor.ChainedAttributeValueSelector;
import com.gs.fw.common.mithra.finder.*;
import com.gs.fw.common.mithra.util.Time;
import java.util.Set;
public class MappedTimeAttribute extends TimeAttribute implements MappedAttribute
{
private TimeAttribute wrappedAttribute;
private Mapper mapper;
private Function parentExtractor;
public MappedTimeAttribute(TimeAttribute wrappedAttribute, Mapper mapper, Function parentSelector)
{
this.wrappedAttribute = wrappedAttribute;
this.mapper = mapper;
this.parentExtractor = parentSelector;
while (this.wrappedAttribute instanceof MappedTimeAttribute)
{
MappedTimeAttribute ma = (MappedTimeAttribute) this.wrappedAttribute;
this.mapper = new ChainedMapper(this.mapper, ma.getMapper());
this.wrappedAttribute = (TimeAttribute) ma.getWrappedAttribute();
this.parentExtractor = new ChainedAttributeValueSelector(this.parentExtractor, ma.getParentExtractor());
}
}
@Override
public String getAttributeName()
{
if (super.getAttributeName() == null)
{
computeMappedAttributeName(this.wrappedAttribute, this.parentExtractor);
}
return super.getAttributeName();
}
@Override
public String zGetTopOwnerClassName()
{
return this.mapper.getResultOwnerClassName();
}
@Override
public Attribute getSourceAttribute()
{
return this.wrappedAttribute.getSourceAttribute();
}
@Override
public SourceAttributeType getSourceAttributeType()
{
return this.wrappedAttribute.getSourceAttributeType();
}
@Override
public AsOfAttribute[] getAsOfAttributes()
{
return this.wrappedAttribute.getAsOfAttributes();
}
@Override
public boolean isSourceAttribute()
{
return this.wrappedAttribute.isSourceAttribute();
}
public Function getParentExtractor()
{
return parentExtractor;
}
public Attribute getWrappedAttribute()
{
return wrappedAttribute;
}
public Function getParentSelector()
{
return this.parentExtractor;
}
public MappedAttribute cloneForNewMapper(Mapper mapper, Function parentSelector)
{
return new MappedTimeAttribute((TimeAttribute) this.getWrappedAttribute(), mapper, parentSelector);
}
public Mapper getMapper()
{
return mapper;
}
@Override
public Operation isNull()
{
return new MappedOperation(this.mapper, this.wrappedAttribute.isNull());
}
@Override
public Operation isNotNull()
{
return new MappedOperation(this.mapper, this.wrappedAttribute.isNotNull());
}
public Time timeValueOf(Object o)
{
if (parentExtractor == null) return null;
Object result = parentExtractor.valueOf(o);
if (result == null) return null;
return this.wrappedAttribute.timeValueOf(result);
}
public void setTimeValue(Object o, Time newValue)
{
if (parentExtractor == null) return;
Object result = parentExtractor.valueOf(o);
if (result == null) return;
this.wrappedAttribute.setTimeValue(result, newValue);
}
@Override
public Operation eq(Time other)
{
return new MappedOperation(this.mapper, this.wrappedAttribute.eq(other));
}
@Override
public Operation notEq(Time other)
{
return new MappedOperation(this.mapper, this.wrappedAttribute.notEq(other));
}
@Override
public Operation in(Set
© 2015 - 2025 Weber Informatics LLC | Privacy Policy